Bug 1623907 - Move comm-central oriented global exclude code. r=darktrojan
authorRob Lemley <rob@thunderbird.net>
Mon, 06 Apr 2020 20:28:46 -0400
changeset 38809 4fc92758e85e4fd5a828117b0bf20b429cb9fa41
parent 38808 55f47e24fe840ee2607e5ad1a461a0813f9bf331
child 38810 eda2c34c8fd1f7ae0558ceb0e5adfdbb258f01b2
push id401
push userclokep@gmail.com
push dateMon, 01 Jun 2020 20:41:59 +0000
reviewersdarktrojan
bugs1623907
Bug 1623907 - Move comm-central oriented global exclude code. r=darktrojan The exclude file is read in mozilla-central code, this moves reading of comm-central excludes into code in comm-central. The code in mozilla-central that reads GlobalExclude.txt will be removed.
tools/lint/GlobalExclude.txt
tools/lint/ThirdPartyPaths.txt
tools/lint/commlint/__init__.py
rename from tools/lint/GlobalExclude.txt
rename to tools/lint/ThirdPartyPaths.txt
--- a/tools/lint/GlobalExclude.txt
+++ b/tools/lint/ThirdPartyPaths.txt
@@ -1,4 +1,5 @@
+comm/calendar/libical/src/libical
 comm/chat/protocols/matrix/lib
 comm/third_party/libgpg-error
 comm/third_party/libgcrypt
 comm/third_party/libotr
--- a/tools/lint/commlint/__init__.py
+++ b/tools/lint/commlint/__init__.py
@@ -4,33 +4,41 @@
 
 from __future__ import absolute_import, print_function, unicode_literals
 
 import os
 
 from mozpack import path as mozpath
 from mozlint.pathutils import findobject
 
+COMM_EXCLUSION_FILES = [
+    os.path.join('comm', 'tools', 'lint', 'ThirdPartyPaths.txt')
+]
+
 TASKCLUSTER_EXCLUDE_PATHS = (
-    'comm/editor',
-    'comm/suite',
+    os.path.join('comm', 'editor'),
+    os.path.join('comm', 'suite'),
 )
 
 
-def _taskcluster_excludes(root, config):
+def _apply_global_excludes(root, config):
+    exclude = config.get('exclude', [])
+
+    for path in COMM_EXCLUSION_FILES:
+        with open(os.path.join(root, path), 'r') as fh:
+            exclude.extend([f.strip() for f in fh.readlines()])
+
     if os.environ.get('MOZLINT_NO_SUITE', None):
         # Ignore Seamonkey-only paths when run from Taskcluster
-        excludes = [mozpath.join(root, path) for path in TASKCLUSTER_EXCLUDE_PATHS]
+        suite_excludes = [mozpath.join(root, path) for path in TASKCLUSTER_EXCLUDE_PATHS]
+        exclude.extend(suite_excludes)
 
-        config.setdefault('exclude', [])
-        config['exclude'].extend(excludes)
+    config['exclude'] = exclude
 
 
 def lint_wrapper(paths, config, **lintargs):
-    log = lintargs['log']
-
-    _taskcluster_excludes(lintargs['root'], config)
+    _apply_global_excludes(lintargs['root'], config)
 
     payload = findobject(config['wraps'])
     config['payload'] = config['wraps']
     del config['wraps']
 
     return payload(paths, config, **lintargs)