【发布时间】:2019-07-15 08:56:05
【问题描述】:
我正在使用 Pylint,我是这个工具的新手,所以要计算我的 python 项目的质量(测试自动化)。我知道如果我想测试一个文件的质量,我必须执行以下命令(对于 Windows10):
pylint name_of_file.py
如果我想执行整个目录,我需要在上面的目录中创建一个名为__init__.py的python文件,然后执行这个命令:
pylint name_of_the_directory
另外,正如我上面提到的,我也使用 PyCharm。通过这个 IDE 的界面,Pylint 有一个名为Check Project 的按钮,它正在验证整个项目。请看一下这个界面的截图:
上述任何执行的输出将如下所示:
something.py:12:4: C0111: Missing method docstring (missing-docstring)
something.py:16:4: C0111: Missing method docstring (missing-docstring)
something.py:20:4: C0111: Missing method docstring (missing-docstring)
something.py:25:4: C0111: Missing method docstring (missing-docstring)
something.py:31:4: C0111: Missing method docstring (missing-docstring)
something.py:35:4: C0111: Missing method docstring (missing-docstring)
something.py:39:4: C0111: Missing method docstring (missing-docstring)
我需要什么:我希望每次新建后,将 Pylint 结果保存在 .txt 格式文件下的特定目录中,名称为当前时间戳,后跟当前的项目版本(存储在属性文件中)。对我来说(如果我没记错的话),这就像保留 Pylint 执行的日志输出。怎么会这样?
如果需要:
系统信息
- Python 版本:3.7
- 操作系统:Windows 10
- IDE:PyCharm 版本:2018.3.4
- 框架:BDD 行为
【问题讨论】:
-
您是否特别关心 Check Project 按钮,或者是否有其他方法可以运行 pylint 并保存结果?
-
“检查项目”只是使用 pylint 执行整个项目验证的另一种方式。我提到它是因为可能有人知道单击此按钮后将结果保存在哪里。我尽可能多地插入信息以提供帮助。
标签: python python-3.x testing automated-tests pylint