Skip to content

Commit

Permalink
shellcheckLint - fixed files to lint not computed correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
fchastanet committed Dec 20, 2024
1 parent fc12e3a commit e61b03f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 26 deletions.
14 changes: 2 additions & 12 deletions bin/shellcheckLint
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,6 @@ declare MIN_SHELLCHECK_VERSION="0.9.0"

declare optionFormat="${optionFormatDefault}"
declare -a shellcheckArgs=()
declare -a shellcheckFiles=()

beforeParseCallback() {
Env::requireLoad
Expand All @@ -1008,14 +1007,6 @@ beforeParseCallback() {
unknownOption() {
shellcheckArgs+=("$1")
}
argShellcheckFilesCallback() {
if [[ -f "$1" ]]; then
# shellcheck disable=SC2034
shellcheckFiles=("${@::$#-1}")
else
shellcheckArgs+=("$1")
fi
}
shellcheckLintParseCallback() {
# shellcheck disable=SC2154
if [[ "${optionStaged}" = "1" ]] && ((${#argShellcheckFiles[@]} > 0)); then
Expand Down Expand Up @@ -1472,7 +1463,6 @@ shellcheckLintCommandParse() {
# shellcheck disable=SC2034
# shellcheck disable=SC2034
argShellcheckFiles+=("${options_parse_arg}")
argShellcheckFilesCallback "${argShellcheckFiles[@]}" -- "${@:2}"


# else too much args
Expand Down Expand Up @@ -1745,8 +1735,8 @@ getFiles() {
shellcheckFiles() {
declare -a files
# shellcheck disable=SC2154
if ((${#shellcheckFiles[@]} > 0)); then
files=("${shellcheckFiles[@]}")
if ((${#argShellcheckFiles[@]} > 0)); then
files=("${argShellcheckFiles[@]}")
else
readarray -t files < <(getFiles | sort | uniq)
fi
Expand Down
4 changes: 1 addition & 3 deletions src/_binaries/shellcheckLint/shellcheckLint-binary.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ binData:
callbacks:
- shellcheckLintParseCallback
args:
- callbacks:
- argShellcheckFilesCallback
help: |
- help: |
files to validate with shellcheck. If not provided,
all files from git repository which are beginning
with a bash shebang, unless --staged option is provided.
Expand Down
4 changes: 2 additions & 2 deletions src/_binaries/shellcheckLint/shellcheckLint-main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ getFiles() {
shellcheckFiles() {
declare -a files
# shellcheck disable=SC2154
if ((${#shellcheckFiles[@]} > 0)); then
files=("${shellcheckFiles[@]}")
if ((${#argShellcheckFiles[@]} > 0)); then
files=("${argShellcheckFiles[@]}")
else
readarray -t files < <(getFiles | sort | uniq)
fi
Expand Down
9 changes: 0 additions & 9 deletions src/_binaries/shellcheckLint/shellcheckLint-options.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ declare MIN_SHELLCHECK_VERSION="0.9.0"

declare optionFormat="${optionFormatDefault}"
declare -a shellcheckArgs=()
declare -a shellcheckFiles=()

beforeParseCallback() {
Env::requireLoad
Expand All @@ -16,14 +15,6 @@ beforeParseCallback() {
unknownOption() {
shellcheckArgs+=("$1")
}
argShellcheckFilesCallback() {
if [[ -f "$1" ]]; then
# shellcheck disable=SC2034
shellcheckFiles=("${@::$#-1}")
else
shellcheckArgs+=("$1")
fi
}
shellcheckLintParseCallback() {
# shellcheck disable=SC2154
if [[ "${optionStaged}" = "1" ]] && ((${#argShellcheckFiles[@]} > 0)); then
Expand Down

0 comments on commit e61b03f

Please sign in to comment.