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

2024-04-20 06:50:21 发布

您现在位置:Python中文网/ 问答频道 /正文

我想为git中的每个新提交和修改运行pylint。我是个初学者,对git不太了解。你知道吗

以下是我的问题:

  1. 如何使用git和jenkins获得修改过的文件
  2. 如何对文件执行pylint。你知道吗

Tags: 文件gitpylintjenkins初学者
1条回答
网友
1楼 · 发布于 2024-04-20 06:50:21

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

使用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:您的提交,以及提交的父级(第一个祖先)。你知道吗

相关问题 更多 >