sonarqubesonar-runnersonarqube-4.5

sonar 4.5.4-- Debt definition of rule is invalid exception


I have my own customized plugins of csharp of version 2.1 when i deployed stylecope plugin in sonar 4.5.4 server, some rules getting exception like below but after removing those rule its working fine. This exception am getting in sonar 4.5.4 but not facing any issues in sonar 4.2 and lesser version. I need to know why this issue occuring and what is mean to say? Please explain. Thanks

java.lang.IllegalArgumentException: Debt definition on rule 'stylecopcsharp:ConstFieldNamesMustBeginWithUpperCaseLetter' is invalid at org.sonar.server.rule.DeprecatedRulesDefinitionLoader.remediationFunction(DeprecatedRulesDefinitionLoader.java:135) ~[sonar-server-4.5.4.jar:na] at org.sonar.server.rule.DeprecatedRulesDefinitionLoader.updateRuleDebtDefinitions(DeprecatedRulesDefinitionLoader.java:117) ~[sonar-server-4.5.4.jar:na] at org.sonar.server.rule.DeprecatedRulesDefinitionLoader.complete(DeprecatedRulesDefinitionLoader.java:107) ~[sonar-server-4.5.4.jar:na] at org.sonar.server.rule.RuleDefinitionsLoader.load(RuleDefinitionsLoader.java:53) ~[sonar-server-4.5.4.jar:na] at org.sonar.server.rule.RegisterRules.start(RegisterRules.java:102) ~[sonar-server-4.5.4.jar:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_55] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.7.0_55] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.7.0_55] at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.7.0_55] at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110) ~[picocontainer-2.14.3.jar:na] at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89) ~[picocontainer-2.14.3.jar:na] at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84) ~[picocontainer-2.14.3.jar:na] at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169) ~[picocontainer-2.14.3.jar:na] at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132) ~[picocontainer-2.14.3.jar:na] at org.picocontainer.behaviors.Stored.start(Stored.java:110) ~[picocontainer-2.14.3.jar:na] at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1015) ~[picocontainer-2.14.3.jar:na] at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1008) ~[picocontainer-2.14.3.jar:na] at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:766) ~[picocontainer-2.14.3.jar:na] at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92) ~[sonar-plugin-api-4.5.4.jar:na] at org.sonar.server.platform.ServerComponents$1.doPrivileged(ServerComponents.java:590) ~[sonar-server-4.5.4.jar:na] at org.sonar.server.user.DoPrivileged.execute(DoPrivileged.java:43) ~[sonar-server-4.5.4.jar:na] at org.sonar.server.platform.ServerComponents.executeStartupTasks(ServerComponents.java:586) ~[sonar-server-4.5.4.jar:na] at org.sonar.server.platform.Platform.executeStartupTasks(Platform.java:126) ~[sonar-server-4.5.4.jar:na] at org.sonar.server.platform.Platform.startLevel34Containers(Platform.java:122) ~[sonar-server-4.5.4.jar:na] at org.sonar.server.platform.Platform.doStart(Platform.java:81) ~[sonar-server-4.5.4.jar:na] at org.sonar.server.platform.PlatformServletContextListener.contextInitialized(PlatformServletContextListener.java:43) ~[sonar-server-4.5.4.jar:na] at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973) [tomcat-embed-core-7.0.54.jar:7.0.54] at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467) [tomcat-embed-core-7.0.54.jar:7.0.54] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-7.0.54.jar:7.0.54] at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) [tomcat-embed-core-7.0.54.jar:7.0.54] at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) [tomcat-embed-core-7.0.54.jar:7.0.54] at java.util.concurrent.FutureTask.run(Unknown Source) [na:1.7.0_55] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.7.0_55] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.7.0_55] at java.lang.Thread.run(Unknown Source) [na:1.7.0_55]


Solution

  • The .NET and C# plugins version 2.1 are not compatible with newer versions of SonarQube (including 4.5.4).

    You should really consider upgrading to the latest C# plugin and use the MSBuild SonarQube Runner developed in partnership with Microsoft to analyze all .NET projects: It vastly improves the experience, provides much better analysis results, and is way easier to use.

    See http://redirect.sonarsource.com/plugins/csharp.html to get started.

    The information below is informative only, and will allow you to proceed with an unsupported deprecated version of the C# plugin (which is bad, so think twice :p):

    I see that you created your own StyleCop plugin, with the key stylecopcsharp: You should define valid SQALE remediation costs for each rule - or SonarQube will refuse to start.

    The easiest way is actually to remove all SQALE remediation cost information. Now, if you'd like to keep SQALE, you can have a look at the stack trace and see how SonarQube's validation works: DeprecatedRulesDefinitionLoader.java#L135

    There could be more obstacles preventing the use of .NET and C# with SonarQube 4.5.4, so again think twice before going this way.