Skip to content

Commit 8393f3f

Browse files
Cleanup the FAQ from oudated or duplicated content (#6726)
Co-authored-by: Jacob Walls <[email protected]>
1 parent 508e84c commit 8393f3f

File tree

7 files changed

+54
-110
lines changed

7 files changed

+54
-110
lines changed

README.rst

+12-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
.. _`Pylint`: https://pylint.pycqa.org/
55

6+
.. This is used inside the doc to recover the start of the introduction
7+
68
.. image:: https://github.com/PyCQA/pylint/actions/workflows/tests.yaml/badge.svg?branch=main
79
:target: https://github.com/PyCQA/pylint/actions
810

@@ -85,9 +87,13 @@ pydocstringformatter_ (automated pep257).
8587
.. _pydocstringformatter: https://github.com/DanielNoord/pydocstringformatter
8688
.. _isort: https://pycqa.github.io/isort/
8789

90+
.. This is used inside the doc to recover the end of the introduction
91+
8892
Install
8993
-------
9094

95+
.. This is used inside the doc to recover the start of the short text for installation
96+
9197
For command line use, pylint is installed with::
9298

9399
pip install pylint
@@ -97,9 +103,13 @@ It can also be integrated in most editors or IDEs. More information can be found
97103

98104
.. _in the documentation: https://pylint.pycqa.org/en/latest/user_guide/installation/index.html
99105

106+
.. This is used inside the doc to recover the end of the short text for installation
107+
100108
Contributing
101109
------------
102110

111+
.. This is used inside the doc to recover the start of the short text for contribution
112+
103113
We welcome all forms of contributions such as updates for documentation, new code, checking issues for duplicates or telling us
104114
that we can close them, confirming that issues still exist, `creating issues because
105115
you found a bug or want a feature`_, etc. Everything is much appreciated!
@@ -108,9 +118,10 @@ Please follow the `code of conduct`_ and check `the Contributor Guides`_ if you
108118
make a code contribution.
109119

110120
.. _creating issues because you found a bug or want a feature: https://pylint.pycqa.org/en/latest/contact.html#bug-reports-feedback
111-
.. _code of conduct: https://github.com/Pierre-Sassoulas/pylint/blob/main/CODE_OF_CONDUCT.md
121+
.. _code of conduct: https://github.com/PyCQA/pylint/blob/main/CODE_OF_CONDUCT.md
112122
.. _the Contributor Guides: https://pylint.pycqa.org/en/latest/development_guide/contribute.html
113123

124+
.. This is used inside the doc to recover the end of the short text for contribution
114125
115126
Show your usage
116127
-----------------

doc/exts/pylint_options.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ def _write_options_page(options: OptionsDataDict, linter: PyLinter) -> None:
136136
"""Create or overwrite the options page."""
137137
sections: list[str] = [
138138
".. This file is auto-generated. Make any changes to the associated\n"
139-
".. docs extension in 'doc/exts/pylint_options.py'.",
139+
".. docs extension in 'doc/exts/pylint_options.py'.\n\n"
140+
".. _all-options:",
140141
get_rst_title("Standard Checkers:", "^"),
141142
]
142143
found_extensions = False

doc/faq.rst

+32-107
Original file line numberDiff line numberDiff line change
@@ -7,40 +7,22 @@ Frequently Asked Questions
77
How do I install Pylint?
88
------------------------
99

10-
Everything should be explained in :ref:`the installation guide <installation>`.
10+
.. include:: short_text_installation.rst
1111

1212
How do I contribute to Pylint?
1313
------------------------------
1414

15-
Everything should be explained in :ref:`the contribution guide <contribute_guide>`.
15+
.. include:: short_text_contribute.rst
1616

17-
Does Pylint follow a versioning scheme ?
17+
18+
Does Pylint follow a versioning scheme?
1819
----------------------------------------
1920

2021
See :ref:`upgrading pylint in the installation guide <upgrading_pylint>`.
2122

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?
2324
-----------------------------------------------------------------------
2425

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:\Users\<username>\AppData\Local\pylint"
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-
4426
You can generate a sample configuration file with ``--generate-toml-config``.
4527
Every option present on the command line before this will be included in
4628
the toml file
@@ -52,94 +34,40 @@ For example::
5234
How to disable a particular message?
5335
------------------------------------
5436

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-
6637
Read :ref:`message-control` for details and examples.
6738

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+
----------------------------------------------------------------------
8241

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 ::
8444

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))
8746

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.
8852

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+
-------------------------------------------------------------------------
9155

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
9357
doing so arguments usage won't be checked. Another solution is to
9458
use one of the names defined in the "dummy-variables" configuration
9559
variable for unused argument ("_" and "dummy" by default).
9660

9761
What is the format of the configuration file?
9862
---------------------------------------------
9963

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>`.
13665

13766
Why are there a bunch of messages disabled by default?
13867
------------------------------------------------------
13968

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.
14371

14472
You can see the plugin you need to explicitly :ref:`load in the technical reference
14573
<user_guide/checkers/extensions:optional checkers>`.
@@ -157,9 +85,7 @@ pydocstyle_: missing-module-docstring, missing-class-docstring, missing-function
15785

15886
pep8-naming_: invalid-name, bad-classmethod-argument, bad-mcs-classmethod-argument, no-self-argument
15987

160-
isort_: wrong-import-order
161-
162-
flake8-import-order_: wrong-import-order
88+
isort_ and flake8-import-order_: wrong-import-order
16389

16490
.. _`pycodestyle`: https://github.com/PyCQA/pycodestyle
16591
.. _`pyflakes`: https://github.com/PyCQA/pyflakes
@@ -176,16 +102,15 @@ You should add the ``no-member`` message to your ``ignored-checks-for-mixins`` o
176102
and name your mixin class with a name which ends with "Mixin" or "mixin" (default)
177103
or change the default value by changing the ``mixin-class-rgx`` option.
178104

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+
-----------------------------------------------------------------------
184107

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:
186110

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:\Users\<username>\AppData\Local\pylint"
116+
* ".pylint.d" directory in the current directory

doc/index.rst

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
.. include:: ../README.rst
32

43
.. toctree::

doc/short_text_contribute.rst

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.. include:: ../README.rst
2+
:start-after: This is used inside the doc to recover the start of the short text for contribution
3+
:end-before: This is used inside the doc to recover the end of the short text for contribution

doc/short_text_installation.rst

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.. include:: ../README.rst
2+
:start-after: This is used inside the doc to recover the start of the short text for installation
3+
:end-before: This is used inside the doc to recover the end of the short text for installation

doc/user_guide/configuration/all-options.rst

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
.. This file is auto-generated. Make any changes to the associated
44
.. docs extension in 'doc/exts/pylint_options.py'.
55
6+
.. _all-options:
7+
68
Standard Checkers:
79
^^^^^^^^^^^^^^^^^^
810

0 commit comments

Comments
 (0)