Bug 1405654 - set default value for header-filter the same as source. r?sylvestre draft
authorAndi-Bogdan Postelnicu <bpostelnicu@mozilla.com>
Thu, 05 Oct 2017 16:26:53 +0300
changeset 675538 e28e8ab8a0380f04d3a82feaf8a4a5755a9c221d
parent 675508 53bbdaaa2b8c1819061be26101b075c081b23260
child 734631 4799a496307667c5401d292bc6f3d7351eeae181
push id83160
push userbmo:bpostelnicu@mozilla.com
push dateThu, 05 Oct 2017 13:27:19 +0000
reviewerssylvestre
bugs1405654
milestone58.0a1
Bug 1405654 - set default value for header-filter the same as source. r?sylvestre MozReview-Commit-ID: 705as3mM1dA
python/mozbuild/mozbuild/mach_commands.py
--- a/python/mozbuild/mozbuild/mach_commands.py
+++ b/python/mozbuild/mozbuild/mach_commands.py
@@ -2228,18 +2228,22 @@ class StaticAnalysis(MachCommandBase):
 
         if checks == '-*':
             checks = self._get_checks()
 
         common_args = ['-clang-tidy-binary', self._clang_tidy_path,
                        '-checks=%s' % checks,
                        '-extra-arg=-DMOZ_CLANG_PLUGIN']
 
-        if len(header_filter):
-            common_args.append('-header-filter=%s' % header_filter)
+        # Flag header-filter is passed to 'run-clang-tidy' in order to limit
+        # the diagnostic messages only to the specified header files.
+        # When no value is specified the default value is considered to be the source
+        # in order to limit the dianostic message to the source files or folders.
+        common_args.append('-header-filter=%s' %
+                           (header_filter if len(header_filter) else ''.join(source)))
 
         if fix:
             common_args.append('-fix')
 
         self.log_manager.register_structured_logger(logging.getLogger('mozbuild'))
 
         compile_db = json.loads(open(self._compile_db, 'r').read())
         total = 0