Auto merge of #100671 - Xiretza:tidy-fluent-files, r=davidtwco
tidy: check fluent files for style Inspired by https://github.com/rust-lang/rust/pull/100651#discussion_r947600576 There were a lot of line length violations, so I've excepted that lint - I'm not sure if fluent files can be formatted to avoid long lines at all.
This commit is contained in:
commit
d0ea1d7679
3 changed files with 12 additions and 15 deletions
|
@ -14,5 +14,5 @@ borrowck_could_not_normalize =
|
|||
borrowck_higher_ranked_subtype_error =
|
||||
higher-ranked subtype error
|
||||
|
||||
generic_does_not_live_long_enough =
|
||||
borrowck_generic_does_not_live_long_enough =
|
||||
`{$kind}` does not live long enough
|
|
@ -125,16 +125,13 @@ fn should_ignore(line: &str) -> bool {
|
|||
|
||||
/// Returns `true` if `line` is allowed to be longer than the normal limit.
|
||||
fn long_line_is_ok(extension: &str, is_error_code: bool, max_columns: usize, line: &str) -> bool {
|
||||
if extension != "md" || is_error_code {
|
||||
if line_is_url(is_error_code, max_columns, line) || should_ignore(line) {
|
||||
return true;
|
||||
}
|
||||
} else if extension == "md" {
|
||||
match extension {
|
||||
// fluent files are allowed to be any length
|
||||
"ftl" => true,
|
||||
// non-error code markdown is allowed to be any length
|
||||
return true;
|
||||
"md" if !is_error_code => true,
|
||||
_ => line_is_url(is_error_code, max_columns, line) || should_ignore(line),
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
|
||||
enum Directive {
|
||||
|
@ -230,7 +227,7 @@ pub fn check(path: &Path, bad: &mut bool) {
|
|||
super::walk(path, &mut skip, &mut |entry, contents| {
|
||||
let file = entry.path();
|
||||
let filename = file.file_name().unwrap().to_string_lossy();
|
||||
let extensions = [".rs", ".py", ".js", ".sh", ".c", ".cpp", ".h", ".md", ".css"];
|
||||
let extensions = [".rs", ".py", ".js", ".sh", ".c", ".cpp", ".h", ".md", ".css", ".ftl"];
|
||||
if extensions.iter().all(|e| !filename.ends_with(e)) || filename.starts_with(".#") {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue