File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ exception_list=(
3434 # Exclude the tools Dockerfile as otherwise the linter may need to be
3535 # considered every time the Go version is updated.
3636 " ./tools/Dockerfile"
37+ " ./itest/backward-compat"
3738)
3839
3940# is_exception checks if a file is in the exception list.
@@ -43,6 +44,13 @@ is_exception() {
4344 if [ " $file " == " $exception " ]; then
4445 return 0
4546 fi
47+
48+ # Check if the file is inside an excluded directory.
49+ # The trailing slash ensures that similarly named directories
50+ # (e.g., ./itest/backward-compat_other) are not mistakenly excluded.
51+ if [[ " $file /" == " $exclude " * ]]; then
52+ return 0
53+ fi
4654 done
4755 return 1
4856}
Original file line number Diff line number Diff line change 6363
6464target_go_version=" $1 "
6565
66+ # File paths to be excluded from the check.
67+ exception_list=(
68+ " ./itest/backward-compat"
69+ )
70+
71+ # is_exception checks if a file is in the exception list.
72+ is_exception () {
73+ local file=" $1 "
74+ for exception in " ${exception_list[@]} " ; do
75+ if [ " $file " == " $exception " ]; then
76+ return 0
77+ fi
78+
79+ # Check if the file is inside an excluded directory.
80+ # The trailing slash ensures that similarly named directories
81+ # (e.g., ./itest/backward-compat_other) are not mistakenly excluded.
82+ if [[ " $file /" == " $exclude " * ]]; then
83+ return 0
84+ fi
85+ done
86+ return 1
87+ }
88+
6689# Search for YAML files in the current directory and its subdirectories.
6790yaml_files=$( find . -type f \( -name " *.yaml" -o -name " *.yml" \) )
6891
6992# Check each YAML file.
7093for file in $yaml_files ; do
94+ # Skip the file if it is in the exception list.
95+ if is_exception " $file " ; then
96+ echo " Skipping $file "
97+ continue
98+ fi
99+
71100 check_go_version_yaml " $file " " $target_go_version "
72101 check_go_version_env_variable " $file " " $target_go_version "
73102done
You can’t perform that action at this time.
0 commit comments