All files are still parsed by check style parser even if there is none of any activated checkstyle rule?

Env:

SonarQube 8.4
SonarQube Scanner 4.2.0.1873
Java 11.0.3 AdoptOpenJDK (64-bit)
Windows 10 10.0 amd64

First of all, My default Quality Profile doesn’t have any rules from Checkstyle repository. None of any these rules is activated.

Then, I run scanner manually, the following is the detail log. I can understand why it is failed.

There is some special characters in the comment line in one specific java source file. And the com.puppycrawl.tools.checkstyle.JavaParser failed to parse it. (After deleting those characters, the whole execution is success)

My question is Why the parser is still executed if none related rules activated?


E:\download\1216\eipis-user>D:\tools\sonar-scanner-4.2.0.1873-windows\bin\sonar-scanner.bat -Dsonar.projectKey=finance:eipis-user:FIN-11727 -Dsonar.projectName=finance:eipis-user:FIN-11727   -Dsonar.sourceEncoding=UTF-8 -Dsonar.host.url=http://10.112.78.174:9000 -Dsonar.login=c0daf42489939f83e513055af2c64bd92dae3bc1 -Dsonar.projectVersion=FIN-11727   -Dsonar.java.binaries=. -Dsonar.language=java -Dsonar.java.source=1.8  
INFO: Scanner configuration file: D:\tools\sonar-scanner-4.2.0.1873-windows\bin\..\conf\sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarQube Scanner 4.2.0.1873
INFO: Java 11.0.3 AdoptOpenJDK (64-bit)
INFO: Windows 10 10.0 amd64
INFO: User cache: C:\Users\joechin\.sonar\cache
INFO: SonarQube server 8.4.2
INFO: Default locale: "zh_CN", source code encoding: "UTF-8"
INFO: Load global settings
INFO: Load global settings (done) | time=53ms
INFO: Server id: 9CFC3560-AXNvfctKgKTBb8pQWi8a
INFO: User cache: C:\Users\joechin\.sonar\cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=32ms
INFO: Plugin [l10nzh] defines 'l10nen' as base plugin. This metadata can be removed from manifest of l10n plugins since version 5.2.
INFO: Load/download plugins (done) | time=84ms
INFO: Process project properties
INFO: Process project properties (done) | time=6ms
INFO: Execute project builders
INFO: Execute project builders (done) | time=4ms
INFO: Project key: finance:eipis-user:FIN-11727
INFO: Base dir: E:\download\1216\eipis-user
INFO: Working dir: E:\download\1216\eipis-user\.scannerwork
INFO: Load project settings for component key: 'finance:eipis-user:FIN-11727'
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=52ms
INFO: Load active rules
INFO: Load active rules (done) | time=650ms
INFO: Indexing files...
INFO: Project configuration:
INFO:   Excluded sources: **/*.png, **/*.gz, **/*.avro, **/*.ico, **/*.jpg, **/*Test*, **/*test*, **/*.css, **/vendor/**, **/*OuterClass.java, **/*.scss, **/R.java, **/*.xml, **/document/**, **/protobuf/**, **/entity/**, **/vo/**, **/model/**, **/dto/**, **/util/**, **/enums/**, **/mapper/**, **/filter/**, **/listener/**, **/config/**, **/exception/**, **/staging/**, **/node_modules/**, **/*.ts, **/*.tsx
INFO:   Excluded sources for coverage: **/entity/**, **/vo/**, **/model/**, **/dto/**, **/util/**, **/enums/**, **/mapper/**, **/filter/**, **/listener/**, **/config/**, **/common/**, **/exception/**, **/starter/**, **/scheduler/**, **/facade/**, **/dao/**, **/constant/**, **/nr/**/config/**, **/nr/**/components/**, **/nr/**/controller/**, **/nr/**/api/**, **/nr/**/dao/**, **/nr/**/model/**, **/nr/**/vars/**, **/nr/**/enums/**, **/nr/**/dto/**, **/nr/**/vo/**, **/nr/**/exception/**
INFO:   Excluded sources for duplication: **/maodou/**/log/**, **/maodou/**/utils/**, **/maodou/**/util/**, **/xinche/**/log/**, **/xinche/**/utils/**, **/xinche/**/util/**
INFO: 672 files indexed
INFO: 893 files ignored because of inclusion/exclusion patterns
INFO: 0 files ignored because of scm ignore settings
INFO: Quality profile for java: Sonar-android
INFO: Quality profile for web: Sonar way
INFO: ------------- Run sensors on module finance:eipis-user:FIN-11727
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=25ms
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by net.sf.cglib.core.ReflectUtils$1 (file:/C:/Users/joechin/.sonar/cache/52f5340dd05620cd162e2b9a45a57124/sonar-javascript-plugin.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of net.sf.cglib.core.ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
INFO: Sensor MySensor [javacustom]
INFO: Sensor MySensor [javacustom] (done) | time=2ms
INFO: Sensor JavaSquidSensor [java]
INFO: Configured Java source version (sonar.java.source): 8
INFO: JavaClasspath initialization
WARN: Bytecode of dependencies was not provided for analysis of source files, you might end up with less precise results. Bytecode can be provided using sonar.java.libraries property.
INFO: JavaClasspath initialization (done) | time=8ms
INFO: JavaTestClasspath initialization
INFO: JavaTestClasspath initialization (done) | time=1ms
INFO: Java Main Files AST scan
INFO: 627 source files to be analyzed
INFO: Load project repositories
INFO: Load project repositories (done) | time=8ms
WARN: locking FileBasedConfig[C:\Users\joechin\.config\jgit\config] failed after 5 retries
INFO: 229/627 files analyzed, current file: service/src/main/java/com/guazi/finance/eipis/user/service/va/impl/ValueAddedServiceImpl.java
INFO: 627/627 source files have been analyzed
INFO: Java Main Files AST scan (done) | time=19560ms
INFO: Java Test Files AST scan
INFO: 0 source files to be analyzed
INFO: Java Test Files AST scan (done) | time=1ms
INFO: Java Generated Files AST scan
INFO: 0 source files to be analyzed
INFO: 0/0 source files have been analyzed
INFO: Java Generated Files AST scan (done) | time=1ms
INFO: 0/0 source files have been analyzed
INFO: Sensor JavaSquidSensor [java] (done) | time=19669ms
INFO: Sensor SonarCSS Rules [cssfamily]
INFO: 26 source files to be analyzed
INFO: 26/26 source files have been analyzed
INFO: Sensor SonarCSS Rules [cssfamily] (done) | time=4249ms
INFO: Sensor PmdSensor [pmd]
INFO: Sensor PmdSensor [pmd] (done) | time=0ms
INFO: Sensor EndSensor [javacustom]
INFO: Sensor EndSensor [javacustom] (done) | time=1ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
WARN: No coverage report can be found with sonar.coverage.jacoco.xmlReportPaths='ut/target/site/jacoco-aggregate/jacoco.xml'. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=5ms
INFO: Sensor SurefireSensor [java]
INFO: parsing [E:\download\1216\eipis-user\target\surefire-reports]
INFO: Sensor SurefireSensor [java] (done) | time=1ms
INFO: Sensor JavaXmlSensor [java]
INFO: Sensor JavaXmlSensor [java] (done) | time=3ms
INFO: Sensor HTML [web]
INFO: Sensor HTML [web] (done) | time=237ms
INFO: Sensor CheckstyleSensor [checkstyle]
INFO: Checkstyle output report: E:\download\1216\eipis-user\.scannerwork\checkstyle-result.xml
INFO: Checkstyle configuration: E:\download\1216\eipis-user\.scannerwork\checkstyle.xml
INFO: Checkstyle charset: UTF-8
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 30.950s
INFO: Final Memory: 23M/108M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
java.lang.IllegalStateException: Can not execute Checkstyle
        at org.sonar.plugins.checkstyle.CheckstyleExecutor.executeWithClassLoader(CheckstyleExecutor.java:110)
        at org.sonar.plugins.checkstyle.CheckstyleExecutor.execute(CheckstyleExecutor.java:78)
        at org.sonar.plugins.checkstyle.CheckstyleSensor.execute(CheckstyleSensor.java:42)
        at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
        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.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
        at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:388)
        at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:384)
        at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:353)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
        at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:144)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
        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(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
        at com.sun.proxy.$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)
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Exception was thrown while processing E:\download\1216\eipis-user\service\src\main\java\com\democom\finance\eipis\user\service\impl\UserServiceImpl.java
        at com.puppycrawl.tools.checkstyle.Checker.processFiles(Checker.java:311)
        at com.puppycrawl.tools.checkstyle.Checker.process(Checker.java:221)
        at org.sonar.plugins.checkstyle.CheckstyleExecutor.executeWithClassLoader(CheckstyleExecutor.java:103)
        ... 32 more
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: IllegalStateException occurred while parsing file E:\download\1216\eipis-user\service\src\main\java\com\democom\finance\eipis\user\service\impl\UserServiceImpl.java.
        at com.puppycrawl.tools.checkstyle.JavaParser.parse(JavaParser.java:120)
        at com.puppycrawl.tools.checkstyle.TreeWalker.processFiltered(TreeWalker.java:149)
        at com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck.process(AbstractFileSetCheck.java:87)
        at com.puppycrawl.tools.checkstyle.Checker.processFile(Checker.java:337)
        at com.puppycrawl.tools.checkstyle.Checker.processFiles(Checker.java:298)
        ... 34 more
Caused by: java.lang.IllegalStateException: E:\download\1216\eipis-user\service\src\main\java\com\democom\finance\eipis\user\service\impl\UserServiceImpl.java:790:1: expecting RCURLY, found 'null'
        at com.puppycrawl.tools.checkstyle.JavaParser$1.reportError(JavaParser.java:108)
        at com.puppycrawl.tools.checkstyle.grammar.GeneratedJavaRecognizer.typeDefinition(GeneratedJavaRecognizer.java:424)
        at com.puppycrawl.tools.checkstyle.grammar.GeneratedJavaRecognizer.compilationUnit(GeneratedJavaRecognizer.java:212)
        at com.puppycrawl.tools.checkstyle.JavaParser.parse(JavaParser.java:114)
        ... 38 more
Caused by: E:\download\1216\eipis-user\service\src\main\java\com\democom\finance\eipis\user\service\impl\UserServiceImpl.java:790:1: expecting RCURLY, found 'null'
        at antlr.Parser.match(Parser.java:211)
        at com.puppycrawl.tools.checkstyle.grammar.GeneratedJavaRecognizer.compoundStatement(GeneratedJavaRecognizer.java:4555)
        at com.puppycrawl.tools.checkstyle.grammar.GeneratedJavaRecognizer.field(GeneratedJavaRecognizer.java:3158)
        at com.puppycrawl.tools.checkstyle.grammar.GeneratedJavaRecognizer.classBlock(GeneratedJavaRecognizer.java:3415)
        at com.puppycrawl.tools.checkstyle.grammar.GeneratedJavaRecognizer.classDefinition(GeneratedJavaRecognizer.java:646)
        at com.puppycrawl.tools.checkstyle.grammar.GeneratedJavaRecognizer.typeDefinitionInternal(GeneratedJavaRecognizer.java:561)
        at com.puppycrawl.tools.checkstyle.grammar.GeneratedJavaRecognizer.typeDefinition(GeneratedJavaRecognizer.java:402)
        ... 40 more
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.

E:\download\1216\eipis-user>

I tried to follow up the stack info, but it is too complicated for me right now:(

Any brief up about this execution will be highly appreciated.

Is there anyway to deactivate the check by so-called CheckstyleSensor?

Hey there.

I’d go ask over at checkstyle/sonar-checkstyle – they support this plugin.

I think You miss my point. Actually, I prefer not to run this plugin.

Why is it still executed if I don’t activate any rule about it?

In my case, I didn’t want any style check, I thought this parse-error shouldn’t fail the whoel execution.

If you prefer not to run it – I suggest uninstalling it!

If it runs when you don’t want it to/fails in a way you think it shouldn’t, you should get in touch with the maintainers (plugin code determines when it runs and how it fails)

You are right. After uninstalling the plugin, the same execution succeed.


As long as you install a plugin, which is checkstyle-sonar-plugin-8.37.jar in my case, even if you don’t active any related rule, some related logic, which I’m not sure which is which, will still be executed.

So the best choose is just to uninstall it.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.