Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyproject.toml tool.doc8.extension extends the extensions default value rather than replace it #143

Open
dmg0345 opened this issue Jul 2, 2023 · 0 comments

Comments

@dmg0345
Copy link

dmg0345 commented Jul 2, 2023

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.

Is this the intended behaviour?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant