Refactored snapin server_time to new snapin API
[check_mk.git] / .pylintrc
blob9aa44c067858de3ecbd2343c4eddba067728647f
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 this would be very desirable, using type() instead of
38     # isinstance() is a very bad idea most of the time, as it totally ignores
39     # class hierarchies, breaking things in subtle ways.
40     unidiomatic-typecheck,
41     #---------------------------------------------------------------------------
42     # This should really be fixed: Global variables are already a bad idea, but
43     # depending on an implicit protocol to create them is an even worse one.
44     global-variable-undefined,
45     #---------------------------------------------------------------------------
46     # Enabling these warnings would be nice, they are mostly a sign of sloppy
47     # programming practice. In some cases, they can even hide bugs.
48     bare-except,
49     broad-except,
50     #---------------------------------------------------------------------------
51     # Enabling this would enhance readability quite a bit and it might even
52     # uncover bugs. Fixing this is not rocket science, just some work.
53     inconsistent-return-statements,
54     #---------------------------------------------------------------------------
55     # Enabling this would enhance readability quite a bit and it might even
56     # uncover bugs. Fixing this is not rocket science, just some work: Roughly
57     # 400 warnings in about 60 modules, but this can be fixed step by step.
58     redefined-outer-name,
59     #---------------------------------------------------------------------------
60     # Enabling this would be nice, but not crucial. Nevertheless, this would
61     # improve readability and involve some cleanups in our class hierarchy, so
62     # we should do this some day.
63     protected-access,
64     #---------------------------------------------------------------------------
65     # Enabling this would be nice, but not crucial. At the moment, we have quite
66     # a few violations, so we postpone fixing this.
67     no-self-use,
68     #---------------------------------------------------------------------------
69     # Enabling this would be nice, but not crucial. At the moment, we have quite
70     # a few violations (about 220 in roughly 40 modules), so we postpone fixing
71     # this. Note that due to our arcane use of types, we need to be very careful
72     # when fixing these warnings!
73     len-as-condition,
74     #---------------------------------------------------------------------------
75     # Enabling this would be nice, but not crucial. At the moment, we have quite
76     # a few violations, so we postpone fixing this. When we do it eventually, we
77     # probably want to use "include-naming-hint=yes" in the BASIC section.
78     invalid-name,
79     #---------------------------------------------------------------------------
80     # Enable these would improve readability, but currently there are quite a
81     # few places to fix.
82     wrong-import-position,
83     wrong-import-order,
84     #---------------------------------------------------------------------------
85     # Enabling this would be nice, but not crucial. At the moment, we have quite
86     # a few violations, so we postpone fixing this.
87     singleton-comparison,
88     #---------------------------------------------------------------------------
89     # Enabling this would be nice, but not crucial. At the moment, we have quite
90     # a few violations, so we postpone fixing this.
91     unused-argument,
92     #---------------------------------------------------------------------------
93     # Alas, these maintenance/security nightmares are still part of our base
94     # "technology"... :-/ Nevertheless, reducing their usage is a very worthy
95     # goal.
96     eval-used,
97     exec-used,
98     global-statement,
99     #---------------------------------------------------------------------------
100     # Enabling these would be nice, but given the current state of affairs
101     # (gigantic modules with deeply nested humungous functions/methods), this
102     # will be a non-trivial amount of work.
103     too-few-public-methods,
104     too-many-arguments,
105     too-many-boolean-expressions,
106     too-many-instance-attributes,
107     too-many-lines,
108     too-many-locals,
109     too-many-nested-blocks,
110     too-many-public-methods,
111     too-many-return-statements,
112     too-many-statements,
113     #---------------------------------------------------------------------------
114     # Enabling these would be nice, but at the moment pylint is a bit too dumb,
115     # so it stumbles over e.g. initialization with None. It ignores control
116     # flow, so even adding e.g. isinstance() guards wouldn't help, see:
117     # https://github.com/PyCQA/pylint/issues/1498.
118     unsubscriptable-object,
119     unsupported-membership-test,
120     #---------------------------------------------------------------------------
121     # Our code is still full of FIXMEs/XXXs/TODOs, perhaps fixing or removing
122     # them might be a good idea some day...
123     fixme,
124     #---------------------------------------------------------------------------
125     # The warnigns below will probably fixed by YAPF.
126     bad-continuation,
127     bad-indentation,
128     bad-whitespace,
129     line-too-long,
130     #---------------------------------------------------------------------------
131     # We are light years away from enabling this...
132     missing-docstring,
133     #---------------------------------------------------------------------------
134     # Enabling the two spelling-related checks increases pylints runtime from
135     # 11 min to 40 min, so we better keep those disabled for normal runs.
136     wrong-spelling-in-comment,
137     wrong-spelling-in-docstring,
139 [REPORTS]
140 output-format=cmk_colorized
141 msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg}
143 [FORMAT]
144 max-line-length=100