@@ -7,40 +7,22 @@ Frequently Asked Questions
7
7
How do I install Pylint?
8
8
------------------------
9
9
10
- Everything should be explained in :ref: ` the installation guide < installation >`.
10
+ .. include :: short_text_installation.rst
11
11
12
12
How do I contribute to Pylint?
13
13
------------------------------
14
14
15
- Everything should be explained in :ref: ` the contribution guide < contribute_guide >`.
15
+ .. include :: short_text_contribute.rst
16
16
17
- Does Pylint follow a versioning scheme ?
17
+
18
+ Does Pylint follow a versioning scheme?
18
19
----------------------------------------
19
20
20
21
See :ref: `upgrading pylint in the installation guide <upgrading_pylint >`.
21
22
22
- Where is the persistent data stored to compare between successive runs ?
23
+ How do I find the name corresponding to a specific command line option ?
23
24
-----------------------------------------------------------------------
24
25
25
- Analysis data are stored as a pickle file in a directory which is
26
- localized using the following rules:
27
-
28
- * value of the PYLINTHOME environment variable if set
29
-
30
- * "pylint" subdirectory of the user's XDG_CACHE_HOME if the environment variable is set, otherwise
31
-
32
- - Linux: "~/.cache/pylint"
33
-
34
- - Mac OS X: "~/Library/Caches/pylint"
35
-
36
- - Windows: "C:\U sers\< username>\A ppData\L ocal\p ylint"
37
-
38
- * ".pylint.d" directory in the current directory
39
-
40
-
41
- How do I find the option name corresponding to a specific command line option?
42
- ------------------------------------------------------------------------------
43
-
44
26
You can generate a sample configuration file with ``--generate-toml-config ``.
45
27
Every option present on the command line before this will be included in
46
28
the toml file
@@ -52,94 +34,40 @@ For example::
52
34
How to disable a particular message?
53
35
------------------------------------
54
36
55
- For just a single line, add ``#pylint: disable=some-message,another-one `` at the end of
56
- the desired line of code. Since Pylint 2.10 you can also use ``#pylint: disable-next=... ``
57
- on the line just above the problem. ``... `` in the following example is short for the
58
- list of messages you want to disable.
59
-
60
- For larger amounts of code, you can add ``#pylint: disable=... `` at the block level
61
- to disable messages for the entire block. It's possible to re-enable a message for the
62
- remainder of the block with ``#pylint: enable=... ``. A block is either a scope (say a
63
- function, a module) or a multiline statement (try, finally, if statements, for loops).
64
- Note: It's currently impossible to `disable inside an else block `_.
65
-
66
37
Read :ref: `message-control ` for details and examples.
67
38
68
- .. _`disable inside an else block` : https://github.com/PyCQA/pylint/issues/872
69
-
70
- Is there a way to disable a message for a particular module only?
71
- -----------------------------------------------------------------
72
-
73
- Yes, you can disable or enable (globally disabled) messages at the
74
- module level by adding the corresponding option in a comment at the
75
- top of the file: ::
76
-
77
- # pylint: disable=wildcard-import, method-hidden
78
- # pylint: enable=too-many-lines
79
-
80
- How can I never check a given module?
81
- ----------------------------------------------------
39
+ Pylint gave my code a negative rating out of ten. That can't be right!
40
+ ----------------------------------------------------------------------
82
41
83
- Add ``#pylint: skip-file `` at the beginning of the module.
42
+ Prior to Pylint 2.13.0, the score formula used by default had no lower
43
+ bound. The new default score formula is ::
84
44
85
- In order to ease finding which modules are ignored an Information-level message
86
- `file-ignored ` is emitted.
45
+ max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10))
87
46
47
+ If your project contains a configuration file created by an earlier version of
48
+ Pylint, you can set ``evaluation `` to the above expression to get the new
49
+ behavior. Likewise, since negative values are still technically supported,
50
+ ``evaluation `` can be set to a version of the above expression that does not
51
+ enforce a floor of zero.
88
52
89
- How do I avoid getting unused argument warnings when I have no control over received arguments ?
90
- -----------------------------------------------------------------------------------------------
53
+ How do I avoid getting unused argument warnings for API I do not control?
54
+ -------------------------------------------------------------------------
91
55
92
- Prefix (ui) the callback's name by `cb_ `, as in cb_onclick(...). By
56
+ Prefix (ui) the callback's name by `cb_ ` (callback) , as in cb_onclick(...). By
93
57
doing so arguments usage won't be checked. Another solution is to
94
58
use one of the names defined in the "dummy-variables" configuration
95
59
variable for unused argument ("_" and "dummy" by default).
96
60
97
61
What is the format of the configuration file?
98
62
---------------------------------------------
99
63
100
- Pylint uses ConfigParser from the standard library to parse the configuration
101
- file. It means that if you need to disable a lot of messages, you can use
102
- any formatting accepted by ConfigParser, e.g.
103
-
104
- .. code-block :: ini
105
-
106
- [MAIN]
107
- output-format = colorized
108
-
109
- [Messages Control]
110
- disable =method-hidden,too-many-lines,wildcard-import
111
-
112
- .. code-block :: ini
113
-
114
- [Messages Control]
115
- disable =
116
- method-hidden
117
- too-many-lines
118
- wildcard-import
119
-
120
- Alternatively, if you use ``pyproject.toml ``, e.g.
121
-
122
- .. code-block :: toml
123
-
124
- [tool.pylint.main]
125
- output-format = "colorized"
126
-
127
- [tool.pylint.messages_control]
128
- disable = [
129
- "method-hidden",
130
- "too-many-lines",
131
- "wildcard-import",
132
- ]
133
-
134
- See also the :ref: `exhaustive list of possible options
135
- <all-configurations-options>`.
64
+ The configuration file can be an ``ini `` or ``toml `` file. See the :ref: `exhaustive list of possible options <all-options >`.
136
65
137
66
Why are there a bunch of messages disabled by default?
138
67
------------------------------------------------------
139
68
140
- pylint does have some messages disabled by default, either because
141
- they are prone to false positives or that they are opinionated enough
142
- for not being included as default messages.
69
+ Either because they are prone to false positives or that they are opinionated enough
70
+ to not be included as default messages.
143
71
144
72
You can see the plugin you need to explicitly :ref: `load in the technical reference
145
73
<user_guide/checkers/extensions:optional checkers>`.
@@ -157,9 +85,7 @@ pydocstyle_: missing-module-docstring, missing-class-docstring, missing-function
157
85
158
86
pep8-naming _: invalid-name, bad-classmethod-argument, bad-mcs-classmethod-argument, no-self-argument
159
87
160
- isort _: wrong-import-order
161
-
162
- flake8-import-order _: wrong-import-order
88
+ isort _ and flake8-import-order _: wrong-import-order
163
89
164
90
.. _`pycodestyle` : https://github.com/PyCQA/pycodestyle
165
91
.. _`pyflakes` : https://github.com/PyCQA/pyflakes
@@ -176,16 +102,15 @@ You should add the ``no-member`` message to your ``ignored-checks-for-mixins`` o
176
102
and name your mixin class with a name which ends with "Mixin" or "mixin" (default)
177
103
or change the default value by changing the ``mixin-class-rgx `` option.
178
104
179
- Pylint gave my code a negative rating out of ten. That can't be right!
180
- ----------------------------------------------------------------------
181
-
182
- Prior to Pylint 2.13.0, the score formula used by default had no lower
183
- bound. The new default score formula is ::
105
+ Where is the persistent data stored to compare between successive runs?
106
+ -----------------------------------------------------------------------
184
107
185
- max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10))
108
+ Analysis data are stored as a pickle file in a directory which is
109
+ localized using the following rules:
186
110
187
- If your project contains a configuration file created by an earlier version of
188
- Pylint, you can set ``evaluation `` to the above expression to get the new
189
- behavior. Likewise, since negative values are still technically supported,
190
- ``evaluation `` can be set to a version of the above expression that does not
191
- enforce a floor of zero.
111
+ * value of the PYLINTHOME environment variable if set
112
+ * "pylint" subdirectory of the user's XDG_CACHE_HOME if the environment variable is set, otherwise
113
+ - Linux: "~/.cache/pylint"
114
+ - macOS: "~/Library/Caches/pylint"
115
+ - Windows: "C:\U sers\< username>\A ppData\L ocal\p ylint"
116
+ * ".pylint.d" directory in the current directory
0 commit comments