Skip to content
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

[bugfix] Don't trigger analyzer without enabled checkers #3970

Merged
merged 2 commits into from
Sep 8, 2023

Conversation

bruntib
Copy link
Contributor

@bruntib bruntib commented Jul 27, 2023

Sometimes users want to execute exactly one checker. This can be done by disabling all checkers and then enabling that one. Some analyzers fail if no checker is enabled. For example, if the user wants to enable one ClangSA checker and disable everything else explicitly, then ClangTidy fails.

After this patch an analyzer will not be triggered if all of its checkers are disabled.

[cmd] Add --disable-all flag

Add --disable-all flag which disables all checkers of all analyzers. It
is equilent to using "--disable default".

Should be merged after #3949.

Sometimes users want to execute exactly one checker. This can be done by
disabling all checkers and then enabling that one.
Some analyzers fail if no checker is enabled. For example, if the user
wants to enable one ClangSA checker and disable everything else
explicitly, then ClangTidy fails.

After this patch an analyzer will not be triggered if all of its checkers
are disabled.
@bruntib bruntib added CLI 💻 Related to the command-line interface, such as the cmd, store, etc. commands bugfix 🔨 analyzer 📈 Related to the analyze commands (analysis driver) labels Jul 27, 2023
@bruntib bruntib added this to the release 6.23.0 milestone Jul 27, 2023
@bruntib bruntib requested a review from Szelethus July 27, 2023 08:25
@bruntib bruntib requested a review from vodorok as a code owner July 27, 2023 08:25
no_checker_analyzers = \
[a for a in analyzers if not __has_enabled_checker(config_map[a])]
for analyzer in no_checker_analyzers:
LOG.info("No checkers enabled for %s", analyzer)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we tell if the user explicitly enabled an analyzer? If so, we should hard error, shouldn't we?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can be convinced, but I would feel a hard error a little strong here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll give you that one.

@bruntib bruntib requested a review from Szelethus July 27, 2023 12:38
Copy link
Contributor

@Szelethus Szelethus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Add --disable-all flag which disables all checkers of all analyzers. It
is equilent to using "--disable default".
@bruntib bruntib requested a review from dkrupp as a code owner August 14, 2023 13:22
@bruntib bruntib requested a review from Szelethus August 14, 2023 13:23
Copy link
Contributor

@Szelethus Szelethus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM still

@bruntib bruntib merged commit c3dbb1b into Ericsson:master Sep 8, 2023
@bruntib bruntib deleted the disable_default branch September 8, 2023 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer 📈 Related to the analyze commands (analysis driver) bugfix 🔨 CLI 💻 Related to the command-line interface, such as the cmd, store, etc. commands
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants