Specifically this is about the command
./mach static-analysis and not about the entire featureset of
./mach static-analysis [subcommand]
./mach static-analysis tries to be more friendly than all the other mach commands by printing it's help if you call it without arguments. This is commendable, as no other command does this, and it really would be nice if they did.
However, it doesn't work.
AttributeError: 'CommandContext' object has no attribute 'topdir'
File "/home/tom/Documents/moz/mozilla-unified-2/python/mach/mach/main.py", line 360, in run
File "/home/tom/Documents/moz/mozilla-unified-2/python/mach/mach/main.py", line 402, in _run
File "/home/tom/Documents/moz/mozilla-unified-2/python/mach/mach/registrar.py", line 61, in register_conditional_names
instance = MachRegistrar._instance(handler, context)
File "/home/tom/Documents/moz/mozilla-unified-2/python/mach/mach/registrar.py", line 99, in _instance
instance = cls(context)
File "/home/tom/Documents/moz/mozilla-unified-2/python/mozbuild/mozbuild/base.py", line 858, in __init__
topsrcdir = context.topdir
My guess is that https://searchfox.org/mozilla-central/source/mach sets up the mach object in a way that simply creating a mach object does not.
While it would be easy to remove this code and revert mach static-analysis back to the unfriendly format of all other commands - it would be way better to make this work, and have all commands do it by default...