[libcamera-devel,v3,0/6] Add the ability to do pre-commit style check
mbox series

Message ID 20200118035448.230530-1-nicolas@ndufresne.ca
Headers show
Series
  • Add the ability to do pre-commit style check
Related show

Message

Nicolas Dufresne Jan. 18, 2020, 3:54 a.m. UTC
From: Nicolas Dufresne <nicolas.dufresne@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 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    | 120 +++++++++++++++++++++++++++++++++--------
 utils/hooks/pre-commit |  17 ++++++
 2 files changed, 115 insertions(+), 22 deletions(-)
 create mode 100755 utils/hooks/pre-commit

Comments

Laurent Pinchart Jan. 18, 2020, 7:23 p.m. UTC | #1
Hi Nicolas,

On Fri, Jan 17, 2020 at 10:54:42PM -0500, Nicolas Dufresne wrote:
> From: Nicolas Dufresne <nicolas.dufresne@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).

I've reviewed the whole series. There's only small issues to be fixed,
so if you're fine with the comments, I'll fix when applying. Please let
me know if there's an issue you disagree about, or would prefer handling
yourself.

> 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    | 120 +++++++++++++++++++++++++++++++++--------
>  utils/hooks/pre-commit |  17 ++++++
>  2 files changed, 115 insertions(+), 22 deletions(-)
>  create mode 100755 utils/hooks/pre-commit