对修改后的每次提交运行pylint

时间:2019-10-04 19:19:09

标签: python git python-2.7 github pylint

我想为每个新提交运行pylint并在git中进行修改。我是一个初学者,对git不太了解。

以下是我的问题:

  1. 如何使用git和jenkins获取修改后的文件
  2. 如何对文件执行pylint。

1 个答案:

答案 0 :(得分:0)

  

我想从python文件运行pylint
  如何获得那里的文件列表?

使用GitPython,您可以轻松list files in a given commit

commit.stats.files

然后您可以使用该列表的元素来应用pylint

注意:要在不使用GitPython的情况下进行操作,请参阅“ Get a list of changed files between two commits or branches”:在<SHA1><SHA1>~1之间进行比较:您的提交,以及该提交的父级(第一祖先)。 / p>