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

Default copyright pattern doesn't allow commas #9477

Closed
dopplershift opened this issue Jan 11, 2024 · 9 comments · Fixed by #9498
Closed

Default copyright pattern doesn't allow commas #9477

dopplershift opened this issue Jan 11, 2024 · 9 comments · Fixed by #9498
Labels
bug Something isn't working

Comments

@dopplershift
Copy link
Contributor

dopplershift commented Jan 11, 2024

As of ruff 0.1.11, the default notice-rgx does not allow for headers that have commas, like:

Copyright (c) 2018, 2019 Developers

Part of the docs do say that (?i)Copyright\s+(\(C\)\s+)?\d{4}([-,]\d{4})* is the default pattern (which works), but there's also (?i)Copyright\s+(\(C\)\s+)?\d{4}(-\d{4})* mentioned in a separate sentence in the docs and matches what's in COPYRIGHT (and reflects actual behavior). Any reason commas shouldn't be accepted?

@charliermarsh
Copy link
Member

I think it might be an oversight. We should probably allow commas there.

@dopplershift
Copy link
Contributor Author

PR submitted in #9498.

@charliermarsh
Copy link
Member

I believe this is allowed, at least in my testing: https://play.ruff.rs/b1dc1b2a-afec-48e6-82b5-ce7eb68fbf33. Closing for now but happy to revisit!

@dopplershift
Copy link
Contributor Author

@charliermarsh I think this and #9498 were closed in error, my local testing still shows a need to manually set notice_rgx in order to get this behavior accepting commas.

I think the reason your testing didn't show a problem is because you have to set tool.ruff.lint.flake8-copyright.author to "Developers" in order to enable the check I believe.

I can't figure out how to share it, but I verified this by setting the author properly on your link above.

@dopplershift
Copy link
Contributor Author

Ping @charliermarsh

@charliermarsh
Copy link
Member

Ack, will take another look!

@dopplershift
Copy link
Contributor Author

Ping since there's a PR to fix sitting in #9498.

@charliermarsh charliermarsh reopened this Mar 22, 2024
@charliermarsh
Copy link
Member

Thanks, I think you're right, that does it. I'll get it merged now, but need to add tests.

charliermarsh pushed a commit that referenced this issue Mar 22, 2024
## Summary

Adds commas as an accepted separator between copyright years by default,
which is actually documented in one spot, but not currently accurate.
Fixes #9477.
@dopplershift
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants