Skip to content

Accept commas in default copyright pattern#9498

Merged
charliermarsh merged 3 commits intoastral-sh:mainfrom
dopplershift:copyright-comma
Mar 22, 2024
Merged

Accept commas in default copyright pattern#9498
charliermarsh merged 3 commits intoastral-sh:mainfrom
dopplershift:copyright-comma

Conversation

@dopplershift
Copy link
Copy Markdown
Contributor

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.

Test Plan

@charliermarsh
Copy link
Copy Markdown
Member

Just trying to add tests for this... It seems like Copyright (c) 2018, 2019 Developers is actually accepted on main? See: https://play.ruff.rs/5c5932af-5fef-4990-bcc5-c854c0b46255

@charliermarsh
Copy link
Copy Markdown
Member

It seems like the current regex could be described as "Must contain Copyright\s+(\(C\)\s+)?\d{4}, followed by anything". So Copyright (c) 2018, 2019 Developers would match as "Copyright (c) 2018, followed by anything".

@BurntSushi
Copy link
Copy Markdown
Member

It seems like the current regex could be described as "Must contain Copyright\s+(\(C\)\s+)?\d{4}, followed by anything". So Copyright (c) 2018, 2019 Developers would match as "Copyright (c) 2018, followed by anything".

Nit: you probably want [0-9] instead of \d. Or, equivalently, (?-u:\d). See: https://docs.rs/regex/latest/regex/#example-validating-a-particular-date-format

@charliermarsh
Copy link
Copy Markdown
Member

Closing for now, but happy to revisit if we get more info.

@github-actions
Copy link
Copy Markdown
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@charliermarsh charliermarsh merged commit 594b232 into astral-sh:main Mar 22, 2024
@charliermarsh charliermarsh added the bug Something isn't working label Mar 22, 2024
@dopplershift dopplershift deleted the copyright-comma branch March 22, 2024 18:43
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 this pull request may close these issues.

Default copyright pattern doesn't allow commas

3 participants