-
Notifications
You must be signed in to change notification settings - Fork 396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[cmd] Emit errors instead of hiding flags #4465
base: master
Are you sure you want to change the base?
[cmd] Emit errors instead of hiding flags #4465
Conversation
As a sidenote: I tried creating a custom |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this improvement!
@@ -813,6 +811,54 @@ def add_arguments_to_parser(parser): | |||
func=main, func_process_config_file=cmd_config.process_config_file) | |||
|
|||
|
|||
def check_satisfied_capabilities(args): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"CodeChecker check" is using "CodeChecker analyze" by calling its main()
function like a library code. For this reason there is no need to duplicate this logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I wanted to request for some changes :(
Also, please check the failing tests, too.
One of the great annoyances with any tool, but in particular with CodeChecker is that we have a habit of hiding, suppressing stuff instead of just telling the user whats up. Such is the case with
--stats
,--ctu
, etc. These flags can only be used if the clang CodeChecker found supports statistics generation or CTU analysis. However, if you try to invoke CodeChecker with an incompatible flag, you get something like this:That is nuts! Not only do we emit this message, it doesn't even show up in
--help
. How is a user supposed to know about z3 analyses, if we never show it in the first place? If we did, a user might get a hold of a clang that supports it, there is literally zero reason to just outright hide it.With this patch, all flags that depend on an analyzer tool having a specific capability are displayed by default, and a helpful error message is shown if its not available. Here is an example:
The change is as trivial as it looks, the only thing I changed is that some statistics related option's default value now depends on whether clang is stats capable (similarly to how its always been done for ctu flags), and since the z3 tests checked z3 compliance from CodeChecker's own error message, that needed adjustment as well. In the Z3 tests, the command that runs
CodeChecker anayze
were moved below the part where the compile_commands.json is copied.