|
1 |
| -``pep257`` looks for a config file in the root of the project (the common |
2 |
| -prefix of all checked files) and goes up in the directory tree until it finds |
3 |
| -one of the following files (in this order): |
| 1 | +``pep257`` supports `ini`-like configuration files. In order for ``pep257`` to |
| 2 | +use it, it must be named ``setup.cfg``, ``tox.ini`` or ``.pep257`` and have |
| 3 | +a ``[pep257]`` section. |
4 | 4 |
|
5 |
| -* ``setup.cfg`` |
6 |
| -* ``tox.ini`` |
7 |
| -* ``.pep257`` |
| 5 | +When searching for a configuration file, ``pep257`` looks for one of the file |
| 6 | +specified above `in that exact order`. If a configuration file was not found, |
| 7 | +it keeps looking for one up the directory tree until one is found or uses |
| 8 | +the default configuration. |
8 | 9 |
|
9 |
| -The first found file is read, and configurations in the ``[pep257]`` section |
10 |
| -are used, if such a section exists. |
| 10 | +Available Options |
| 11 | +################# |
| 12 | + |
| 13 | +Not all configuration options are available in the configuration files. |
| 14 | +Available options are: |
| 15 | + |
| 16 | +* ``convention`` |
| 17 | +* ``select`` |
| 18 | +* ``ignore`` |
| 19 | +* ``add_select`` |
| 20 | +* ``add_ignore`` |
| 21 | +* ``match`` |
| 22 | +* ``match_dir`` |
| 23 | + |
| 24 | +See the :ref:`cli_usage` section for more information. |
| 25 | + |
| 26 | +Inheritance |
| 27 | +########### |
| 28 | + |
| 29 | +By default, when finding a configuration file, ``pep257`` tries to inherit |
| 30 | +the parent directory's configuration and merge them to the local ones. |
| 31 | + |
| 32 | +The merge process is as follows: |
| 33 | + |
| 34 | +* If one of ``select``, ``ignore`` or ``convention`` was specified in the child |
| 35 | + configuration - Ignores the parent configuration and set the new error codes |
| 36 | + to check. Othewise, Simply copies the parent checked error codes. |
| 37 | +* If ``add-ignore`` or ``add-select`` were specified, adds or removes the |
| 38 | + specified error codes from the checked error codes list. |
| 39 | +* If ``match`` or ``match-dir`` were specified - use them. Otherwise, use the |
| 40 | + parent's. |
| 41 | + |
| 42 | +In order to disable this (useful for configuration files located in your repo's |
| 43 | +root), simply add ``inherit=false`` to your configuration file. |
| 44 | + |
| 45 | + |
| 46 | +.. note:: |
| 47 | + |
| 48 | + If any of ``select``, ``ignore`` or ``convention`` were specified in |
| 49 | + the CLI, the configuration files will take no part in choosing which error |
| 50 | + codes will be checked. ``match`` and ``match-dir`` will still take effect. |
11 | 51 |
|
12 | 52 | Example
|
13 | 53 | #######
|
14 | 54 |
|
15 | 55 | .. code::
|
16 | 56 |
|
17 | 57 | [pep257]
|
18 |
| - verbose = true |
| 58 | + inherit = false |
19 | 59 | ignore = D100,D203,D405
|
20 |
| - explain = true |
| 60 | + match = *.py |
21 | 61 |
|
0 commit comments