зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1736559 - [lint] Fix codespell silently fixing files, r=linter-reviewers,sylvestre
We have a check in the 'CodespellProcess' class to ignore errors that are fixing single letter camelCase errors (since these tend to be used frequently. Unfortunately, when using '--fix', these errors are fixed regardless as the fixing happens with the codespell process. Since we increment the 'fix' variable after the check happens, we don't even report that anything was 'fixed'. Ideally we would find a way to prevent these types of errors from being fixed, but for now this at will at least ensure that the user is notified that something was modified. Differential Revision: https://phabricator.services.mozilla.com/D128885
This commit is contained in:
Родитель
27c8d4bb79
Коммит
4dd650366c
|
@ -55,13 +55,14 @@ class CodespellProcess(LintProcess):
|
||||||
print("Unable to match regex against output: {}".format(line))
|
print("Unable to match regex against output: {}".format(line))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if CodespellProcess._fix:
|
||||||
|
CodespellProcess.fixed += 1
|
||||||
|
|
||||||
# Ignore false positive like aParent (which would be fixed to apparent)
|
# Ignore false positive like aParent (which would be fixed to apparent)
|
||||||
# See https://github.com/lucasdemarchi/codespell/issues/314
|
# See https://github.com/lucasdemarchi/codespell/issues/314
|
||||||
m = re.match(r"^[a-z][A-Z][a-z]*", typo)
|
m = re.match(r"^[a-z][A-Z][a-z]*", typo)
|
||||||
if m:
|
if m:
|
||||||
return
|
return
|
||||||
if CodespellProcess._fix:
|
|
||||||
CodespellProcess.fixed += 1
|
|
||||||
res = {
|
res = {
|
||||||
"path": abspath,
|
"path": abspath,
|
||||||
"message": typo.strip() + " ==> " + correct,
|
"message": typo.strip() + " ==> " + correct,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче