-
Notifications
You must be signed in to change notification settings - Fork 362
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
Refactoring: clean-up checks #1410
Comments
@Bertk the idea to remove those was in case if we would implement those rules into the CxxChecks. Have i got the impression that @guwirth had a different view for those CxxChecks? Anyway, for Vera because its mostly a linter. I supose replacing it with something more mainstream like cpplint with be more beneficial for end users. for Rats, for security analysis i dont think there is no replacement for that. CppLint could be a interesting replacement for linter, where the sensor actually runs the linter since it does require little configuration. the only dependcy is python, and that should be available in most boxes
@Bertk and @jmecosta my idea is still:
Think we have no chance to do the same work as other are already did: VS, Core Guideline Checker, Clang, Cppcheck, ... are too good to reimplement everything again...
@guwirth i dont know, if we have a grammar, it seems logic that we also have checks. otherwise just run a external tool collect those metrics and simplify the plugin a lot. alternatively if really willing to just consume external stuff, integrate a clang static analyser by default that gives all metrics and provides basic checks. If those are handle with clang, there is much more possibility of community particiating on developing those. That means dropping totally the sslr stuff from the plugin. By the way, thats what c# plugin does, so they use the roslyn compiler so they dont need to worry about supporting the grammar. as far as i see you spend loads of time supporting the grammar only for the marginal gain of having some code metrics
@guwirth , @jmecosta I think the current implementation of AST based checkers and CppCheck are better alternatives. I used AST based checkers to implement custom rules and also extended the grammar for CUDA and C++/CLI. We should continue source code analysis with AST but create checks and rules which are not available in other tools. This can be revised in 2020 with the next C++ standard.
I'm sure clang or derivatives can be used as frontend for many c flavours But that's not the point, I'm only saying if everything is from external Now if you start developing new checks then effectively keeping tools like Imo opinion it's a difficult road, because we are always affected by the But I'm not against or in favour of either alternative. And I would |
Please note that some users (like me) have implemented custom checks, using the sslr parser. If you remove it from the plugin, we will no longer be able to use our custom checks. |
@phcouton the idea is not to remove the sslr parser and AST (XPath support / custom checks). Idea is only to remove the checks which are doing static code analysis. The idea of the plugin is to use external tools for it. Reinventing the wheel makes no sense. From the design point of view there should be a clear separation: static code analysis checks = external tool. Sample of checks to be removed: SwitchLastCaseIsDefaultCheck, UnnamedNamespaceInHeaderCheck, BooleanEqualityComparisonCheck, UsingNamespaceInHeaderCheck, ... There is also another discussion to replace the parser #1479. Maybe you can add your five cent there. |
I understand there is a significant effort in keeping the static analysis code in the plugin. However, there is a significant use case for this, which is not handled through external tools.
Both these feature make the integration a really significant feature. True, the integrated checks are quite limited, but they provide a few things already, with a much better workflow and simplified configuration. For exemple, clang-tidy and clang-format may indeed allow must more complete and accurate checks, but they are also significantly more complicated to setup, with no easy option for centralizing the rules. So basically I may be fine with removing the integrated checks, but only when the plugin gains the ability to both run the external tools (to generate the reports) and configure this tools in the Quality Profile. |
Hi @Typz, thanks for you feedback.
No it's not really the effort. The effort was quite low in the past. Problem is more:
I would not change the current behaviour. Running external tools is in most cases part of an already existing CI chain. Question again here: Why reinventing the wheel? What can we do better as e.g. Jenkins? The rest is to create an XML report and copy it to an folder. What we can (and should) improve is XSLT support. Regards, |
additionally to the arguments of @guwirth I would like to mention
W.r.t. the preprocessor ( |
Mind me, I am not against removing the checks as such. I just think they have huge advantage, of allowing to "driving" the analysis process. If you are running CI only, this may not be significant: you can add many steps in your CI chain. However, the advantage becomes significant when you consider that you want your developper to also be able to run the tests locally: in that case, it is quite convenient to be able to define how to run the analysis in a simple file. As already mentionned, the other advantage is that the configuration of the analysis (e.g. indent width...) is defined centrally on SonarQube, which is quite nice for enforcing compagny-wide rules. Now, there are indeed many "practical" reasons to remove the checks: but I still think the workflow they provide is slightly better. A way out of this however may be to integrate the configuration and running of the external tools in the plugins: this way the configuration can be defined on SonarQube and the analysis can be driven by sonar-runner if needed, while re-using existing high-quality analysis engines. |
closed with #1704 |
Clean-up the cxx plugin checks.
The text was updated successfully, but these errors were encountered: