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.

  • Will git revert overwrite my cherry pick commit?
  • Git - Android Studio no longer lets me commit changes and push to GitHub
  • Git Notifications on Pull/Submodule Update
  • Unable to unstage git committed file
  • Can't pull without saying which branch to rebase against
  • Git: Who has modified this line?
  • 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!

  • Why does git am leave modified files lying around? How can I adapt my workflow to do better?
  • Why does `git remote` not list anything on my git-svn repo?
  • Why does a learning exercise warn that git commit -am is insufficient to add my new .gitignore to the repository even though git clearly added it?
  • git submodule update is slow. How can I debug why it's slow?
  • What does git fsck stand for?
  • Bower “Git not in the PATH” error
  • 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.