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

doc8 does not load ignore-path from pyproject.toml #75

Closed
ssbarnea opened this issue Nov 10, 2021 · 4 comments
Closed

doc8 does not load ignore-path from pyproject.toml #75

ssbarnea opened this issue Nov 10, 2021 · 4 comments
Labels
bug This issue/PR relates to a bug.

Comments

@ssbarnea
Copy link
Member

I tried used two versions of what it was supposed to be config in toml file and I observed that running doc8 failed to use the ignore. On the other hand putting configuration inside setup.cfg worked.

case 1

# pyproject.toml
[tool.doc8]
ignore-path = [".tox"]

case 2

# pyproject.toml
[tool.doc8]
ignore-path = ".tox"

None of these works and based on docs, at least should have worked.

@ejd
Copy link
Contributor

ejd commented Apr 29, 2022

I found that the following does work in pyproject.toml when using doc8 0.11.1 with tomli installed:

[tool.doc8]
ignore_path = ["docs/build"]

argparse.ArgumentParser replaces hyphens in argument names with underscores. When doc8 loads an INI file, it renames the options to match the names returned by argparse and doc8 uses the underscore names internally. I'm guessing it's a bug that doc8 does not also normalize option names when they are loaded from pyproject.toml.

@ssbarnea
Copy link
Member Author

A patch would be welcomed.

@ssbarnea ssbarnea added the bug This issue/PR relates to a bug. label Apr 29, 2022
ejd added a commit to ejd/doc8 that referenced this issue Apr 30, 2022
@ejd
Copy link
Contributor

ejd commented May 2, 2022

See #85

ejd added a commit to ejd/doc8 that referenced this issue May 3, 2022
Instead of using the implementation of `from_ini()` as inspiration,
simply loop over the items in the `[tool.doc8]` dictionary and replace
hyphens in names with underscores.

There is a special case for the `ignore-path-errors` argument because
the elements of that list each need to be parsed.

I removed the extra handling for the `extensions` argument which
stripped whitespace from each element in the list.  On reflection, I
realized that the stripping was necessary for INI files due to the way
the `ConfigParser` works and not because it's necessary to guard
against extensions with whitespace.
ssbarnea added a commit that referenced this issue May 17, 2022
Co-authored-by: Sorin Sbarnea <ssbarnea@redhat.com>
@ejd
Copy link
Contributor

ejd commented May 17, 2022

This issue is now resolved.

@ssbarnea ssbarnea closed this as completed Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug.
Projects
None yet
Development

No branches or pull requests

2 participants