mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-12-22 09:41:32 +03:00
Use strings for lint punctuation customization
This will be needed for this to be compatible with the JSON-based ARB reformatter, which requires all lists to be of equal length in order for whitespace to line up.
This commit is contained in:
parent
97265d24db
commit
d5a59392c0
@ -40,7 +40,7 @@ def check_duplicate_values(strings):
|
||||
seen[v] = k
|
||||
|
||||
|
||||
def check_prefixes(k, v, s_max_words, s_max_len, p_endings, q_endings):
|
||||
def check_prefixes(k, v, s_max_words, s_max_len, p_ending_chars, q_ending_chars):
|
||||
errs = []
|
||||
if k.startswith("s_"):
|
||||
if len(v) > s_max_len:
|
||||
@ -53,10 +53,10 @@ def check_prefixes(k, v, s_max_words, s_max_len, p_endings, q_endings):
|
||||
if ". " in v:
|
||||
errs.append("Spans multiple sentences")
|
||||
elif k.startswith("p_"):
|
||||
if p_endings and not any(v.endswith(p) for p in p_endings):
|
||||
if p_ending_chars and not any(v.endswith(p) for p in p_ending_chars):
|
||||
errs.append("Doesn't end in punctuation")
|
||||
elif k.startswith("q_"):
|
||||
if q_endings and not any(v.endswith(q) for q in q_endings):
|
||||
if q_ending_chars and not any(v.endswith(q) for q in q_ending_chars):
|
||||
errs.append("Doesn't end in question mark.")
|
||||
return errs
|
||||
|
||||
@ -79,8 +79,8 @@ def lint_strings(strings, rules):
|
||||
v,
|
||||
rules.get("s_max_words", 4),
|
||||
rules.get("s_max_len", 32),
|
||||
rules.get("p_endings", [".", "!"]),
|
||||
rules.get("q_endings", ["?"]),
|
||||
rules.get("p_ending_chars", ".!"),
|
||||
rules.get("q_ending_chars", "?"),
|
||||
)
|
||||
)
|
||||
errs.extend(check_misc(k, v))
|
||||
|
@ -16,8 +16,8 @@
|
||||
},
|
||||
|
||||
"@_lint_rules": {
|
||||
"p_endings": [".", "!"],
|
||||
"q_endings": ["?"],
|
||||
"p_ending_chars": ".!",
|
||||
"q_ending_chars": "?",
|
||||
"s_max_words": 4,
|
||||
"s_max_length": 32
|
||||
},
|
||||
|
@ -16,8 +16,8 @@
|
||||
},
|
||||
|
||||
"@_lint_rules": {
|
||||
"p_endings": ["。", "!"],
|
||||
"q_endings": ["?", "?"],
|
||||
"p_ending_chars": "。!",
|
||||
"q_ending_chars": "?",
|
||||
"s_max_words": 4,
|
||||
"s_max_length": 32
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user