如何配置Pylint来检查PEP8检查的所有内容? [英] How can I configure Pylint to check all things PEP8 checks?

查看:92
本文介绍了如何配置Pylint来检查PEP8检查的所有内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

搜索以获取有关Pylint的答案邮件列表没有带来有趣的结果.

Pylint众所周知是非常可定制的,所以我想这应该是可能的...

我希望Pylint检查对PEP8的遵守情况是因为

  • 与PEP8相比,PyDev对Pylint的支持更好.
  • 使用一种工具进行所有检查要比使用两种工具容易.

我还在Pylint的邮件列表上的 http://thread上问了这个问题.gmane.org/gmane.comp.python.logilab/1039

PEP8发出的诊断消息的示例,但我不是从Pylint那里得到的:

  • '203'之前的E203空格
  • E225运算符周围缺少空格
  • E251关键字/参数之间的空格不等于
  • E301预期1空行,找到0
  • E303空白行太多
  • E501行太长(90个字符)
  • W291尾随空格
  • W292文件末尾没有换行符
  • W293空白行包含空格

解决方案

    Pylint AFAIK还不支持
  • E203
  • E225是C0322/C0323
  • E251应该是C0322/C0323,但是我不确定Pylint是否没有特殊情况参数,并且那里没有空格
  • E301,E303不支持AFAIK
  • E501是C0301,您可以在 pylintrc
  • 中配置长度
  • 不支持AFAIK W291,W292和W203.

如果您可以在所需的功能中在此处报告这些功能,那就太好了.

Searching for an answer on Pylint's mailing list brings no interesting results.

Pylint is known to be very customizable, so I guess this should be possible...

The reason I would like Pylint to check compliance with PEP8 is because

  • PyDev has much better support for Pylint than it has for PEP8.
  • It's easier to have one tool doing all checks than having to use two.

I also asked this question on Pylint's mailing list at http://thread.gmane.org/gmane.comp.python.logilab/1039

Example of diagnostic messages from PEP8 which I don't get from Pylint:

  • E203 whitespace before ':'
  • E225 missing whitespace around operator
  • E251 no spaces around keyword / parameter equals
  • E301 expected 1 blank line, found 0
  • E303 too many blank lines
  • E501 line too long (90 characters)
  • W291 trailing whitespace
  • W292 no newline at end of file
  • W293 blank line contains whitespace

解决方案

  • E203 is not yet supported in Pylint AFAIK
  • E225 is C0322 / C0323
  • E251 should be C0322/C0323, but I'm not sure that Pylint does not special case parameters and allows lack of space there
  • E301, E303 are not supported AFAIK
  • E501 is C0301 and you can configure the length in your pylintrc
  • W291, W292 and W203 are not supported AFAIK.

It would be nice if you could report these as desired features over here.

这篇关于如何配置Pylint来检查PEP8检查的所有内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆