将Pylint消息保存到文件中

13

是否有一种内置的方法可以将pylint报告保存到文件中?似乎这样做很有用,可以记录项目进展并在多个文件之间比较报告的元素随着更改的进行。

2个回答

12
注意:这个选项已经过时了,在 Pylint 2.0 中将被移除。

你可以使用命令行选项 --file-output=y。引用手册页面的描述:

   --files-output=<y_or_n>
          Put messages in a separate file for each module / package speci‐
          fied  on  the  command  line instead of printing them on stdout.
          Reports  (if   any)   will   be   written   in   a   file   name
          "pylint_global.[txt|html]". [current: no]

输出格式由 --output-format=<format> 选项指定,其中 format 可以是 textparseablecolorizedmsvs(visual studio)和 html


12

您可以使用 > somefile.txt 将其输出重定向到您的shell环境中。
如果它将内容写入了 stderr,则可以使用2>&1 > somefile.txt


我能同时将输出写入文件和标准输出吗?我只是在我的构建机器上运行命令两次... - Dan Ciborowski - MSFT
3
将其通过管道传输到tee somefile中,它将写入到somefile文件并同时打印到标准输出。 - ThiefMaster

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接