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

Does .codespellrc support comments? #3229

Closed
your-diary opened this issue Nov 21, 2023 · 2 comments · Fixed by #3271
Closed

Does .codespellrc support comments? #3229

your-diary opened this issue Nov 21, 2023 · 2 comments · Fixed by #3271

Comments

@your-diary
Copy link

Using a config file in README.md says nothing about it.

It seems # and // both work, but are these officially supported as comments or a bug?

@DimitriPapadopoulos
Copy link
Collaborator

DimitriPapadopoulos commented Nov 21, 2023

It's an INI file. We read it using configparser.ConfigParser so the format is pretty standard and beyond our direct reach. Both # and ; work according to the previous link. I am surprised // works, because it's really not standard for INI files.

We should probably specify the config files are INI files.

@your-diary
Copy link
Author

your-diary commented Nov 21, 2023

Thank you.

I just confirmed configparser.ConfigParser() is used in codespell_lib/_codespell.py.

I am surprised // works, because it's really not standard for INI files.

I noticed any symbols work:

[codespell]

#These are all ignored.
* ignore-words-list = ect
+ ignore-words-list = ect
# ignore-words-list = ect
// ignore-words-list = ect
; ignore-words-list = ect
_ ignore-words-list = ect

#Only this works.
ignore-words-list = ect

Though it seems the comment characters can be customized via comment_prefixes parameter of configparser.ConfigParser() according to Customizing Parser Behaviour, the setting is not used in project, making the situation strange.

We should probably specify the config files are INI files.

I do agree with you.

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

Successfully merging a pull request may close this issue.

2 participants