-
Notifications
You must be signed in to change notification settings - Fork 383
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
Handle ambigous profile/group parameters #4377
Conversation
23f9a04
to
92cbeaa
Compare
92cbeaa
to
22f992d
Compare
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 feel like this change is a backward incompatible change, and would requires another reviewers opinion.
@dkrupp what is your opinion?
self.set_checker_enabled(checker, enabled) | ||
LOG.error(templ.substitute(entity="profile", | ||
identifier=identifier)) | ||
sys.exit(1) |
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.
Is exit status 1 the proper exit code in case of configuration errors?
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.
Same applies 10 lines below
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 think yes. These are the exit code listed by CodeChecker analyze --help
Exit status
0 - Successful analysis
1 - CodeChecker error
3 - Analysis of at least one translation unit failed
128+signum - Terminating on a fatal signal whose number is signum
@@ -210,23 +212,40 @@ def initialize_checkers(self, | |||
profiles = checker_labels.get_description('profile') | |||
guidelines = checker_labels.occurring_values('guideline') | |||
|
|||
templ = Template("The ${entity} name '${identifier}' conflicts with a " | |||
"checker(-group) name. Please use -e ${entity}: to " |
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.
We should be very specific about what conflicts with what. So if you can provide an exact error message instead of ...with a checker(-group)...
then please be specific.
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.
That's right, AFAIK it is always a checker group name that is conflicting, so I'll correct this.
@@ -216,10 +225,15 @@ def f(checks, checkers): | |||
|
|||
# Enable "security" profile checkers without "profile:" prefix. | |||
cfg_handler = ClangSA.construct_config_handler(args) | |||
cfg_handler.initialize_checkers(checkers, | |||
[('security', True)]) |
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.
Why are you replacing the security prefix? enabling with sensitive?
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.
After this change is introduced, "-e security" should throw an error as "security" is a profile name that conflicts with a checker group name. However, "-e sensitive" should continue to function as it has previously, because the "sensitive" profile name does not conflict with any checker group names. This is what I intend to test here.
22f992d
to
1ad9851
Compare
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.
-
Please fix the description of the initialize_checkers function: instead of "Is considered in this order" in case of name clash, an error is emitted.
-
Also fix the description of the CodeChecker analyze --help that name clashes are not accepted around line 681 " checkers_opts.add_argument('-e', '--enable',"
4c0a007
to
e1bf58f
Compare
Introduce the -e prefix: option, to improve handling of ambigous parameters (such as "security" etc.)
e1bf58f
to
919744e
Compare
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.
LGTM
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.
LGTM
Introduce the -e prefix: option, to improve handling of ambigous parameters.
such as "security" which is a checker prefix group and a profile at the same time