mirror of
https://github.com/lightninglabs/lightning-terminal.git
synced 2026-08-13 12:33:36 +02:00
scripts: exclude backward compatible versions from linter
This commit is contained in:
parent
0015ca29af
commit
04fb5c41e0
2 changed files with 37 additions and 0 deletions
|
|
@ -34,6 +34,7 @@ exception_list=(
|
|||
# Exclude the tools Dockerfile as otherwise the linter may need to be
|
||||
# considered every time the Go version is updated.
|
||||
"./tools/Dockerfile"
|
||||
"./itest/backward-compat"
|
||||
)
|
||||
|
||||
# is_exception checks if a file is in the exception list.
|
||||
|
|
@ -43,6 +44,13 @@ is_exception() {
|
|||
if [ "$file" == "$exception" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Check if the file is inside an excluded directory.
|
||||
# The trailing slash ensures that similarly named directories
|
||||
# (e.g., ./itest/backward-compat_other) are not mistakenly excluded.
|
||||
if [[ "$file/" == "$exclude"* ]]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,11 +63,40 @@ fi
|
|||
|
||||
target_go_version="$1"
|
||||
|
||||
# File paths to be excluded from the check.
|
||||
exception_list=(
|
||||
"./itest/backward-compat"
|
||||
)
|
||||
|
||||
# is_exception checks if a file is in the exception list.
|
||||
is_exception() {
|
||||
local file="$1"
|
||||
for exception in "${exception_list[@]}"; do
|
||||
if [ "$file" == "$exception" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Check if the file is inside an excluded directory.
|
||||
# The trailing slash ensures that similarly named directories
|
||||
# (e.g., ./itest/backward-compat_other) are not mistakenly excluded.
|
||||
if [[ "$file/" == "$exclude"* ]]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
# Search for YAML files in the current directory and its subdirectories.
|
||||
yaml_files=$(find . -type f \( -name "*.yaml" -o -name "*.yml" \))
|
||||
|
||||
# Check each YAML file.
|
||||
for file in $yaml_files; do
|
||||
# Skip the file if it is in the exception list.
|
||||
if is_exception "$file"; then
|
||||
echo "Skipping $file"
|
||||
continue
|
||||
fi
|
||||
|
||||
check_go_version_yaml "$file" "$target_go_version"
|
||||
check_go_version_env_variable "$file" "$target_go_version"
|
||||
done
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue