diff --git a/steps/lint.sh b/steps/lint.sh index 5059dd23..058a98f3 100755 --- a/steps/lint.sh +++ b/steps/lint.sh @@ -52,3 +52,20 @@ fi bibcop tex/report.bib find "${LOCAL}" -name '*.sh' -type f -print0 | xargs -0 -n1 shellcheck --shell=bash --severity=style + +header="Copyright (c) 2021-$(date +%Y) Yegor Bugayenko" + +copyright_check="false" + +# Iterate over each file in the directory recursively +while IFS= read -r file; do + # Search for the pattern in the file + if ! grep -q "$header" "$file"; then + copyright_check="true" + echo "⚠️ Copyright not found in file: $file" + fi +done < <(find "$LOCAL" -type f \( -name "*.sh" -o -name "*.py" -o -name "*.rb" \)) + +if [[ "${copyright_check}" = "true" ]]; then + exit 1 +fi