Skip to content

Commit

Permalink
compiled findShebangFiles using go compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
fchastanet committed Aug 17, 2024
1 parent 1a2f311 commit a2118f2
Show file tree
Hide file tree
Showing 11 changed files with 1,391 additions and 1,001 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config-github.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,6 @@ repos:
stages: [manual] # GITHUB

- repo: https://github.com/fchastanet/bash-compiler
rev: 0.2.4
rev: 0.2.5
hooks:
- id: buildBashBinaries
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,6 @@ repos:
stages: [] # GITHUB

- repo: https://github.com/fchastanet/bash-compiler
rev: 0.2.4
rev: 0.2.5
hooks:
- id: buildBashBinaries
7 changes: 7 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
"program": "bin/runBuildContainer",
"args": ["/bash/bin/doc", "--skip-docker-build", "-vvv"]
},
{
"type": "bashdb",
"request": "launch",
"name": "Bash-Debug (findShebangFiles)",
"program": "bin/findShebangFiles",
"args": ["ls", "-al", "-vvv"]
},
{
"type": "bashdb",
"request": "launch",
Expand Down
70 changes: 34 additions & 36 deletions bin/awkLint
Original file line number Diff line number Diff line change
Expand Up @@ -1586,6 +1586,7 @@ optionLogLevelCallback() {
local logLevel verboseLevel
logLevel="$(getLevel "${level}")"
verboseLevel="$(getVerboseLevel "${level}")"
# shellcheck disable=SC2034
BASH_FRAMEWORK_ARGS_VERBOSE=${verboseLevel}
echo "BASH_FRAMEWORK_LOG_LEVEL=${logLevel}" >>"${overrideEnvFile}"
}
Expand Down Expand Up @@ -1691,7 +1692,11 @@ commandOptionParseFinished() {
}



# shellcheck disable=SC2034
declare copyrightBeginYear="2022"
# shellcheck disable=SC2034
declare versionNumber="1.0"

optionHelpCallback() {
awkLintCommandHelp
Expand Down Expand Up @@ -2397,43 +2402,36 @@ Compiler::Embed::extractFileFromBase64 \
declare -gx embed_file_awkLintScript="${PERSISTENT_TMPDIR:-/tmp}/7bb90f02e1b3b54c8e5d9be220b3c741/awkLintScript"


run() {
# <?xml version='1.0' encoding='UTF-8'?>
# <checkstyle version='4.3'>
# <file name='./tests/bash&#45;framework/ManualTest.sh' >
# <error line='9' column='8' severity='warning' message='Can&#39;t follow non&#45;constant source. Use a directive to specify location.' source='ShellCheck.SC1090' />
# <error line='17' column='5' severity='warning' message='Use &#39;cd ... &#124;&#124; exit&#39; or &#39;cd ... &#124;&#124; return&#39; in case cd fails.' source='ShellCheck.SC2164' />
# <error line='27' column='5' severity='warning' message='Use &#39;cd ... &#124;&#124; exit&#39; or &#39;cd ... &#124;&#124; return&#39; in case cd fails.' source='ShellCheck.SC2164' />
# </file>
# </checkstyle>
local exitCode="0"
echo "<?xml version='1.0' encoding='UTF-8'?>"
echo "<checkstyle>"
tempFile="$(Framework::createTempFile)"
while IFS='' read -r file; do
# shellcheck disable=SC2154
if [[ ! -f "${file}" ]]; then
Log::displayWarning "File ${file} has been deleted from git."
else
echo "<file name='${file}'>"
awk --source "BEGIN { exit(0) } END { exit(0) }" --lint=no-ext \
-f "${file}" >"${tempFile}" 2>&1 </dev/null || exitCode="1"
awk -f "${embed_file_awkLintScript}" - <"${tempFile}"
echo "</file>"
fi
done < <(
git ls-files --exclude-standard |
grep -E '\.(awk)$' || true
)
echo "</checkstyle>"
return "${exitCode}"
}
# <?xml version='1.0' encoding='UTF-8'?>
# <checkstyle version='4.3'>
# <file name='./tests/bash&#45;framework/ManualTest.sh' >
# <error line='9' column='8' severity='warning' message='Can&#39;t follow non&#45;constant source. Use a directive to specify location.' source='ShellCheck.SC1090' />
# <error line='17' column='5' severity='warning' message='Use &#39;cd ... &#124;&#124; exit&#39; or &#39;cd ... &#124;&#124; return&#39; in case cd fails.' source='ShellCheck.SC2164' />
# <error line='27' column='5' severity='warning' message='Use &#39;cd ... &#124;&#124; exit&#39; or &#39;cd ... &#124;&#124; return&#39; in case cd fails.' source='ShellCheck.SC2164' />
# </file>
# </checkstyle>
local exitCode="0"
echo "<?xml version='1.0' encoding='UTF-8'?>"
echo "<checkstyle>"
tempFile="$(Framework::createTempFile)"
while IFS='' read -r file; do
# shellcheck disable=SC2154
if [[ ! -f "${file}" ]]; then
Log::displayWarning "File ${file} has been deleted from git."
else
echo "<file name='${file}'>"
awk --source "BEGIN { exit(0) } END { exit(0) }" --lint=no-ext \
-f "${file}" >"${tempFile}" 2>&1 </dev/null || exitCode="1"
awk -f "${embed_file_awkLintScript}" - <"${tempFile}"
echo "</file>"
fi
done < <(
git ls-files --exclude-standard |
grep -E '\.(awk)$' || true
)
echo "</checkstyle>"
exit "${exitCode}"

if [[ "${BASH_FRAMEWORK_QUIET_MODE:-0}" = "1" ]]; then
run &>/dev/null
else
run
fi


}
Expand Down
Loading

0 comments on commit a2118f2

Please sign in to comment.