Skip to content

Commit

Permalink
Allow © in copyright notices
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Feb 20, 2024
1 parent ee4efdb commit 431bc8b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
14 changes: 14 additions & 0 deletions crates/ruff_linter/src/rules/flake8_copyright/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,20 @@ import os
r"
# Copyright (C) 2023
import os
"
.trim(),
&settings::LinterSettings::for_rules(vec![Rule::MissingCopyrightNotice]),
);
assert_messages!(diagnostics);
}

#[test]
fn notice_with_unicode_c() {
let diagnostics = test_snippet(
r"
# Copyright © 2023
import os
"
.trim(),
Expand Down
2 changes: 1 addition & 1 deletion crates/ruff_linter/src/rules/flake8_copyright/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct Settings {
}

pub static COPYRIGHT: Lazy<Regex> =
Lazy::new(|| Regex::new(r"(?i)Copyright\s+(\(C\)\s+)?\d{4}(-\d{4})*").unwrap());
Lazy::new(|| Regex::new(r"(?i)Copyright\s+((?:\(C\)|©)\s+)?\d{4}(-\d{4})*").unwrap());

impl Default for Settings {
fn default() -> Self {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
source: crates/ruff_linter/src/rules/flake8_copyright/mod.rs
---

0 comments on commit 431bc8b

Please sign in to comment.