-
Notifications
You must be signed in to change notification settings - Fork 70
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
java.lang.IllegalStateException: Can not execute Checkstyle #516
Comments
This is a checkstyle issue, not a sonar checkstyle issue. Either your Java file is not compilable or it has syntax which Checkstyle doesn't currently support. If it is not a compile issue, then I recommend checking if Checkstyle has a issue on it. In the meantime, you can exclude the file from processing by using https://checkstyle.org/filefilters/beforeexecutionexclusionfilefilter.html#BeforeExecutionExclusionFileFilter . |
Thanks for the information. Can you please let me know where I should add those Filter details to exclude file from processing. Thank you. |
this will help checkstyle/checkstyle#12542 when we get a fix |
Hi,
I see that the following has been given as workaround in the link that you
provided.
*<module name="Checker">*
* <property name="haltOnException" value="false"/>*
* <module name="SuppressionSingleFilter">*
* <property name="message" value=".*IllegalStateException occurred while
parsing file.*"/>*
* </module>*
Also, in the initial response you have given the following property to be
added:
<module name="Checker">
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="module\-info\.java$"/>
</module>
</module>
Can you confirm whether both the solutions work
inorder to skip the checkstyle on my files.
Also let me know where should i add these, I mean under
Which file i need to add?
....
…On Thu, 11 Apr 2024, 18:51 Roman Ivanov, ***@***.***> wrote:
this will help checkstyle/checkstyle#12542
<checkstyle/checkstyle#12542> when we get a fix
—
Reply to this email directly, view it on GitHub
<#516 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ASBZQTOLUWOBL7WWSICVKETY42E47AVCNFSM6AAAAABGAIFKV2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBZGY4DEMBWGQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
workaround is at checkstyle/checkstyle#12542 (comment) attention to location of Filter, it should be before TreeWalker. |
Sonar version: 9.9.1
Checkstyle sonar plugin version: 10.9.3
I have recently upgraded to this version of sonar and checkstyle check is being executed on my code. In console output it shows an error as follows:
06:48:43 06:48:43.253 ERROR: Error during SonarScanner execution
06:48:43 java.lang.IllegalStateException: Can not execute Checkstyle
06:48:43 at org.sonar.plugins.checkstyle.CheckstyleExecutor.executeWithClassLoader(CheckstyleExecutor.java:113)
......................
06:48:43 Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Exception was thrown while processing xyz.java
......................
06:48:43 Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: IllegalStateException occurred while parsing file xyz.java
.....................
06:48:43 Caused by: java.lang.IllegalStateException: 1:7: no viable alternative at input 'void'
06:48:43 at com.puppycrawl.tools.checkstyle.JavaParser$CheckstyleErrorListener.syntaxError(JavaParser.java:255)
......................
06:48:43 Caused by: org.antlr.v4.runtime.NoViableAltException
Can you please let me know, what this error is about. What are the ways to overcome this and also can you please let me know is it possible to disable or remove these kind of checkstyle checks? If yes, how to do that.
Thank you.
The text was updated successfully, but these errors were encountered: