Bug 1455086 - codespell: add an exclude list r=ahal
authorSylvestre Ledru <sledru@mozilla.com>
Wed, 18 Apr 2018 21:17:40 +0200
changeset 468135 e73fe9c25c94c6813af999a2fab3476a569fc8db
parent 468134 80ada5ae02fed982788150aa53a5d6fc5820399a
child 468136 f7e0fca791669811e08bc31485eee01762161f69
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersahal
bugs1455086
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1455086 - codespell: add an exclude list r=ahal MozReview-Commit-ID: JcRGpjXzxEi
tools/lint/spell/__init__.py
tools/lint/spell/exclude-list.txt
--- 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
+