-
Notifications
You must be signed in to change notification settings - Fork 363
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
Custom rules no longer working with v0.9.8 #1308
Comments
@phcouton I'm sorry that this is no more working. Starting with SQ 6.2 there were a lot of API changes, maybe one of them is the reason for this. I recommend you to have a look in Java or JavaScript source code how they are doing it and adapt your code accordingly. To avoid this in future you should add some unit test to our code to ensure the interface is functional. |
@guwirth I don't think that is related to the API changes introduced with of SQ 6.2:
If this can help to spot the problem, I found this:
So, the CustomCxxRulesDefinition[] is never used. |
Oops, closed by error! |
@phcouton after splitting the plugin into c and cxx plugin there was only one ctor exported. Just a guess: but exporting both again custom rules should work again. Maybe you can try with #1343. |
@phcouton please try again with latest snapshot. Please keep in mind that 0.9.9 is working with SQ 6.7 only. |
The latest 0.9.9-SNAPSHOT does not work for me (SQ 6.7, SonarScanner 3.0.3, Java 1.8, Linux):
|
@phcouton thanks for th feedback. Will have a look again.
|
@phcouton please try again with #1346 (latest snapshot). Sorry is try and error... |
@guwirth Same exception with the latest snapshot. However, I made a small change in the source of CxxPlugin and there is no longer exception, the custom rules work : public static class CxxSquidSensorImpl extends CxxSquidSensor {
public CxxSquidSensorImpl(Configuration settings,
FileLinesContextFactory fileLinesContextFactory,
CheckFactory checkFactory,
CxxCoverageAggregator coverageCache) {
super(new CppLanguage(settings), fileLinesContextFactory, checkFactory);
}
public CxxSquidSensorImpl(Configuration settings,
FileLinesContextFactory fileLinesContextFactory,
CheckFactory checkFactory,
CxxCoverageAggregator coverageCache, // <-- added this one
@Nullable CustomCxxRulesDefinition[] customRulesDefinition) {
super(new CppLanguage(settings), fileLinesContextFactory, checkFactory, customRulesDefinition);
}
} |
@phcouton I tried it again in #1347 bur the other way around: removing coverageCache because it is not used. Hope this is working now. |
@guwirth No problem on my side. Thanks for your help :) |
I had previously made my own custom rules plugin, which worked perfectly with the cxx plugin v0.9.7. I updated the cxx plugin to v0.9.8 and my plugin is no longer working.
My plugin was made according to Extending-the-code-analysis, Writing your own rules using SSLR, aka custom cxx-rules and cxx-custom-checks-example-plugin.
Since there was compile errors with v0.9.8, I had to make minor changes in my plugin (new package for CustomCxxRulesDefinition, and CppLanguage handling).
Now, when I analyze a C++ project, I see in the logs that my custom rules plugin starts correctly (i.e. the
define()
method of my plugin is called). This method is as follow:However, it seems that the
context.addExtension()
call is ignored, since none of the methods of theMyCxxCustomRulesDefinition
class are called. This worked previously.Do I have missed something to make my plugin working?
The text was updated successfully, but these errors were encountered: