kubernetes-ingress icon indicating copy to clipboard operation
kubernetes-ingress copied to clipboard

Add pre-commit configuration

Open lucacome opened this issue 4 years ago • 1 comments

Adding configuration for https://pre-commit.com/ with this we can have checks that run automatically before committing and (in most cases) fix the problems.

Here the quick start for installing it, basically: brew install pre-commit followed by pre-commit install. After that, it will run before every commit.

I've added some hooks in the config (there are many more):

  • golang-ci lint, which we're already using, will just run it automatically
  • codespell, will check for spelling mistakes in all files (not just go like golang-ci lint)
  • pyupgrade, will update python syntax to use the latest from the language
  • isort, will sort python imports
  • pre-commit-hooks, has a few hooks, mostly about formatting (and end of line whitespaces and similar), and not committing large files or with merge conflicts or scripts that are not executables.

There's an option to run it as a check in GitHub so external contributors don't need to install it, but the checks will still be enforced. (https://pre-commit.ci/)

Let me know what you think.

lucacome avatar Nov 03 '21 19:11 lucacome

Codecov Report

Merging #2154 (aca6f3e) into main (d9fe6a2) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #2154   +/-   ##
=======================================
  Coverage   52.52%   52.52%           
=======================================
  Files          58       58           
  Lines       16070    16070           
=======================================
  Hits         8441     8441           
  Misses       7351     7351           
  Partials      278      278           

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov-commenter avatar Jan 11 '22 21:01 codecov-commenter