Skip to content

Commit

Permalink
run tox -e docs
Browse files Browse the repository at this point in the history
  • Loading branch information
clavedeluna committed Nov 4, 2022
1 parent a974b53 commit 5407c2d
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 11 deletions.
1 change: 1 addition & 0 deletions doc/data/messages/m/magic-value-comparison/details.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ !
1 change: 1 addition & 0 deletions doc/data/messages/m/magic-value-comparison/good.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# This is a placeholder for correct code for this message.
1 change: 1 addition & 0 deletions doc/data/messages/s/syntax-error/details.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ !
1 change: 1 addition & 0 deletions doc/data/messages/s/syntax-error/good.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# This is a placeholder for correct code for this message.
39 changes: 39 additions & 0 deletions doc/user_guide/checkers/extensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ Pylint provides the following optional plugins:
- :ref:`pylint.extensions.consider_ternary_expression`
- :ref:`pylint.extensions.docparams`
- :ref:`pylint.extensions.docstyle`
- :ref:`pylint.extensions.dunder`
- :ref:`pylint.extensions.empty_comment`
- :ref:`pylint.extensions.emptystring`
- :ref:`pylint.extensions.eq_without_hash`
- :ref:`pylint.extensions.for_any_all`
- :ref:`pylint.extensions.magic_value`
- :ref:`pylint.extensions.mccabe`
- :ref:`pylint.extensions.no_self_use`
- :ref:`pylint.extensions.overlapping_exceptions`
Expand Down Expand Up @@ -79,6 +81,9 @@ Code Style checker Messages
Emitted when an if assignment is directly followed by an if statement and
both can be combined by using an assignment expression ``:=``. Requires
Python 3.8 and ``py-version >= 3.8``.
:consider-using-augmented-assign (R6104): *Use '%s' to do an augmented assign directly*
Emitted when an assignment is referring to the object that it is assigning
to. This can be changed to be an augmented assign. Disabled by default!


.. _pylint.extensions.emptystring:
Expand Down Expand Up @@ -275,6 +280,23 @@ Docstyle checker Messages
Used when a blank line is found at the beginning of a docstring.


.. _pylint.extensions.dunder:

Dunder checker
~~~~~~~~~~~~~~

This checker is provided by ``pylint.extensions.dunder``.
Verbatim name of the checker is ``dunder``.

See also :ref:`dunder checker's options' documentation <dunder-options>`

Dunder checker Messages
^^^^^^^^^^^^^^^^^^^^^^^
:bad-dunder-name (W3201): *Bad or misspelled dunder method name %s.*
Used when a dunder method is misspelled or defined with a name not within the
predefined list of dunder names.


.. _pylint.extensions.check_elif:

Else If Used checker
Expand Down Expand Up @@ -335,6 +357,23 @@ Import-Private-Name checker Messages
underscores should be considered private.


.. _pylint.extensions.magic_value:

Magic-Value checker
~~~~~~~~~~~~~~~~~~~

This checker is provided by ``pylint.extensions.magic_value``.
Verbatim name of the checker is ``magic-value``.

See also :ref:`magic-value checker's options' documentation <magic-value-options>`

Magic-Value checker Messages
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
:magic-value-comparison (R2004): *Consider using a named constant or an enum instead of '%s'.*
Using named constants instead of magic values helps improve readability and
maintainability of your code, try to avoid them in comparisons.


.. _pylint.extensions.redefined_variable_type:

Multiple Types checker
Expand Down
7 changes: 3 additions & 4 deletions doc/user_guide/checkers/features.rst
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ Exceptions checker Messages
:duplicate-except (W0705): *Catching previously caught exception type %s*
Used when an except catches a type that was already caught by a previous
handler.
:broad-except (W0703): *Catching too general exception %s*
:broad-exception-caught (W0718): *Catching too general exception %s*
Used when an except catches a too general exception, possibly burying
unrelated errors.
:raise-missing-from (W0707): *Consider explicitly re-raising using %s'%s from %s'*
Expand All @@ -462,6 +462,8 @@ Exceptions checker Messages
operations between exceptions in except handlers.
:bare-except (W0702): *No exception type(s) specified*
Used when an except clause doesn't specify exceptions type to catch.
:broad-exception-raised (W0719): *Raising too general exception: %s*
Used when an except raises a too general exception.
:try-except-raise (W0706): *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
Expand Down Expand Up @@ -876,9 +878,6 @@ Refactoring checker Messages
Emitted when accessing only the first or last element of str.split(). The
first and last element can be accessed by using str.split(sep, maxsplit=1)[0]
or str.rsplit(sep, maxsplit=1)[-1] instead.
:consider-using-augmented-assign (C0210): *Use '%s' to do an augmented assign directly*
Emitted when an assignment is referring to the object that it is assigning
to. This can be changed to be an augmented assign.
:use-sequence-for-iteration (C0208): *Use a sequence type when iterating over values*
When iterating over values, sequence types (e.g., ``lists``, ``tuples``,
``ranges``) are more efficient than ``sets``.
Expand Down
72 changes: 67 additions & 5 deletions doc/user_guide/configuration/all-options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ Standard Checkers
""""""""""""
*Minimum Python version to use for version dependent checks. Will default to the version used to run pylint.*

**Default:** ``(3, 10)``
**Default:** ``(3, 8)``


--recursive
Expand Down Expand Up @@ -217,9 +217,9 @@ Standard Checkers
confidence = ["HIGH", "CONTROL_FLOW", "INFERENCE", "INFERENCE_FAILURE", "UNDEFINED"]
# disable =
disable = ["consider-using-augmented-assign"]
# enable =
enable = []
evaluation = "max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10))"
Expand Down Expand Up @@ -255,7 +255,7 @@ Standard Checkers
persistent = true
py-version = [3, 10]
py-version = [3, 8]
recursive = false
Expand Down Expand Up @@ -1249,7 +1249,7 @@ Standard Checkers

--spelling-dict
"""""""""""""""
*Spelling dictionary name. Available dictionaries: en (aspell), en_AU (aspell), en_CA (aspell), en_GB (aspell), en_US (aspell).*
*Spelling dictionary name. Available dictionaries: none. To make it work, install the 'python-enchant' package.*

**Default:** ``""``

Expand Down Expand Up @@ -1668,6 +1668,68 @@ Extensions
.. raw:: html

</details>


.. _dunder-options:

``Dunder`` **Checker**
----------------------
--good-dunder-names
"""""""""""""""""""
*Good dunder names which should always be accepted.*

**Default:** ``[]``



.. raw:: html

<details>
<summary><a>Example configuration section</a></summary>

**Note:** Only ``tool.pylint`` is required, the section title is not. These are the default values.

.. code-block:: toml
[tool.pylint.dunder]
good-dunder-names = []
.. raw:: html

</details>


.. _magic-value-options:

``Magic-value`` **Checker**
---------------------------
--valid-magic-values
""""""""""""""""""""
* List of valid magic values that `magic-value-compare` will not detect.*

**Default:** ``(0, -1, 1, '', '__main__')``



.. raw:: html

<details>
<summary><a>Example configuration section</a></summary>

**Note:** Only ``tool.pylint`` is required, the section title is not. These are the default values.

.. code-block:: toml
[tool.pylint.magic-value]
valid-magic-values = [0, -1, 1, "", "__main__"]
.. raw:: html

</details>
Expand Down
8 changes: 6 additions & 2 deletions doc/user_guide/messages/messages_overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ All messages in the warning category:
warning/assert-on-tuple
warning/attribute-defined-outside-init
warning/bad-builtin
warning/bad-dunder-name
warning/bad-format-string
warning/bad-format-string-key
warning/bad-indentation
Expand All @@ -216,7 +217,8 @@ All messages in the warning category:
warning/bare-except
warning/binary-op-exception
warning/boolean-datetime
warning/broad-except
warning/broad-exception-caught
warning/broad-exception-raised
warning/cell-var-from-loop
warning/comparison-with-callable
warning/confusing-with-statement
Expand Down Expand Up @@ -343,6 +345,7 @@ All renamed messages in the warning category:
:maxdepth: 1
:titlesonly:

warning/broad-except
warning/cache-max-size-none
warning/implicit-str-concat-in-sequence
warning/lru-cache-decorating-method
Expand Down Expand Up @@ -382,7 +385,6 @@ All messages in the convention category:
convention/compare-to-zero
convention/consider-iterating-dictionary
convention/consider-using-any-or-all
convention/consider-using-augmented-assign
convention/consider-using-dict-items
convention/consider-using-enumerate
convention/consider-using-f-string
Expand Down Expand Up @@ -463,6 +465,7 @@ All messages in the refactor category:
refactor/consider-swap-variables
refactor/consider-using-alias
refactor/consider-using-assignment-expr
refactor/consider-using-augmented-assign
refactor/consider-using-dict-comprehension
refactor/consider-using-from-import
refactor/consider-using-generator
Expand All @@ -483,6 +486,7 @@ All messages in the refactor category:
refactor/empty-comment
refactor/inconsistent-return-statements
refactor/literal-comparison
refactor/magic-value-comparison
refactor/no-classmethod-decorator
refactor/no-else-break
refactor/no-else-continue
Expand Down

0 comments on commit 5407c2d

Please sign in to comment.