mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-04 19:29:07 +00:00
tidy: check fluent files for style
This commit is contained in:
parent
f241c0c43d
commit
00fec76ab5
@ -13,6 +13,6 @@ borrowck_could_not_normalize =
|
|||||||
|
|
||||||
borrowck_higher_ranked_subtype_error =
|
borrowck_higher_ranked_subtype_error =
|
||||||
higher-ranked subtype error
|
higher-ranked subtype error
|
||||||
|
|
||||||
generic_does_not_live_long_enough =
|
generic_does_not_live_long_enough =
|
||||||
`{$kind}` does not live long enough
|
`{$kind}` does not live long enough
|
||||||
|
@ -4,10 +4,10 @@ expand_explain_doc_comment_outer =
|
|||||||
expand_explain_doc_comment_inner =
|
expand_explain_doc_comment_inner =
|
||||||
inner doc comments expand to `#![doc = "..."]`, which is what this macro attempted to match
|
inner doc comments expand to `#![doc = "..."]`, which is what this macro attempted to match
|
||||||
|
|
||||||
expand_expr_repeat_no_syntax_vars =
|
expand_expr_repeat_no_syntax_vars =
|
||||||
attempted to repeat an expression containing no syntax variables matched as repeating at this depth
|
attempted to repeat an expression containing no syntax variables matched as repeating at this depth
|
||||||
|
|
||||||
expand_must_repeat_once =
|
expand_must_repeat_once =
|
||||||
this must repeat at least once
|
this must repeat at least once
|
||||||
|
|
||||||
expand_count_repetition_misplaced =
|
expand_count_repetition_misplaced =
|
||||||
@ -19,4 +19,4 @@ expand_meta_var_expr_unrecognized_var =
|
|||||||
expand_var_still_repeating =
|
expand_var_still_repeating =
|
||||||
variable '{$ident}' is still repeating at this depth
|
variable '{$ident}' is still repeating at this depth
|
||||||
|
|
||||||
expand_meta_var_dif_seq_matchers = {$msg}
|
expand_meta_var_dif_seq_matchers = {$msg}
|
||||||
|
@ -125,16 +125,13 @@ fn should_ignore(line: &str) -> bool {
|
|||||||
|
|
||||||
/// Returns `true` if `line` is allowed to be longer than the normal limit.
|
/// 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 {
|
fn long_line_is_ok(extension: &str, is_error_code: bool, max_columns: usize, line: &str) -> bool {
|
||||||
if extension != "md" || is_error_code {
|
match extension {
|
||||||
if line_is_url(is_error_code, max_columns, line) || should_ignore(line) {
|
// fluent files are allowed to be any length
|
||||||
return true;
|
"ftl" => true,
|
||||||
}
|
|
||||||
} else if extension == "md" {
|
|
||||||
// non-error code markdown is allowed to be any length
|
// 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 {
|
enum Directive {
|
||||||
@ -230,7 +227,7 @@ pub fn check(path: &Path, bad: &mut bool) {
|
|||||||
super::walk(path, &mut skip, &mut |entry, contents| {
|
super::walk(path, &mut skip, &mut |entry, contents| {
|
||||||
let file = entry.path();
|
let file = entry.path();
|
||||||
let filename = file.file_name().unwrap().to_string_lossy();
|
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(".#") {
|
if extensions.iter().all(|e| !filename.ends_with(e)) || filename.starts_with(".#") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user