When invoking doc8 if no --extension value is provided in the command line argument, doc8 uses the defaults of ['.rst', '.txt'] for this value, if the --extension command line argument is specified, its values are added to the defaults. When later it loads the configuration values from a pyproject.toml file in the tool.doc8.extension value, it will also extend the extensions with the values defined here.
Consider the following pyproject.toml:
[tool.doc8]
extension = [".rst", ".py"]
And the following call to doc8:
doc8 .
This will result in doc8 using [".rst", ".txt", ".rst", ".py"] instead of just the values in the pyproject.toml file [".rst", ".py"].
The following call:
doc8 . --extension '.bin'
Will result in [".rst", ".txt", ".bin", ".rst", ".py"] being used.
This behaviour is caused because of the append store action in the --extension parameter of argparse in main.py file, which appends to the default values specified for that parameter rather than replacing them, see issue https://bugs.python.org/issue16399.
In summary, there is no way to get rid of the default values for the extensions, [".rst", ".txt"] will be included no matter how you invoke doc8 or what configuration you provide.
When invoking doc8 if no
--extension
value is provided in the command line argument, doc8 uses the defaults of['.rst', '.txt']
for this value, if the--extension
command line argument is specified, its values are added to the defaults. When later it loads the configuration values from apyproject.toml
file in thetool.doc8.extension
value, it will also extend the extensions with the values defined here.Consider the following
pyproject.toml
:And the following call to doc8:
This will result in doc8 using
[".rst", ".txt", ".rst", ".py"]
instead of just the values in thepyproject.toml
file[".rst", ".py"]
.The following call:
Will result in
[".rst", ".txt", ".bin", ".rst", ".py"]
being used.This behaviour is caused because of the
append
store action in the--extension
parameter ofargparse
inmain.py
file, which appends to the default values specified for that parameter rather than replacing them, see issue https://bugs.python.org/issue16399.In summary, there is no way to get rid of the default values for the extensions,
[".rst", ".txt"]
will be included no matter how you invoke doc8 or what configuration you provide.Is this the intended behaviour?