freeipa/pylintrc

157 lines
4.9 KiB
INI
Raw Normal View History

[MASTER]
# Pickle collected data for later comparisons.
persistent=no
# List of plugins (as comma separated values of python modules names) to load,
# usually to register additional checkers.
# FIXME: has to be specified on the command line otherwise pylint fails with
# DuplicateSectionError for the IPA section
#load-plugins=pylint_plugins
# A list of packages with safe C extensions to load
extension-pkg-allow-list=
_ldap,
cryptography,
gssapi,
lxml.etree,
pysss_murmur,
Disable Pylint 2.0 violations Globally disabling the following violations: - `assignment-from-no-return` (E1111): Assigning to function call which doesn't return. Used when an assignment is done on a function call but the inferred function doesn't return anything. - `keyword-arg-before-vararg` (W1113): Keyword argument before variable positional arguments list in the definition of %s function When defining a keyword argument before variable positional arguments, one can end up in having multiple values passed for the aforementioned parameter in case the method is called with keyword arguments. Locally disabling the following: - `subprocess-popen-preexec-fn` (W1509): Using preexec_fn keyword which may be unsafe in the presence of threads The preexec_fn parameter is not safe to use in the presence of threads in your application. The child process could deadlock before exec is called. If you must use it, keep it trivial! Minimize the number of libraries you call into. https://docs.python.org/3/library/subprocess.html#popen-constructor Fixed violations: - `bad-mcs-classmethod-argument` (C0204): Metaclass class method %s should have %s as first argument Used when a metaclass class method has a first argument named differently than the value specified in valid-metaclass-classmethod-first-arg option (default to "mcs"), recommended to easily differentiate them from regular instance methods. - Note: Actually `cls` is the default first arg for `__new__`. - `consider-using-get` (R1715): Consider using dict.get for getting values from a dict if a key is present or a default if not Using the builtin dict.get for getting a value from a dictionary if a key is present or a default if not, is simpler and considered more idiomatic, although sometimes a bit slower Issue: https://pagure.io/freeipa/issue/7614 Signed-off-by: Armando Neto <abiagion@redhat.com> Reviewed-By: Christian Heimes <cheimes@redhat.com>
2018-07-12 15:20:59 -05:00
[CLASSES]
# List of valid names for the first argument in a metaclass class method.
# This can be removed after upgrading to pylint 2.0
valid-metaclass-classmethod-first-arg=cls
[MESSAGES CONTROL]
enable=
all,
python3,
useless-suppression,
disable=
bad-inline-option,
c-extension-no-member,
deprecated-pragma,
file-ignored,
locally-disabled,
raw-checker-failed,
suppressed-message,
use-symbolic-message-instead,
duplicate-code,
interface-not-implemented,
no-self-use,
redefined-variable-type,
too-few-public-methods,
too-many-ancestors,
too-many-arguments,
too-many-boolean-expressions,
too-many-branches,
too-many-instance-attributes,
too-many-locals,
too-many-nested-blocks,
too-many-public-methods,
too-many-return-statements,
too-many-statements,
abstract-method,
anomalous-backslash-in-string,
arguments-differ,
attribute-defined-outside-init,
bad-builtin,
bad-indentation,
broad-except,
dangerous-default-value,
eval-used,
exec-used,
fixme,
global-statement,
no-init,
pointless-string-statement,
protected-access,
redefined-builtin,
redefined-outer-name,
super-init-not-called,
undefined-loop-variable,
unnecessary-lambda,
unused-argument,
useless-else-on-loop,
bad-continuation,
bad-whitespace,
blacklisted-name,
invalid-name,
line-too-long,
missing-docstring,
multiple-statements,
superfluous-parens,
too-many-lines,
unidiomatic-typecheck,
no-absolute-import,
wrong-import-order,
ungrouped-imports,
wrong-import-position,
unsubscriptable-object,
unsupported-membership-test,
not-an-iterable,
singleton-comparison,
misplaced-comparison-constant,
not-a-mapping,
singleton-comparison,
len-as-condition, # new in pylint 1.7
no-else-return, # new in pylint 1.7
single-string-used-for-slots, # new in pylint 1.7
useless-super-delegation, # new in pylint 1.7
redefined-argument-from-local, # new in pylint 1.7
consider-merging-isinstance, # new in pylint 1.7
Fix Pylint 2.0 violations Fix the following violations aiming to support Pylint 2.0 - `unneeded-not` (C0113): Consider changing "not item in items" to "item not in items" used when a boolean expression contains an unneeded negation. - `useless-import-alias` (C0414): Import alias does not rename original package Used when an import alias is same as original package.e.g using import numpy as numpy instead of import numpy as np - `raising-format-tuple` (W0715): Exception arguments suggest string formatting might be intended Used when passing multiple arguments to an exception constructor, the first of them a string literal containing what appears to be placeholders intended for formatting - `bad-continuation` (C0330): This was already included on the disable list, although with current version of pylint (2.0.0.dev2) violations at the end of the files are not being ignored. See: https://github.com/PyCQA/pylint/issues/2278 - `try-except-raise` (E0705): The except handler raises immediately Used when an except handler uses raise as its first or only operator. This is useless because it raises back the exception immediately. Remove the raise operator or the entire try-except-raise block! - `consider-using-set-comprehension` (R1718): Consider using a set comprehension Although there is nothing syntactically wrong with this code, it is hard to read and can be simplified to a set comprehension.Also it is faster since you don't need to create another transient list - `dict-keys-not-iterating` (W1655): dict.keys referenced when not iterating Used when dict.keys is referenced in a non-iterating context (returns an iterator in Python 3) - `comprehension-escape` (W1662): Using a variable that was bound inside a comprehension Emitted when using a variable, that was bound in a comprehension handler, outside of the comprehension itself. On Python 3 these variables will be deleted outside of the comprehension. Issue: https://pagure.io/freeipa/issue/7614 Signed-off-by: Armando Neto <abiagion@redhat.com> Reviewed-By: Christian Heimes <cheimes@redhat.com>
2018-07-12 09:21:34 -05:00
bad-option-value, # required to support upgrade to pylint 2.0
Disable Pylint 2.0 violations Globally disabling the following violations: - `assignment-from-no-return` (E1111): Assigning to function call which doesn't return. Used when an assignment is done on a function call but the inferred function doesn't return anything. - `keyword-arg-before-vararg` (W1113): Keyword argument before variable positional arguments list in the definition of %s function When defining a keyword argument before variable positional arguments, one can end up in having multiple values passed for the aforementioned parameter in case the method is called with keyword arguments. Locally disabling the following: - `subprocess-popen-preexec-fn` (W1509): Using preexec_fn keyword which may be unsafe in the presence of threads The preexec_fn parameter is not safe to use in the presence of threads in your application. The child process could deadlock before exec is called. If you must use it, keep it trivial! Minimize the number of libraries you call into. https://docs.python.org/3/library/subprocess.html#popen-constructor Fixed violations: - `bad-mcs-classmethod-argument` (C0204): Metaclass class method %s should have %s as first argument Used when a metaclass class method has a first argument named differently than the value specified in valid-metaclass-classmethod-first-arg option (default to "mcs"), recommended to easily differentiate them from regular instance methods. - Note: Actually `cls` is the default first arg for `__new__`. - `consider-using-get` (R1715): Consider using dict.get for getting values from a dict if a key is present or a default if not Using the builtin dict.get for getting a value from a dictionary if a key is present or a default if not, is simpler and considered more idiomatic, although sometimes a bit slower Issue: https://pagure.io/freeipa/issue/7614 Signed-off-by: Armando Neto <abiagion@redhat.com> Reviewed-By: Christian Heimes <cheimes@redhat.com>
2018-07-12 15:20:59 -05:00
assignment-from-no-return, # new in pylint 2.0
keyword-arg-before-vararg, # pylint 2.0, remove after dropping Python 2
consider-using-enumerate, # pylint 2.1, clean up tests later
no-else-raise, # python 2.4.0
import-outside-toplevel, # pylint 2.4.2
f-string-without-interpolation, # pylint 2.5.0, bare f-strings are ok
super-with-arguments, # pylint 2.6.0, zero-length form is syntactic sugar
raise-missing-from, # pylint 2.6.0, implicit exception chaining is ok
consider-using-with, # pylint 2.8.0, contextmanager is not mandatory
consider-using-max-builtin, # pylint 2.8.0, can be more readable
consider-using-min-builtin, # pylint 2.8.0, can be more readable
redundant-u-string-prefix, # pylint 2.10.0, too many unessential changes
consider-using-f-string, # pylint 2.11.0, format can be more readable
use-dict-literal, # pylint 2.10.0 dict vs {}
use-list-literal, # pylint 2.10.0 list() vs []
unspecified-encoding, # pylint 2.10.0, ASCII or UTF8 and platform-specific
use-implicit-booleaness-not-comparison, # pylint 2.12.2, weak comparison
use-implicit-booleaness-not-comparison-to-string,
use-implicit-booleaness-not-comparison-to-zero,
broad-exception-raised,
[REPORTS]
# Set the output format. Available formats are text, parseable, colorized, msvs
# (visual studio) and html. You can also give a reporter class, eg
# mypackage.mymodule.MyReporterClass.
output-format=colorized
# Tells whether to display a full report or only the messages
reports=no
# Template used to display messages. This is a python new-style format string
# used to format the message information. See doc for all details
msg-template='{path}:{line}: [{msg_id}({symbol}), {obj}] {msg})'
[VARIABLES]
dummy-variables-rgx=(_.+|unused)
[IPA]
forbidden-imports=
client/:ipaserver,
ipaclient/:ipaclient.install:ipalib.install:ipaserver,
ipaclient/install/:ipaserver,
ipalib/:ipaclient.install:ipalib.install:ipaserver,
ipalib/install/:ipaserver,
ipaplatform/:ipaclient:ipalib:ipaserver,
ipapython/:ipaclient:ipalib:ipaserver
ipatests/pytest_ipa:ipaserver:ipaclient.install:ipalib.install
ipatests/test_integration:ipaserver