From 7b5552dee0401d8f29e4a47df8efeb1c377d8d88 Mon Sep 17 00:00:00 2001 From: Andi-Bogdan Postelnicu Date: Mon, 26 Aug 2019 08:57:49 +0000 Subject: [PATCH] Bug 1575659 - Fixed crashing of `mach static-analisys` when no arguments where passed. r=bastien Differential Revision: https://phabricator.services.mozilla.com/D43393 --HG-- extra : moz-landing-system : lando --- python/mozbuild/mozbuild/code-analysis/mach_commands.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/python/mozbuild/mozbuild/code-analysis/mach_commands.py b/python/mozbuild/mozbuild/code-analysis/mach_commands.py index 49d3d28e4336..e29c5114c1f2 100644 --- a/python/mozbuild/mozbuild/code-analysis/mach_commands.py +++ b/python/mozbuild/mozbuild/code-analysis/mach_commands.py @@ -155,8 +155,13 @@ class StaticAnalysis(MachCommandBase): @Command('static-analysis', category='testing', description='Run C++ static analysis checks') def static_analysis(self): - # If not arguments are provided, just print a help message. + # If no arguments are provided, just print a help message. mach = Mach(os.getcwd()) + + def populate_context(context, key=None): + context.topdir = self.topsrcdir + + mach.populate_context_handler = populate_context mach.run(['static-analysis', '--help']) @StaticAnalysisSubCommand('static-analysis', 'check',