Ответ 1
Используйте параметр -d
/--disable
, чтобы отключить классы сообщений "C" и "R" (соглашение и рефакторинг):
-d <msg ids>, --disable=<msg ids>
Disable the message, report, category or checker with
the given id(s). You can either give multiple
identifiers separated by comma (,) or put this option
multiple times (only on the command line, not in the
configuration file where it should appear only
once).You can also use "--disable=all" to disable
everything first and then reenable specific checks.
For example, if you want to run only the similarities
checker, you can use "--disable=all
--enable=similarities". If you want to run only the
classes checker, but have no Warning level messages
displayed, use"--disable=all --enable=classes
--disable=W"
Без опции disable
(6 соглашений, 1 рефакторинг, 2 предупреждения, 1 ошибка):
$ pylint x.py
C: 1, 0: Missing module docstring (missing-docstring)
C: 3, 0: Missing function docstring (missing-docstring)
R: 3, 0: Too many statements (775/50) (too-many-statements)
W:780,15: Redefining name 'path' from outer scope (line 796) (redefined-outer-name)
C:780, 0: Invalid function name "getSection" (invalid-name)
C:780, 0: Empty function docstring (empty-docstring)
C:782,23: Invalid variable name "inPath" (invalid-name)
W:785, 4: Statement seems to have no effect (pointless-statement)
E:785, 4: Undefined variable 'something' (undefined-variable)
C:796, 4: Invalid constant name "path" (invalid-name)
После использования опции disable
(0 соглашение, 0 рефакторинг, 2 предупреждения, 1 ошибка):
$ pylint --disable=R,C x.py
W:780,15: Redefining name 'path' from outer scope (line 796) (redefined-outer-name)
W:785, 4: Statement seems to have no effect (pointless-statement)
E:785, 4: Undefined variable 'something' (undefined-variable)
Чтобы установить этот параметр в pylintrc
:
disable=R,C