Skip to content

Commit

Permalink
check byte length
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrugman committed Jul 16, 2023
1 parent 4e3b9db commit 9c129c1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/ruff/src/rules/pycodestyle/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ pub(super) fn is_overlong(
task_tags: &[String],
tab_size: TabSize,
) -> Option<Overlong> {
// Each character is between 1-4 bytes. If the number of bytes is smaller than the limit, it cannot be overlong.
if line.len() < limit.get() {
return None;
}

let mut width = LineWidth::new(tab_size);
width = width.add_str(line.as_str());
if width <= limit {
Expand Down

0 comments on commit 9c129c1

Please sign in to comment.