[libcamera-devel] [PATCH v4 0/6] Add the ability to do pre-commit style check

Nicolas Dufresne nicolas at ndufresne.ca
Sat Jan 18 21:00:09 CET 2020


From: Nicolas Dufresne <nicolas.dufresne at collabora.com>

This series adds the ability to do pre-commit style check. Internally, this adds
the ability to use checkstyle.py to check staged changes (--staged) and the
combined changes of the index and the last commit (--amend).

Changes in v4:
  - Patch 1 and 2 are unchanged
  - Unused top_level parameter removed from get_info() (patch 3 to 4)
  - revlist renamed to commits in main (patch 3)
  - Removed uneeded get_file() override by using empty string commit (patch 4)
  - Chain to StagedChanges constructor in Amendment class (patch 5)
  - Use "--no-patch" to reduce overhead of creating Amendment subject (patch 5)
  - Corrected the documentation in the pre-commit hook (patch 6)
  - Use tabs and minor style fix in pre-commit hook (patch 6)
  - Fixed all grammar mistake found by Laurent (all over)

Changes in v3:
  - Patch 1 is unchanged
  - Remove yet another mode change (patch 2)
  - The return statement has been improved (patch 2)
  - Static member 'commit' has been removed from Commit class (patch 3)
  - A comment clarifies the return value of Commit.get_info() (patch 3)
  - extract_revlist() has been renamed extract_commits() (patch 3)
  - Index class is now named StagedChanges (patch 4)
  - If statement to set the default revision_range has been improve (patch 4)
  - Typo Amandment.det_info() is fixed to get_info() (patch 5)
  - Description of --amend has been fixed (patch 5)
  - Fixed commit->args variable name (patch 6)

Changes in v2:
  - Fixed the checkstyle.py mode
  - Split into smaller patches
  - Only pass 0 or 1 to exit()
  - Replace boolean "staged" parameter with a Commit object
  - Subclass Commit to introduce special cases for Index and Amendment
  - Introduce a argument "--amend" to disambeguate the CLI 

Nicolas Dufresne (6):
  checkstyle: Move from pep8 to pycodestyle
  checkstyle: Exit with 1 status if issues are found
  checkstyle: Introduce a Commit class
  checkstyle: Add support for checking style on staged changes
  checkstyle: Add support for checking style on amendments
  checkstyle: Add a pre-commit hook script

 utils/checkstyle.py    | 118 +++++++++++++++++++++++++++++++++--------
 utils/hooks/pre-commit |  18 +++++++
 2 files changed, 113 insertions(+), 23 deletions(-)
 create mode 100755 utils/hooks/pre-commit

-- 
2.24.1



More information about the libcamera-devel mailing list