如何禁用Pylint警告?

发布于 2021-01-29 15:00:07

我正在尝试在Pylint 0.21.1中禁用警告C0321(“在一行上有多个语句”
–我经常将if带有短单行结果的语句放在同一行上)(如果重要:astng 0.20)。 1,常见的0.50.3,Python
2.6.6(r266:84292,2010年9月15日,16:22:56))。

我尝试添加disable=C0321Pylint配置文件,但是Pylint坚持要报告它。该行的变体(如disable=0321disable=C321)被标记为错误,因此Pylint
确实 正确识别了该选项,只是忽略了它。

这是Pylint的错误,还是我做错了什么?有没有办法解决?我真的很想摆脱这种噪音。

关注者
0
被浏览
122
1 个回答
  • 面试哥
    面试哥 2021-01-29
    为面试而生,有面试问题,就找面试哥。

    pylint --generate-rcfile 显示如下:

    [MESSAGES CONTROL]
    
    # Enable the message, report, category or checker with the given id(s). You can
    # either give multiple identifier separated by comma (,) or put this option
    # multiple time.
    #enable=
    
    # Disable the message, report, category or checker with the given id(s). You
    # can either give multiple identifier separated by comma (,) or put this option
    # multiple time (only on the command line, not in the configuration file where
    # it should appear only once).
    #disable=
    

    因此,看起来您~/.pylintrc应该disable=在section中有一行[MESSAGES CONTROL]



知识点
面圈网VIP题库

面圈网VIP题库全新上线,海量真题题库资源。 90大类考试,超10万份考试真题开放下载啦

去下载看看