Qual: Update pre-commit for shell script formatting (#37221)

* Qual: Upgrade pre-commit/beautysh, .editorconfig for sh

# Qual: Upgrade pre-commit/beautysh, .editorconfig for sh

- Upgrade beautysh pre-commit hook (trixie/python 3.13 compatibility);
- Indicate tab indent for shell scripts in .editorconfig.

* Qual: Update pre-commit hooks configuration

- Exclude `dev/initdemo/initdemo.sh` from beautysh hook
- Enable shellcheck hook manually
- Fix indentation in `initdemo.sh`

* Qual: Update pre-commit hook configuration

- Update .pre-commit-config.yaml to exclude dolibarr.postrm from beautysh formatting

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
MDW 2026-02-17 22:05:03 +01:00 committed by GitHub
parent bd2ff84a95
commit 7d89635c5b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 69 additions and 64 deletions

View file

@ -18,6 +18,8 @@ insert_final_newline = true
indent_style = tab
[*.css]
indent_style = tab
[*.sh]
indent_style = tab
[*.xml]
indent_style = tab
[*.md]

View file

@ -72,14 +72,16 @@ repos:
stages: [manual] # To run: pre-commit run -a --hook-stage=manual actionlint
# Beautify shell scripts
#- repo: https://github.com/lovesegfault/beautysh.git
# rev: v6.2.1
# hooks:
# - id: beautysh
# exclude: |
# (?x)^(dev/setup/git/hooks/pre-commit
# )$
# args: [--tab]
- repo: https://github.com/lovesegfault/beautysh.git
rev: v6.4.2
hooks:
- id: beautysh
exclude: |
(?x)^(dev/setup/git/hooks/pre-commit
|dev/initdemo/initdemo.sh # indent/outdent mismatch
|dev/build/debian/dolibarr.postrm # indent/outdent mismatch
)$
args: [--tab]
# Run local script
#
@ -246,11 +248,12 @@ repos:
- ned
# Check some shell scripts
#- repo: https://github.com/shellcheck-py/shellcheck-py
# rev: v0.11.0.1
# hooks:
# - id: shellcheck
# args: [-W, "100"]
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.11.0.1
hooks:
- id: shellcheck
stages: [manual] # To run: `pre-commit run -a --hook-stage=manual shellcheck`
args: [-W, "100"]
# Check sql file syntax
- repo: https://github.com/sqlfluff/sqlfluff
@ -293,4 +296,4 @@ repos:
# # virtualmin excluded - reason https://github.com/Dolibarr/dolibarr/pull/36370#issuecomment-3565101823
# exclude: (?x)^
# (dev/build/perl/virtualmin/dolibarr.pl
# )$
# across all file typese )$

View file

@ -1,5 +1,5 @@
#!/bin/bash
# Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
# Copyright (C) 2024-2026 MDW <mdeweerd@users.noreply.github.com>
#------------------------------------------------------
# Script to purge and initialize a database with demo values.
@ -91,7 +91,7 @@ then
fichtemp=$(mktemp 2>/dev/null) || fichtemp=/tmp/test$$
# shellcheck disable=2064,2172
trap "rm -f '$fichtemp'" 0 1 2 5 15
$DIALOG --title "Init Dolibarr with demo values" --clear --inputbox "Mysql database name :" 16 55 $base 2> "$fichtemp"
$DIALOG --title "Init Dolibarr with demo values" --clear --inputbox "Mysql database name :" 16 55 "$base" 2> "$fichtemp"
valret=$?
case $valret in
0)
@ -107,7 +107,7 @@ then
fichtemp=$(mktemp 2>/dev/null) || fichtemp=/tmp/test$$
# shellcheck disable=2064,2172
trap "rm -f '$fichtemp'" 0 1 2 5 15
$DIALOG --title "Init Dolibarr with demo values" --clear --inputbox "Mysql port (ex: 3306):" 16 55 $port 2> "$fichtemp"
$DIALOG --title "Init Dolibarr with demo values" --clear --inputbox "Mysql port (ex: 3306):" 16 55 "$port" 2> "$fichtemp"
valret=$?
case $valret in

View file

@ -23,7 +23,7 @@
# - Some side effects from translations on variables.
# - Some other minors side effects to be examined (#, %).
#
# Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
# Copyright (C) 2024-2026 MDW <mdeweerd@users.noreply.github.com>
LANG_DIR=htdocs/langs/en_US/
MYDIR=$(dirname "$(realpath "$0")")