refactor(history): commit development branch
All checks were successful
/ job (push) Successful in 1m12s

new development branch from root commit
This commit is contained in:
Marc Beninca 2025-02-10 21:54:51 +01:00
parent 3e562930f6
commit 020aaa0b9a
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F
94 changed files with 4804 additions and 0 deletions

6
sh/lint/gitlint.sh Normal file
View file

@ -0,0 +1,6 @@
rwx_gitlint() {
local path="${1}"
gitlint \
--target "${path}" \
"lint"
}

78
sh/lint/lint.sh Normal file
View file

@ -0,0 +1,78 @@
# lint code
rwx_lint() {
local path="${1}"
[ -n "${path}" ] || return 1
rwx_lint_clean "${path}"
rwx_lint_tasks "${path}"
set \
"python" \
"shell"
local code
for code in "${@}"; do
rwx_log "" "${code}"
"rwx_lint_${code}" "${path}"
done
rwx_lint_clean "${path}"
}
# clean
rwx_lint_clean() {
local path="${1}"
[ -n "${path}" ] || return 1
rwx_log "" "clean" ""
py3clean "${path}"
set \
"mypy" \
"ruff"
local tool
for tool in "${@}"; do
rwx_remove "${path}/.${tool}_cache"
done
}
# lint python code
rwx_lint_python() {
local path="${1}"
local action
set \
"pylint" \
"pydoclint" \
"mypy" \
"ruff"
for action in "${@}"; do
rwx_log "" "${action}"
"rwx_${action}" "${path}"
done
}
# lint shell code
rwx_lint_shell() {
local path="${1}"
local action
set \
"shellcheck" \
"shfmt"
for action in "${@}"; do
rwx_log "" "${action}"
"rwx_${action}" "${path}"
done
}
# lint code tasks
rwx_lint_tasks() {
local path="${1}"
local type
set \
"LATER" \
"TODO" \
"FIXME"
for type in "${@}"; do
rwx_log "" "${type}"
grep \
--after "1" \
--directories "recurse" \
--line-number \
" ${type}" \
"${path}"
done
}

4
sh/lint/mypy.sh Normal file
View file

@ -0,0 +1,4 @@
rwx_mypy() {
local path="${1}"
mypy "${path}"
}

9
sh/lint/pydoclint.sh Normal file
View file

@ -0,0 +1,9 @@
rwx_pydoclint() {
local path="${1}"
pydoclint \
--allow-init-docstring True \
--quiet \
--skip-checking-short-docstrings False \
--style "sphinx" \
"${path}"
}

6
sh/lint/pylint.sh Normal file
View file

@ -0,0 +1,6 @@
rwx_pylint() {
local path="${1}"
pylint \
--enable-all-extensions \
"${path}/**/*.py"
}

28
sh/lint/ruff.sh Normal file
View file

@ -0,0 +1,28 @@
rwx_ruff() {
local path="${1}"
local action
set \
"check" \
"format"
for action in "${@}"; do
"rwx_ruff_${action}" "${path}"
done
}
rwx_ruff_check() {
local path="${1}"
ruff check \
--ignore "D203,D213" \
--isolated \
--select "ALL" \
"${path}"
}
rwx_ruff_format() {
local path="${1}"
ruff format \
--diff \
--isolated \
--line-length "80" \
"${path}"
}

34
sh/lint/shellcheck.sh Normal file
View file

@ -0,0 +1,34 @@
rwx_shellcheck() {
local root="${1}"
local file module modules path
file="$(mktemp)"
modules="$(rwx_find_shell "${root}")"
rwx_ifs_set
for module in ${modules}; do
path="${root}/${module}"
echo ". \"${path}\"" >>"${file}"
done
rwx_ifs_unset
rwx_shellcheck_file "${file}"
rwx_remove "${file}"
}
rwx_shellcheck_file() {
local file="${1}"
shellcheck \
--check-sourced \
--enable "all" \
--exclude "3043" \
--external-sources \
--shell "dash" \
"${file}"
}
rwx_shellcheck_write() {
rwx_file_write ".shellcheckrc" "\
disable=3043
enable=all
external-sources=true
shell=sh
"
}

4
sh/lint/shfmt.sh Normal file
View file

@ -0,0 +1,4 @@
rwx_shfmt() {
local path="${1}"
shfmt --diff "${path}"
}