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

Test multi-suggestion-ending-in-comma with pre-commit hook #3526

Open
corneliusroemer opened this issue Aug 19, 2024 · 3 comments
Open

Test multi-suggestion-ending-in-comma with pre-commit hook #3526

corneliusroemer opened this issue Aug 19, 2024 · 3 comments

Comments

@corneliusroemer
Copy link
Contributor

It should be easy to write a little sed script to auto-fix/format this:

codespell_lib/tests/test_dictionary.py:80: in test_dictionary_formatting
    raise AssertionError(msg)
E   AssertionError: 
E   error disturbative: multiple corrections must end with trailing ","
sed '/,/s/,*$/,/' filename

This should:

  • on all lines with commas
  • remove trailing commas
  • and add a single trailing commas
@corneliusroemer
Copy link
Contributor Author

corneliusroemer commented Aug 19, 2024

Better: first remove all trailing commas, then readd if there's a comma in the line. This also removes unnecessary trailing commas

sed -e 's/,*$//' -e '/,/s/$/,/' filename

@DimitriPapadopoulos
Copy link
Collaborator

Actually, any item after the last comma is supposed to be a comment. I'm not a huge fan of this functionality, but I think we shouldn't modify this until we have a better and documented way to comment.

@corneliusroemer
Copy link
Contributor Author

I see! I don't think there's a single comment like this at the moment

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

No branches or pull requests

2 participants