mirror of
https://github.com/searxng/searxng.git
synced 2025-12-22 19:50:00 +00:00
[enh] CI - add shell script formatter
Implement rules and functions to format shell scripts:
$ make format.shell
or alternatively to format all source code:
$ make format
The formatter `shfmt` reads the rules from the editorconfig[1]
If any EditorConfig files are found, they will be used to apply formatting
options. If any parser or printer flags are given to the tool, no
EditorConfig files will be used.
[1] https://github.com/patrickvane/shfmt?tab=readme-ov-file#description
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
committed by
Markus Heiser
parent
7ee3dc9d74
commit
67e423edb2
15
manage
15
manage
@@ -64,6 +64,12 @@ RST_FILES=(
|
||||
'README.rst'
|
||||
)
|
||||
|
||||
SHFMT_SCRIPTS=(
|
||||
"./manage"
|
||||
"./container"
|
||||
"./utils"
|
||||
)
|
||||
|
||||
help() {
|
||||
nvm.help
|
||||
cat <<EOF
|
||||
@@ -90,6 +96,7 @@ pyenv.:
|
||||
OK : test if virtualenv is OK
|
||||
format.:
|
||||
python : format Python code source using black
|
||||
shell : format Shell scripts using shfmt
|
||||
EOF
|
||||
go.help
|
||||
node.help
|
||||
@@ -248,11 +255,17 @@ pyenv.uninstall() {
|
||||
}
|
||||
|
||||
format.python() {
|
||||
build_msg TEST "[format.python] black \$BLACK_TARGETS"
|
||||
build_msg TEST "[format.python] black ${BLACK_TARGETS[*]}"
|
||||
pyenv.cmd black "${BLACK_OPTIONS[@]}" "${BLACK_TARGETS[@]}"
|
||||
dump_return $?
|
||||
}
|
||||
|
||||
format.shell() {
|
||||
build_msg TEST "[shfmt] shfmt ${SHFMT_SCRIPTS[*]}"
|
||||
go.tool shfmt --list --write "${SHFMT_SCRIPTS[@]}"
|
||||
dump_return $?
|
||||
}
|
||||
|
||||
docs.prebuild() {
|
||||
build_msg DOCS "build ${DOCS_BUILD}/includes"
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user