Running pylint against only changed lines/files with jenkins

At this time, I am using the violations plugin with Jenkins to generate a report of PEP8 violations. Since I am only beginning to use this check, there are an insane number of violations. So I’d like to start with only checking what changed in a pull request.

When a pull request is opened, I use the github pull request builder in order to test the pull request, and I’d also like to check the styling using pylint (or equivalent) as well.

  • Why is git revert telling me “bad revision” when I use a commit hash?
  • Github - Commit error after renaming package in android application: LibGit2Sharp.LockedFileException: The index is locked
  • Stress Testing with git
  • Git commit against tag with no branch
  • Setting a custom path for git private SSH key on linux
  • git pull currently tracked branch
  • I use this command in order to generate my current pylint report for jenkins

    pylint -f parseable ‘/var/lib/ci_server/workspace/pylint_check’ | tee pylint.out

    The above command will scan the entire project rather than just changes in the pull request.

    I’ve also tried using this:

    git diff-index —name-only HEAD | grep .py | xargs pylint -f pylint -f parseable | tee pylint.out

    ^ This command runs the build, but yields 0 violations on my pull request… It looks like that my pull requests show up in a detached HEAD sort of state (I assume git diff no longer works in this context?)

    The overall goal here is to scan for style violations within changes in a pull request using Jenkins… I’ve been pulling my hair over this for a couple days now. Any help would be super great, cheers!

  • Bundler keeps removing 'BUNDLED WITH' section of Gemfile.lock
  • What is the correct way to convert SVN remote branches and tags into local Git branches/tags during SVN to Git migration
  • Jenkins: Filter build history by label or parameter
  • Tell git that two users are equivalent after cvsimport
  • How to make `git log --stat — <path>` show *all* files in selected commits?
  • Simplify Git procedure
  • One Solution collect form web for “Running pylint against only changed lines/files with jenkins”

    Check out git-lint. It seems to do what you’re looking to accomplish.

    Git Baby is a git and github fan, let's start git clone.