-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomershelp wantedContributions especially welcomeContributions especially welcome
Description
The missing copyright notice only looks at the 1024 first bytes. However, this can go wrong for unicode text if the 1024 byte is not a character boundary (because it is a multibyte character).
ruff/crates/ruff/src/rules/flake8_copyright/rules/missing_copyright_notice.rs
Lines 36 to 40 in 2cf00fe
| let contents = if locator.len() < 1024 { | |
| locator.contents() | |
| } else { | |
| locator.up_to(TextSize::from(1024)) | |
| }; |
Fix: Use is_char_boundary to find a valid char boundary close to 1024.
locator.contents().is_char_boundary(1024)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomershelp wantedContributions especially welcomeContributions especially welcome