Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run pylint in pre-commit system hook #7

Merged
merged 2 commits into from
Dec 13, 2018
Merged

Conversation

naeioi
Copy link
Member

@naeioi naeioi commented Dec 12, 2018

Pre-commit runs in an isolated environment. As a result, the built-in pylint can only do static check but not dynamic import check. This PR fixs this issue by calling pylint in a pre-commit "system hook" as suggested here.

@@ -7,6 +7,13 @@ repos:
language: script
entry: scripts/check_commit_message
stages: [commit-msg]
- id: pylint
name: pylint
entry: python -m pylint.__main__
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does simply pylint not work?

can you provide a link to the github issue which prompted this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe running pylint is guaranteed to work as long as it is correctly installed - it uses distutils in setup.py to setup system wide alias. So let's keep thing simple.

@codecov-io
Copy link

codecov-io commented Dec 12, 2018

Codecov Report

Merging #7 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master       #7   +/-   ##
=======================================
  Coverage   71.59%   71.59%           
=======================================
  Files          17       17           
  Lines         352      352           
=======================================
  Hits          252      252           
  Misses        100      100

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6d5e0c2...5594cb6. Read the comment docs.

@ryanjulian
Copy link
Member

I will force commit once this is rebased. please ping me.

`pylint` is available system wide as long as it is installed correctly
(via setup.py)
@naeioi
Copy link
Member Author

naeioi commented Dec 13, 2018

@ryanjulian rebased.

@ryanjulian
Copy link
Member

If I install akro[dev] in a virtualenv or conda env (pylint is in the akro[dev] dependencies), and my system does not otherwise have pylint, will this work correctly?

@naeioi
Copy link
Member Author

naeioi commented Dec 13, 2018

@ryanjulian It works if installed by pip. I will check for conda and virtualenv to make sure.

@ryanjulian
Copy link
Member

Okay, I think if it works if installed by pip then it should work in conda and virtualenv. That's the beauty of packages.

@naeioi
Copy link
Member Author

naeioi commented Dec 13, 2018

Confirmed that straight pylint works on both conda and virtualenv. They will create an local alias for package installed using distutils.

@ryanjulian ryanjulian merged commit e9ff539 into master Dec 13, 2018
@ryanjulian ryanjulian deleted the pre_commit-checks branch December 13, 2018 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants