Skip to content

Conversation

cclauss
Copy link
Contributor

@cclauss cclauss commented Jul 9, 2025

Add a local pre-commit hook to verify the copyright notice is in all Python files in Tools/ros2.

% pre-commit run check-copyright --verbose --all-files

Make exceptions for:

Tools/gittools/pre_commit_copyright.py \
    --ignore=Tools/ros2/ardupilot_dds_tests/setup.py \
    --ignore=Tools/ros2/ardupilot_dds_tests/test/test_pep257.py \
    --ignore=Tools/ros2/ardupilot_dds_tests/test/test_copyright.py

How was this tested?

% Tools/gittools/pre_commit_copyright.py

Usage: python pre_commit_copyright.py file_path [...]

% Tools/gittools/pre_commit_copyright.py README.md

Copyright not found in: README.md

% Tools/gittools/pre_commit_copyright.py README.md COPYING.txt

Copyright not found in: COPYING.txt, README.md

% Tools/gittools/pre_commit_copyright.py Tools/ros2/ardupilot_sitl/launch/sitl.launch.py

<Nothing because this file has the copyright notice.>

% pre-commit run check-copyright --verbose --all-files

Check copyright notice in files..........................................Passed
- hook id: check-copyright
- duration: 0.08s

Edit Tools/gittools/pre_commit_copyright.py and add a Z to the front of each of the exclude_file_paths.
% pre-commit run check-copyright --verbose --all-files

Check copyright notice in files..........................................Failed
- hook id: check-copyright
- duration: 0.07s
- exit code: 1

Copyright not found in: Tools/ros2/ardupilot_dds_tests/setup.py
Copyright not found in: Tools/ros2/ardupilot_dds_tests/test/test_pep257.py
Copyright not found in: Tools/ros2/ardupilot_dds_tests/test/test_copyright.py

Edit Tools/gittools/pre_commit_copyright.py to remove those Z's.

@cclauss cclauss force-pushed the Tools_gittools_pre_commit_copyright.py branch from a5119f0 to f705a95 Compare July 9, 2025 12:50
@peterbarker peterbarker requested a review from Ryanf55 July 10, 2025 05:43
@cclauss cclauss force-pushed the Tools_gittools_pre_commit_copyright.py branch 2 times, most recently from 442a15c to 530c397 Compare July 11, 2025 20:50
Copy link
Contributor

@Ryanf55 Ryanf55 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice addition for something that has so far been a manual verification.

@cclauss cclauss force-pushed the Tools_gittools_pre_commit_copyright.py branch 3 times, most recently from d1a74d3 to 217dec2 Compare July 13, 2025 09:02
@cclauss cclauss force-pushed the Tools_gittools_pre_commit_copyright.py branch from 217dec2 to dc627d2 Compare July 14, 2025 23:16
@cclauss cclauss requested a review from peterbarker July 14, 2025 23:24
@cclauss cclauss force-pushed the Tools_gittools_pre_commit_copyright.py branch 2 times, most recently from d17b3e9 to ce071d9 Compare July 17, 2025 16:15
@cclauss cclauss force-pushed the Tools_gittools_pre_commit_copyright.py branch 3 times, most recently from 8d74c1b to 71af7f1 Compare August 13, 2025 07:11
@cclauss cclauss force-pushed the Tools_gittools_pre_commit_copyright.py branch from 71af7f1 to 607e264 Compare August 15, 2025 07:17
@cclauss cclauss force-pushed the Tools_gittools_pre_commit_copyright.py branch from 607e264 to 6bf3a2a Compare September 2, 2025 09:06
@cclauss cclauss force-pushed the Tools_gittools_pre_commit_copyright.py branch from 6bf3a2a to 9bbdeeb Compare September 2, 2025 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants