Skip to content

Check for copyright header and too-big Lean imports #2037

Check for copyright header and too-big Lean imports

Check for copyright header and too-big Lean imports #2037

name: Check for copyright header and too-big Lean imports
on: [pull_request, merge_group]
jobs:
check-lean-files:
name: "Check copyright header and Lean import size"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Don't 'import Lean', use precise imports
run: |
! (find . -name "*.lean" -type f -print0 | xargs -0 grep -E -n '^import Lean$')
- name: Verify .lean files start with a copyright header.
run: |
FILES=$(find ./src ./test-projects -path ./src/tests/interactive -prune -type f -name "*.lean" -exec perl -ne 'BEGIN { $/ = undef; } print "$ARGV\n" if !m{\A/-\nCopyright}; exit;' {} \;)
if [ -n "$FILES" ]; then
echo "Found .lean files which do not have a copyright header:"
echo "$FILES"
exit 1
else
echo "All copyright headers present."
fi