Accept commas in default copyright pattern (#9498)

## 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.
This commit is contained in:
Ryan May 2024-03-22 12:42:02 -06:00 committed by GitHub
parent a06ffeb54e
commit 594b232e0f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 192 additions and 6 deletions

View file

@ -1131,15 +1131,15 @@ impl Flake8ComprehensionsOptions {
pub struct Flake8CopyrightOptions {
/// The regular expression used to match the copyright notice, compiled
/// with the [`regex`](https://docs.rs/regex/latest/regex/) crate.
///
/// Defaults to `(?i)Copyright\s+((?:\(C\)|©)\s+)?\d{4}(-\d{4})*`, which matches
/// Defaults to `(?i)Copyright\s+((?:\(C\)|©)\s+)?\d{4}((-|,\s)\d{4})*`, which matches
/// the following:
/// - `Copyright 2023`
/// - `Copyright (C) 2023`
/// - `Copyright 2021-2023`
/// - `Copyright (C) 2021-2023`
/// - `Copyright (C) 2021, 2023`
#[option(
default = r#"(?i)Copyright\s+((?:\(C\)|©)\s+)?\d{4}([-,]\d{4})*"#,
default = r#"(?i)Copyright\s+((?:\(C\)|©)\s+)?\d{4}((-|,\s)\d{4})*"#,
value_type = "str",
example = r#"notice-rgx = "(?i)Copyright \\(C\\) \\d{4}""#
)]