17

Is there already a way to integrate one of Python lint programs (PyLint, PyChecker, PyFlakes, etc.) with GitHub commit status API? In this way Python lint could be automatically called on pull requests to check the code and provide feedback and code (and style).

4
  • possible duplicate of Enforcing PEP-8'ish formatting in Github commits Commented Sep 16, 2012 at 20:14
  • Presumably, that's exactly the sort of thing it's for. Is that your question? Commented Sep 16, 2012 at 20:14
  • 3
    @MartijnPieters this is nothing to do with commit hooks. Commented Sep 16, 2012 at 20:14
  • So I understand that Python lint programs can in theory be integrated with GitHub commit status API. My questions is if there is already something like this available somewhere? Or as an existing cloud services or as an installation I can put on my server and it is called from GitHub. Commented Sep 16, 2012 at 22:30

2 Answers 2

8

You could use something like Travis-CI, and run pylint as part of your tests, along the lines of:

language: python
install: "pip install nose pylint"
script: "nosetests && pylint"

Of course that fails commits for minor stylistic violations - you'd probably want to disable certain messages, or use pylint --errors-only to make it less stringent

Sign up to request clarification or add additional context in comments.

4 Comments

Hm, there is ticket which says this is not yet supported? Probably there should be difference between error and warning here?
@Mitar yep - what's missing is any nice presentation of the pylint output (like "tests passed, but linter failed), or ability to store the HTML-report output along with the build. So it'd work, but rather crudely
@dbr the app in my answer purports to store the HTML report and provides a nice SVG badge for use as a README status image.
Travis might be too much for simple linting. As the suggested app is now way out of date, I suggest using a small golang app which features the new GitHub Checks API. But this must be self-hosted somewhere.
2

I had the same question, and just found this blog post describing a project called pylint-server for doing something similar (though triggered on Travis CI build events, not pulls).

From the README:

A small Flask app to keep keep track of pylint reports and ratings on a per-repository basis.

I haven't tried it yet, so I can't comment on its quality. If anyone tries it, please comment and let us know how you like it.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.