PyLint bad-whitespace配置

时间:2017-02-13 06:43:26

标签: python pylint pylintrc

有没有办法在PyLint中配置componentWillReceiveProps(nextProps) { console.log("Main content"); console.log(nextProps.contents); } 检查的检查?我现在可以禁用检查,但我宁愿强制执行空白约定而不是禁用它。

3 个答案:

答案 0 :(得分:1)

您可以使用两个选项:

  1. 全局禁用坏空白警告:

    split_text = soup.get_text().split('\n')
    # The next index from Budget is cost
    split_text[split_text.index('Budget')+1]
    
  2. 使用Pylint配置文件:

    pylint --disable=C0326
    

    这是你要在配置文件中放入禁用坏空白警告的内容:

    pylint --rcfile=/path/to/config.file
    

答案 1 :(得分:1)

.pylintrc文件确实使用属性no-space-check提供对空白规则的有限编辑:

# List of optional constructs for which whitespace checking is disabled. `dict-
# separator` is used to allow tabulation in dicts, etc.: {1  : 1,\n222: 2}.
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
# `empty-line` allows space-only lines.
no-space-check=

不过,在不久的将来可能会有更多的选择。

答案 2 :(得分:0)

从pylint 1.1.0起,bad-whitespace约定检查的ID为C0326。您可以在 .pylintrc 配置文件中使用此代码来启用/禁用bad-whitespace检查。

[MESSAGES CONTROL]
enable=C0326

[MESSAGES CONTROL]
disable=C0326