Page MenuHomeSoftware Heritage

Add a pre-commit-hooks.yaml config file
ClosedPublic

Authored by douardda on Nov 20 2019, 11:50 AM.

Diff Detail

Repository
rDSTO Storage manager
Branch
mypy
Lint
Lint Skipped
Unit
Unit Tests Skipped
Build Status
Buildable 9209
Build 13477: tox-on-jenkinsJenkins
Build 13476: arc lint + arc unit

Event Timeline

run mypy on the whole swh/ directory

Include fixes reported by pre-commit hooks in this diff

  • fix trailing ws reported by pre-commit
  • pre-commit: explicitely whitelist 'iff' when running codespell
  • Fix a few typos reported by codespell

For the mypy check, instead of listing the needed dependencies in one more file, and instead of depending on an external hook repository, we could run it as a system hook (which will run in your own dev venv) instead of a python hook (which runs in an isolated venv).

In D2312#54360, @olasd wrote:

For the mypy check, instead of listing the needed dependencies in one more file, and instead of depending on an external hook repository, we could run it as a system hook (which will run in your own dev venv) instead of a python hook (which runs in an isolated venv).

Ah, I understand why the comment I submitted yesterday got lost: it's in another diff! :)

rewrite the mypy hook as a language:system one

remove useless mypy.ini entry

since we do not run mypy on setup.py

cool, runs fine on my side:

$ workon swh
$ cd swh-storage
$ arc patch D2312
$ pre-commit run --all-files
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Initializing environment for https://github.com/codespell-project/codespell.
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/codespell-project/codespell.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
Trim Trailing Whitespace.................................................Passed
Flake8...................................................................Passed
Check JSON...............................................................Passed
Check Yaml...............................................................Passed
codespell................................................................Passed
mypy.....................................................................Passed
This revision is now accepted and ready to land.Nov 21 2019, 1:25 PM