Skip to content
This repository has been archived by the owner on Jan 6, 2024. It is now read-only.

Error during SonarScanner execution #170

Open
SammyJankis opened this issue Jul 31, 2023 · 16 comments
Open

Error during SonarScanner execution #170

SammyJankis opened this issue Jul 31, 2023 · 16 comments

Comments

@SammyJankis
Copy link
Contributor

Hi,

I'm trying to build and scan the code of my app on bitrise, but I'm getting an Invalid Config error:

ERROR: Error during SonarScanner execution
io.github.detekt.tooling.api.InvalidConfig: Run failed with 6 invalid config properties.
	- Property 'complexity>CognitiveComplexMethod' is misspelled or does not exist.
	- Property 'complexity>CyclomaticComplexMethod' is misspelled or does not exist.
	- Property 'potential-bugs>IgnoredReturnValue>restrictToConfig' is misspelled or does not exist.
	- Property 'style>ForbiddenComment>comments' is misspelled or does not exist.
	- Property 'style>BracesOnIfStatements' is misspelled or does not exist.
	- Property 'Compose' is misspelled or does not exist.
	at io.gitlab.arturbosch.detekt.core.config.ConfigValidatorsKt.checkConfiguration(ConfigValidators.kt:25)
	at io.gitlab.arturbosch.detekt.core.tooling.Lifecycle$analyze$1.invoke(Lifecycle.kt:35)
	at io.gitlab.arturbosch.detekt.core.tooling.Lifecycle$analyze$1.invoke(Lifecycle.kt:35)
	at io.gitlab.arturbosch.detekt.core.util.PerformanceMonitor.measure(PerformanceMonitor.kt:42)
	at io.gitlab.arturbosch.detekt.core.tooling.Lifecycle$DefaultImpls.measure(Lifecycle.kt:32)
	at io.gitlab.arturbosch.detekt.core.tooling.Lifecycle$DefaultImpls.analyze(Lifecycle.kt:35)
	at io.gitlab.arturbosch.detekt.core.tooling.DefaultLifecycle.analyze(Lifecycle.kt:59)
	at io.gitlab.arturbosch.detekt.core.tooling.AnalysisFacade$runAnalysis$1.invoke(AnalysisFacade.kt:43)
	at io.gitlab.arturbosch.detekt.core.tooling.AnalysisFacade$runAnalysis$1.invoke(AnalysisFacade.kt:42)
	at io.gitlab.arturbosch.detekt.core.tooling.ProcessingSpecSettingsBridgeKt.withSettings(ProcessingSpecSettingsBridge.kt:26)
	at io.gitlab.arturbosch.detekt.core.tooling.AnalysisFacade.runAnalysis$detekt_core(AnalysisFacade.kt:42)
	at io.gitlab.arturbosch.detekt.core.tooling.AnalysisFacade.run(AnalysisFacade.kt:25)
	at io.gitlab.arturbosch.detekt.sonar.sensor.DetektSensor.execute(DetektSensor.kt:23)
	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59)
	at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(SpringModuleScanContainer.java:81)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
	at org.sonar.scanner.scan.SpringProjectScanContainer.scan(SpringProjectScanContainer.java:392)
	at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(SpringProjectScanContainer.java:388)
	at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:357)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
	at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:135)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
	at jdk.proxy1/jdk.proxy1.$Proxy0.execute(Unknown Source)
	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
	at org.sonarsource.scanner.cli.Main.main(Main.java:61)

In our project we are using detekt plugin 1.23.0 and it is working fine, but it seems that the sonar scanner is not using that version, since CyclomaticComplexMethod for example was added in 1.22.0.

@SammyJankis
Copy link
Contributor Author

Seems that version 2.5.0 doesn't contain last changes related with detekt 1.23.0 that are on this last PR #167 committed by @boswelja. I was wondering if you @cortinico can help to release a new version with these last changes 🙏

@cortinico
Copy link
Member

We would have to first update version to detekt 1.23.1 before we can make a new release. Are you up for doing it?

@SammyJankis
Copy link
Contributor Author

No idea of how to do it tbh. It is just updating the pom.xml?

@cortinico
Copy link
Member

No idea of how to do it tbh. It is just updating the pom.xml

Practically yes. Check through the git history to find similar bumps

@SammyJankis
Copy link
Contributor Author

I'm gonna need push permissions

@cortinico
Copy link
Member

I'm gonna need push permissions

Nope you don't need push permissions. Please fork this repo and send a pull request

@SammyJankis
Copy link
Contributor Author

#171

@SammyJankis
Copy link
Contributor Author

So the new version of detekt is merged in main, is it planned to release a new version?

@cortinico
Copy link
Member

Yes but I don't have the time at the moment to do so. I'll get back to it at the end of the month

@arturbosch
Copy link
Member

If you have a test instance of Sonarqube, please take a look at a prerelease of 2.6.0 (https://github.com/detekt/sonar-detekt/releases/tag/2.6.0-RC1) which comes with detekt 1.23.1.

@SammyJankis
Copy link
Contributor Author

ey sorry for the delay answering, we are having some problems testing it because it requires at least SonarQube 9.9.

2023.09.26 10:27:17 WARN web[][o.s.c.a.AnnotationConfigApplicationContext] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdk.internal.loader.ClassLoaders$AppClassLoader@6a6824be-org.sonar.server.plugins.ServerPluginManager': Initialization of bean failed; nested exception is Plugin detekt [detekt] requires at least SonarQube 9.9
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdk.internal.loader.ClassLoaders$AppClassLoader@6a6824be-org.sonar.server.plugins.ServerPluginManager': Initialization of bean failed; nested exception is Plugin detekt [detekt] requires at least SonarQube 9.9

@SammyJankis
Copy link
Contributor Author

btw why this requirement of 9.9 minimal version @arturbosch ?

@SammyJankis
Copy link
Contributor Author

SammyJankis commented Oct 6, 2023

Maybe a more feasible solution instead of keep updating detekt could be to apply something like this : https://github.com/detekt/detekt-intellij-plugin/pull/103/commits

@VenomVendor
Copy link

Is there a way to update the rules from outside the plugin?

I've more errors, note TwitterCompose

> Run failed with 53 invalid config properties.
        - Property 'config>checkExhaustiveness' is misspelled or does not exist.
        - Property 'comments>KDocReferencesNonPublicProperty' is misspelled or does not exist.
        - Property 'comments>OutdatedDocumentation>allowParamOnConstructorProperties' is misspelled or does not exist.
        - Property 'comments>UndocumentedPublicClass>searchInProtectedClass' is misspelled or does not exist.
        - Property 'comments>UndocumentedPublicFunction>searchProtectedFunction' is misspelled or does not exist.
        - Property 'comments>UndocumentedPublicProperty>searchProtectedProperty' is misspelled or does not exist.
        - Property 'complexity>CognitiveComplexMethod' is misspelled or does not exist.
        - Property 'complexity>ComplexInterface>ignoreOverloaded' is misspelled or does not exist.
        - Property 'complexity>CyclomaticComplexMethod' is misspelled or does not exist.
        - Property 'complexity>NamedArguments>ignoreArgumentsMatchingNames' is misspelled or does not exist.
        - Property 'complexity>NestedScopeFunctions' is misspelled or does not exist.
        - Property 'coroutines>SuspendFunSwallowedCancellation' is misspelled or does not exist.
        - Property 'coroutines>SuspendFunWithCoroutineScopeReceiver' is misspelled or does not exist.
        - Property 'naming>InvalidPackageDeclaration>requireRootInDeclaration' is misspelled or does not exist.
        - Property 'performance>CouldBeSequence' is misspelled or does not exist.
        - Property 'performance>UnnecessaryPartOfBinaryExpression' is misspelled or does not exist.
        - Property 'potential-bugs>CastNullableToNonNullableType' is misspelled or does not exist.
        - Property 'potential-bugs>DoubleMutabilityForCollection>mutableTypes' is misspelled or does not exist.
        - Property 'potential-bugs>ElseCaseInsteadOfExhaustiveWhen' is misspelled or does not exist.
        - Property 'potential-bugs>IgnoredReturnValue>restrictToConfig' is misspelled or does not exist.
        - Property 'potential-bugs>IgnoredReturnValue>returnValueTypes' is misspelled or does not exist.
        - Property 'potential-bugs>IgnoredReturnValue>ignoreFunctionCall' is misspelled or does not exist.
        - Property 'potential-bugs>NullCheckOnMutableProperty' is misspelled or does not exist.
        - Property 'potential-bugs>PropertyUsedBeforeDeclaration' is misspelled or does not exist.
        - Property 'potential-bugs>UnnecessaryNotNullCheck' is misspelled or does not exist.
        - Property 'style>AlsoCouldBeApply' is misspelled or does not exist.
        - Property 'style>BracesOnIfStatements' is misspelled or does not exist.
        - Property 'style>BracesOnWhenStatements' is misspelled or does not exist.
        - Property 'style>CanBeNonNullable' is misspelled or does not exist.
        - Property 'style>CascadingCallWrapping' is misspelled or does not exist.
        - Property 'style>DataClassContainsFunctions>allowOperators' is misspelled or does not exist.
        - Property 'style>DoubleNegativeLambda' is misspelled or does not exist.
        - Property 'style>ForbiddenAnnotation' is misspelled or does not exist.
        - Property 'style>ForbiddenComment>comments' is misspelled or does not exist.
        - Property 'style>ForbiddenSuppress' is misspelled or does not exist.
        - Property 'style>MaxChainedCallsOnSameLine' is misspelled or does not exist.
        - Property 'style>MaxLineLength>excludeRawStrings' is misspelled or does not exist.
        - Property 'style>MultilineRawStringIndentation' is misspelled or does not exist.
        - Property 'style>NullableBooleanCheck' is misspelled or does not exist.
        - Property 'style>StringShouldBeRawString' is misspelled or does not exist.
        - Property 'style>TrimMultilineRawString' is misspelled or does not exist.
        - Property 'style>UnderscoresInNumericLiterals>allowNonStandardGrouping' is misspelled or does not exist.
        - Property 'style>UnnecessaryBackticks' is misspelled or does not exist.
        - Property 'style>UnnecessaryBracesAroundTrailingLambda' is misspelled or does not exist.
        - Property 'style>UnnecessaryInnerClass' is misspelled or does not exist.
        - Property 'style>UnnecessaryParentheses>allowForUnclearPrecedence' is misspelled or does not exist.
        - Property 'style>UnusedParameter' is misspelled or does not exist.
        - Property 'style>UnusedPrivateProperty' is misspelled or does not exist.
        - Property 'style>UseIfInsteadOfWhen>ignoreWhenContainingVariableDeclaration' is misspelled or does not exist.
        - Property 'style>UseLet' is misspelled or does not exist.
        - Property 'style>UseSumOfInsteadOfFlatMapSize' is misspelled or does not exist.
        - Property 'style>VarCouldBeVal>ignoreLateinitVar' is misspelled or does not exist.
        - Property 'TwitterCompose' is misspelled or does not exist.

@VenomVendor
Copy link

We're already using detekt on the client side and passing the report through sonar.kotlin.detekt.reportPaths, this is enough for us. But some projects needs this plugin. Can this be disabled with a flag?

@VenomVendor
Copy link

I was able to overcome the build failure by removing detekt.sonar.kotlin.config.path property

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants