Fix refactoring issue uncovered by mypy
[check_mk.git] / .pylintrc
blobd7e9c1a4d736587f4adb3ceed9ff44d37afd845e
1 [MASTER]
2 # Setup the Python paths needed for our tests. This is a bit tricky due to the
3 # fact that we want to be able to run pylint with and without the --rcfile
4 # option. Pylint offers pylint.config.PYLINTRC to get the path to the
5 # automatically found config file, but this doesn't take --rcfile into account.
6 # So we have to fall back to a slightly hacky method discussed in the post
7 # https://mail.python.org/pipermail/code-quality/2016-June/000781.html,
8 # accessing pylint's innards. Not nice, but there is not much we can do about
9 # this until pylint offers the API requested in the post above. Furthermore,
10 # note that layout/indentation doesn't work too well in the hook below.
11 init-hook=
12     import inspect, os, sys
13     config_file = inspect.stack()[2][0].f_locals["linter"].config_file
14     tests_dir = os.path.join(os.path.dirname(config_file), "tests")
15     sys.path.insert(0, os.environ.get("TEST_PATH", tests_dir))
16     import conftest
17 load-plugins=testlib.pylint_cmk,testlib.pylint_checker_localization
18 jobs=0
19 # TODO: Why do we need persistence?
20 persistent=yes
21 extension-pkg-whitelist=rrdtool,_ldap,netifaces,pymssql
23 [MESSAGES CONTROL]
24 disable=
25     #---------------------------------------------------------------------------
26     # We should really enable this, there could be some real exceptions waiting
27     # to be thrown. But some work is needed first to sprinkle abc annotations
28     # through our code and fix a few obscure places.
29     abstract-method,
30     #---------------------------------------------------------------------------
31     # Enabling this would be very desirable, it vastly improves readability and
32     # it might even be necessary for tools like mypy. Fixing this involves some
33     # amount of relatively easy work, especially if we want to avoid code
34     # duplication (introduce new classes, combine methods, etc.)
35     attribute-defined-outside-init,
36     #---------------------------------------------------------------------------
37     # Enabling these warnings would be nice, they are mostly a sign of sloppy
38     # programming practice. In some cases, they can even hide bugs.
39     bare-except,
40     broad-except,
41     #---------------------------------------------------------------------------
42     # Enabling this would enhance readability quite a bit and it might even
43     # uncover bugs. Fixing this is not rocket science, just some work.
44     inconsistent-return-statements,
45     #---------------------------------------------------------------------------
46     # Enabling this would be nice, but not crucial. Nevertheless, this would
47     # improve readability and involve some cleanups in our class hierarchy, so
48     # we should do this some day.
49     protected-access,
50     #---------------------------------------------------------------------------
51     # Enabling this would be nice, but not crucial. At the moment, we have quite
52     # a few violations, so we postpone fixing this.
53     no-self-use,
54     #---------------------------------------------------------------------------
55     # Enabling this would be nice, but not crucial. At the moment, we have quite
56     # a few violations (about 220 in roughly 40 modules), so we postpone fixing
57     # this. Note that due to our arcane use of types, we need to be very careful
58     # when fixing these warnings!
59     len-as-condition,
60     #---------------------------------------------------------------------------
61     # Enabling this would be nice, but not crucial. At the moment, we have quite
62     # a few violations, so we postpone fixing this. When we do it eventually, we
63     # probably want to use "include-naming-hint=yes" in the BASIC section.
64     invalid-name,
65     #---------------------------------------------------------------------------
66     # Enable these would improve readability, but currently there are quite a
67     # few places to fix.
68     wrong-import-position,
69     #---------------------------------------------------------------------------
70     # Enabling this would be nice, but not crucial. At the moment, we have quite
71     # a few violations, so we postpone fixing this.
72     unused-argument,
73     #---------------------------------------------------------------------------
74     # Alas, these maintenance/security nightmares are still part of our base
75     # "technology"... :-/ Nevertheless, reducing their usage is a very worthy
76     # goal.
77     eval-used,
78     exec-used,
79     global-statement,
80     #---------------------------------------------------------------------------
81     # Enabling these would be nice, but given the current state of affairs
82     # (gigantic modules with deeply nested humungous functions/methods), this
83     # will be a non-trivial amount of work.
84     too-few-public-methods,
85     too-many-arguments,
86     too-many-boolean-expressions,
87     too-many-instance-attributes,
88     too-many-lines,
89     too-many-locals,
90     too-many-nested-blocks,
91     too-many-public-methods,
92     too-many-return-statements,
93     too-many-statements,
94     #---------------------------------------------------------------------------
95     # Enabling these would be nice, but at the moment pylint is a bit too dumb,
96     # so it stumbles over e.g. initialization with None. It ignores control
97     # flow, so even adding e.g. isinstance() guards wouldn't help, see:
98     # https://github.com/PyCQA/pylint/issues/1498.
99     unsubscriptable-object,
100     unsupported-membership-test,
101     #---------------------------------------------------------------------------
102     # Our code is still full of FIXMEs/XXXs/TODOs, perhaps fixing or removing
103     # them might be a good idea some day...
104     fixme,
105     #---------------------------------------------------------------------------
106     # The warnigns below will probably fixed by YAPF.
107     bad-continuation,
108     bad-whitespace,
109     line-too-long,
110     #---------------------------------------------------------------------------
111     # We are light years away from enabling this...
112     missing-docstring,
113     #---------------------------------------------------------------------------
114     # Enabling the two spelling-related checks increases pylints runtime from
115     # 11 min to 40 min, so we better keep those disabled for normal runs.
116     wrong-spelling-in-comment,
117     wrong-spelling-in-docstring,
119 [REPORTS]
120 output-format=cmk_colorized
121 msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg}
123 [FORMAT]
124 max-line-length=100