Bug 1455086 - codespell: add an exclude list r?ahal
MozReview-Commit-ID: JcRGpjXzxEi
--- a/tools/lint/spell/__init__.py
+++ b/tools/lint/spell/__init__.py
@@ -25,16 +25,18 @@ your PATH or set the CODESPELL environme
https://github.com/lucasdemarchi/codespell or your system's package manager.
""".strip()
results = []
CODESPELL_FORMAT_REGEX = re.compile(r'(.*):(.*): (.*) ==> (.*)$')
+here = os.path.abspath(os.path.dirname(__file__))
+
class CodespellProcess(ProcessHandlerMixin):
def __init__(self, config, *args, **kwargs):
self.config = config
kwargs['processOutputLine'] = [self.process_line]
ProcessHandlerMixin.__init__(self, *args, **kwargs)
def process_line(self, line):
@@ -93,24 +95,27 @@ def lint(paths, config, fix=None, **lint
if not binary:
print(CODESPELL_NOT_FOUND)
if 'MOZ_AUTOMATION' in os.environ:
return 1
return []
config['root'] = lintargs['root']
+ exclude_list = os.path.join(here, 'exclude-list.txt')
cmd_args = [binary,
'--disable-colors',
# Silence some warnings:
# 1: disable warnings about wrong encoding
# 2: disable warnings about binary file
# 4: shut down warnings about automatic fixes
# that were disabled in dictionary.
'--quiet-level=4',
+ '--ignore-words=' + exclude_list,
+ '--skip=exclude-list.txt',
]
# Disabled for now because of
# https://github.com/lucasdemarchi/codespell/issues/314
# if fix:
# cmd_args.append('--write-changes')
base_command = cmd_args + paths
new file mode 100644
--- /dev/null
+++ b/tools/lint/spell/exclude-list.txt
@@ -0,0 +1,6 @@
+cas
+optin
+aparent
+acount
+te
+