Bug 1455086 - codespell: add an exclude list r?ahal draft
authorSylvestre Ledru <sledru@mozilla.com>
Wed, 18 Apr 2018 21:17:40 +0200
changeset 785317 cf8bd4089fbb88851b07c2af1f799c9ab691fe58
parent 782895 6276ec7ebbf33e3484997b189f20fc1511534187
child 785319 b1efbf1925404389c8337eb7a47d582cceada1a5
push id107188
push userbmo:sledru@mozilla.com
push dateThu, 19 Apr 2018 21:32:29 +0000
reviewersahal
bugs1455086
milestone61.0a1
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
+