sedona icon indicating copy to clipboard operation
sedona copied to clipboard

Add pre-commit `automation` to add `license templates` to headers of files

Open jbampton opened this issue 1 year ago • 1 comments

I've used some pre-commit hooks from Lucas-C and some of these hooks are also used on Apache Airflow.

https://github.com/Lucas-C/pre-commit-hooks

This issue is for adding license headers:

https://github.com/Lucas-C/pre-commit-hooks?tab=readme-ov-file#insert-license

And we can see a working example on Apache Airflow:

https://github.com/apache/airflow/blob/2899e5f0e27c65e29780c81c45db989eba6dc027/.pre-commit-config.yaml#L98

You can assign this issue to me. I am starting with our single TOML file to auto add the missing license on git commit.

Works well this hook since if you forget to add a license header to a file, then when you git commit the commit fails but the hook should auto insert the license template into the header of the files that are missing the licenses. Then you can git add and git commit again and the hook should pass.

One step better than just having a "test for license" since this hook is automated.

jbampton avatar Oct 15 '24 21:10 jbampton

Example runs here now:

Ran pre-commit and the hook failed

Screenshot from 2024-10-16 07-40-42

You can see here the hook auto added the license header shown by the "green vertical line git addition":

Screenshot from 2024-10-16 08-40-23

jbampton avatar Oct 15 '24 22:10 jbampton