Bug 1544208 - inform the user who tries to use `mach static-analysis check ...` of when there are no files eligible for analysis. r=bastien
authorAndi-Bogdan Postelnicu <bpostelnicu@mozilla.com>
Tue, 23 Apr 2019 10:01:12 +0000
changeset 470466 cd1779b622d4ece63f8c6bf3e467eaa1c2c57ac4
parent 470465 113fa9baf3e0db62174708f2e97938356e0379ff
child 470467 2b287d167a3ec1c72f953187b2ed74bce9ec90fe
push id35906
push useraciure@mozilla.com
push dateTue, 23 Apr 2019 22:14:56 +0000
treeherdermozilla-central@0ce3633f8b80 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbastien
bugs1544208
milestone68.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 1544208 - inform the user who tries to use `mach static-analysis check ...` of when there are no files eligible for analysis. r=bastien Differential Revision: https://phabricator.services.mozilla.com/D28032
python/mozbuild/mozbuild/mach_commands.py
--- a/python/mozbuild/mozbuild/mach_commands.py
+++ b/python/mozbuild/mozbuild/mach_commands.py
@@ -1841,16 +1841,19 @@ class StaticAnalysis(MachCommandBase):
         for offset in range(0, len(source), chunk_size):
             source_chunks = source[offset:offset + chunk_size]
             name_re = re.compile('(' + ')|('.join(source_chunks) + ')')
             for f in compile_db:
                 if name_re.search(f['file']):
                     total = total + 1
 
         if not total:
+            self.log(logging.INFO, 'static-analysis', {},
+                "There are no files eligible for analysis. Please note that 'header' files "
+                "cannot be used for analysis since they do not consist compilation units.")
             return 0
 
         cwd = self.topobjdir
         self._compilation_commands_path = self.topobjdir
         if self._clang_tidy_config is None:
             self._clang_tidy_config = self._get_clang_tidy_config()
         args = self._get_clang_tidy_command(
             checks=checks, header_filter=header_filter, sources=source, jobs=jobs, fix=fix)