Colin Watson has proposed merging ~cjwatson/launchpad:pre-commit into launchpad:master.
Commit message: Add pre-commit configuration Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/406048 By itself, this does nothing; but if developers install the git hook using `pre-commit install`, then it runs a small and fast suite of static analysis tools over changed files on every commit. We can easily add more such tools once they pass using `pre-commit run --all-files`. I'm hoping that this will help developers catch things early that we'd otherwise have to check for manually during code review. -- Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:pre-commit into launchpad:master.
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..e51afde --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,23 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.2.0 + hooks: + - id: check-added-large-files + - id: check-ast + - id: check-merge-conflict + - id: check-json + exclude: | + (?x)^( + lib/lp/services/sitesearch/tests/data/bingsearchservice-incomplete-response\.json + )$ + - id: check-xml + exclude: | + (?x)^( + lib/lp/bugs/tests/testfiles/broken_bug_li_item\.xml| + lib/lp/bugs/tests/testfiles/unescaped_control_character.xml + )$ + - id: check-yaml + - id: no-commit-to-branch + args: [--branch, master, --branch, db-devel] diff --git a/utilities/rocketfuel-setup b/utilities/rocketfuel-setup index 43d3807..0e003d5 100755 --- a/utilities/rocketfuel-setup +++ b/utilities/rocketfuel-setup @@ -348,5 +348,10 @@ development environment: dependencies, and make sure all source dependencies are properly linked in to all the branches you are working on. +Consider installing pre-commit (https://pre-commit.com/) as a git hook to +take advantage of some extra checks when committing: + + $ pre-commit install + Happy hacking! "
_______________________________________________ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : [email protected] Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp

