[UPD] format with script format.sh

This commit is contained in:
Mathieu Benoit 2023-12-02 14:09:09 -05:00
parent eff77820ba
commit 87730b5221
6 changed files with 45 additions and 5 deletions

20
.editorconfig Normal file
View file

@ -0,0 +1,20 @@
# Configuration for known file extensions
[*.{css,js,json,less,md,py,rst,sass,scss,xml,yaml,yml}]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[.eslintrc,*.{json,yml,yaml,rst,md}]
indent_size = 2
# Do not configure editor for libs and autogenerated content
[*/static/{lib,src/lib}/**,*/static/description/index.html,*/readme/../README.rst]
charset = unset
end_of_line = unset
indent_size = unset
indent_style = unset
insert_final_newline = false
trim_trailing_whitespace = false

View file

@ -49,7 +49,17 @@ cd "$3" || exit 1
git checkout -- "*.po*"
cd - || exit 1
./script/maintenance/black.sh "$3"
#./script/maintenance/format.sh "$3"
# Itéré pour chaque module et formater
IFS=','
# Diviser la chaîne en un tableau
read -ra elements <<<"$4"
# Itérer sur les éléments
for element in "${elements[@]}"; do
echo "Format ${3}/${element}"
./script/maintenance/format.sh "${3}/${element}"
done
echo "TEST ${2}"
./script/code_generator/check_git_change_code_generator.sh "$3"
retVal=$?

View file

@ -212,8 +212,8 @@ def main():
with open(hooks_file_path, "w") as source:
source.write(new_file_content)
# Call black
os.system(f"./script/maintenance/black.sh {hooks_file_path}")
# Call format all file
os.system(f"./script/maintenance/format.sh {hooks_file_path}")
return 0

View file

@ -2,7 +2,7 @@
# This will format all python file
# argument 1: directory or file to format
source ./.venv/bin/activate
black -l 79 --preview -t py37 $@
black -l 79 --preview -t py37 "$@"
retVal=$?
if [[ $retVal -ne 0 ]]; then
echo "Error black format"

8
script/maintenance/format.sh Executable file
View file

@ -0,0 +1,8 @@
#!/usr/bin/env bash
cmd1="./script/maintenance/format_python.sh \"$*\""
cmd2="find \"$*\" -type f -not -path \"*/not_supported_files/*\" -name '*.xml' -print0 | parallel -0 ./script/maintenance/prettier_xml.sh {}"
cmd3="find \"$*\" -type f -not -path \"*/not_supported_files/*\" -name '*.js' -print0 | parallel -0 ./script/maintenance/prettier.sh {}"
cmd4="find \"$*\" -type f -not -path \"*/not_supported_files/*\" -name '*.css' -print0 | parallel -0 ./script/maintenance/prettier.sh {}"
cmd5="find \"$*\" -type f -not -path \"*/not_supported_files/*\" -name '*.scss' -print0 | parallel -0 ./script/maintenance/prettier.sh {}"
cmd6="find \"$*\" -type f -not -path \"*/not_supported_files/*\" -name '*.html' -print0 | parallel -0 ./script/maintenance/prettier.sh {}"
parallel ::: "$cmd1" "$cmd2" "$cmd3" "$cmd4" "$cmd5" "$cmd6"

View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
.venv/bin/isort --profile black -l 79 "$@"
source ./.venv/bin/activate
isort --profile black -l 79 "$@"
#./.venv/bin/isort --profile black -l 79 "$@"
./script/maintenance/black.sh "$@"