Shikhar
Shikhar

Reputation: 99

Run pylint for every commit on the modified changes

I want to run pylint for every new commit and amend in git. I am a beginner, don't know much about git.

Below are my questions:

  1. How to get the modified files using git and jenkins
  2. How to perform pylint on the files.

Upvotes: 1

Views: 1684

Answers (1)

VonC
VonC

Reputation: 1329642

I want to run pylint from a python file.
How can I get the list of files over there?

Using GitPython, you can easily list files in a given commit:

commit.stats.files

You can then apply pylint, using the elements of that list.

Note: to do it without using GitPython, see "Get a list of changed files between two commits or branches": compare between <SHA1> and <SHA1>~1: your commit, and the parent (first ancestor) of your commit.

Upvotes: 1

Related Questions