macaron icon indicating copy to clipboard operation
macaron copied to clipboard

chore: add comment formatting pre-commit hook script

Open benmss opened this issue 5 months ago • 0 comments

Summary

This PR adds a new pre-commit hook that checks the grammar/formatting of Python comments.

Description of changes

The script attempts to correct comments so that they start with a capital letter and end with a full stop where applicable. This is achieved by examination of the space tokenised contents of each comment.

As implemented, the new hook checks any Python source files that were changed and reside within the src/macaron or tests directories. All source files that could be changed by this script have been modified and included as part of this PR. Some files were manually edited to overcome script limitations, or to be excluded from checking entirely.

Information on working with the script (including disabling it for certain files) has been added to the style guide.

benmss avatar Jul 21 '25 11:07 benmss