Skip to content

Commit 33c4260

Browse files
authored
Merge pull request #98 from ahoppen/more-license-header-file-extensions
Add more file extensions to the license headers that we handle
2 parents 6b75c13 + b3e1022 commit 33c4260

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

.github/workflows/scripts/check-license-header.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,12 @@ while IFS= read -r file_path; do
5858

5959
# shellcheck disable=SC2001 # We prefer to use sed here instead of bash search/replace
6060
case "${file_extension}" in
61+
bazel) expected_file_header=$(sed -e 's|@@|##|g' <<<"${expected_file_header_template}") ;;
62+
bzl) expected_file_header=$(sed -e 's|@@|##|g' <<<"${expected_file_header_template}") ;;
63+
bazelrc) expected_file_header=$(sed -e 's|@@|##|g' <<<"${expected_file_header_template}") ;;
6164
c) expected_file_header=$(sed -e 's|@@|//|g' <<<"${expected_file_header_template}") ;;
6265
cmake) expected_file_header=$(sed -e 's|@@|##|g' <<<"${expected_file_header_template}") ;;
66+
editorconfig) expected_file_header=$(sed -e 's|@@|##|g' <<<"${expected_file_header_template}") ;;
6367
gradle) expected_file_header=$(sed -e 's|@@|//|g' <<<"${expected_file_header_template}") ;;
6468
groovy) expected_file_header=$(sed -e 's|@@|//|g' <<<"${expected_file_header_template}") ;;
6569
h) expected_file_header=$(sed -e 's|@@|//|g' <<<"${expected_file_header_template}") ;;
@@ -81,14 +85,15 @@ while IFS= read -r file_path; do
8185
*)
8286
error "Unsupported file extension ${file_extension} for file (exclude or update this script): ${file_path}"
8387
paths_with_missing_license+=("${file_path} ")
88+
continue
8489
;;
8590
esac
8691
expected_file_header_linecount=$(wc -l <<<"${expected_file_header}")
8792

8893
file_header=$(head -n "${expected_file_header_linecount}" "${file_path}")
8994
normalized_file_header=$(
9095
echo "${file_header}" \
91-
| sed -e 's/20[12][0123456789]-20[12][0123456789]/YEARS/' -e 's/20[12][0123456789]/YEARS/' \
96+
| sed -E -e 's/20[12][0123456789] ?- ?20[12][0123456789]/YEARS/' -e 's/20[12][0123456789]/YEARS/' \
9297
)
9398

9499
if ! diff -u \

0 commit comments

Comments
 (0)