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

Inline-Ignore (yml) does not work with multiple whitespaces #3644

Closed
CCFenner opened this issue Feb 19, 2025 · 2 comments · Fixed by #3653
Closed

Inline-Ignore (yml) does not work with multiple whitespaces #3644

CCFenner opened this issue Feb 19, 2025 · 2 comments · Fixed by #3653
Labels

Comments

@CCFenner
Copy link

Having multiple after the # breaks the line-ignore

test:
  fpr: something #  codespell:ignore fpr

Fixing this (removing the whitespaces) clashed with https://yamllint.readthedocs.io/en/stable/rules.html#module-yamllint.rules.comments default settings for min-spaces-from-content.

@DimitriPapadopoulos
Copy link
Collaborator

I don't think that's what min-spaces-from-content is about. It doesn't enforce a minimal number of spaces after the number sign #:

test:
  fpr: something #  codespell:ignore fpr

Instead it enforces spaces before the number sign #:

test:
  fpr: something  # codespell:ignore fpr

@DimitriPapadopoulos
Copy link
Collaborator

DimitriPapadopoulos commented Feb 19, 2025

With that said, it remains a bug that needs to be fixed. PR welcome!

I guess \s?codespell:ignore should be changed to \s*codespell:ignore.

inline_ignore_regex = re.compile(r"[^\w\s]\s?codespell:ignore\b(\s+(?P<words>[\w,]*))?")

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

Successfully merging a pull request may close this issue.

2 participants