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
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

douardda created this revision.Nov 20 2019, 11:50 AM
douardda updated this revision to Diff 7958.Nov 20 2019, 12:28 PM

run mypy on the whole swh/ directory

douardda updated this revision to Diff 7959.Nov 20 2019, 12:31 PM

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
olasd added a subscriber: olasd.Nov 20 2019, 1:49 PM

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).

olasd added a comment.Nov 20 2019, 2:02 PM
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! :)

douardda updated this revision to Diff 7976.Nov 21 2019, 11:15 AM

rewrite the mypy hook as a language:system one

douardda updated this revision to Diff 7985.Nov 21 2019, 11:24 AM

fix mypy.ini and rebase

douardda updated this revision to Diff 7993.Nov 21 2019, 1:19 PM

remove useless mypy.ini entry

since we do not run mypy on setup.py

ardumont added a subscriber: ardumont.EditedNov 21 2019, 1:24 PM

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
vlorentz accepted this revision.Nov 21 2019, 1:25 PM
This revision is now accepted and ready to land.Nov 21 2019, 1:25 PM
ardumont accepted this revision.Nov 21 2019, 1:26 PM