Skip to content
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

CheckStyle doesnt work with Mypy extension or on lower versions #331

Open
pitris90 opened this issue Mar 9, 2022 · 11 comments
Open

CheckStyle doesnt work with Mypy extension or on lower versions #331

pitris90 opened this issue Mar 9, 2022 · 11 comments

Comments

@pitris90
Copy link

pitris90 commented Mar 9, 2022

Checkstyle messages me this: {"message":"LineLength is not allowed as a child in Checker"}.... It worked with this xml on my main computer and i think even on this one...

the important part of XML file looks like this:
image

Language support extension for Java by RedHat writes this:
[Error - 1:08:15] 9. 3. 2022 1:08:15 Problems occurred when invoking code from plug-in: "org.eclipse.jdt.ls.core".
null
java.lang.reflect.InvocationTargetException
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 com.shengchen.checkstyle.runner.DelegateCommandHandler.executeCommand(DelegateCommandHandler.java:58)
at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler$1.run(WorkspaceExecuteCommandHandler.java:215)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler.executeCommand(WorkspaceExecuteCommandHandler.java:205)
at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$4(JDTLanguageServer.java:507)
at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:75)
at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture$Completion.exec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: LineLength is not allowed as a child in Checker
at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:493)
at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:198)
at com.shengchen.checkstyle.checker.CheckerService.setConfiguration(CheckerService.java:67)
at com.shengchen.checkstyle.runner.DelegateCommandHandler.setConfiguration(DelegateCommandHandler.java:79)
... 17 more

[Error - 1:08:15] 9. 3. 2022 1:08:15 Error in calling delegate command handler
null
java.lang.reflect.InvocationTargetException
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 com.shengchen.checkstyle.runner.DelegateCommandHandler.executeCommand(DelegateCommandHandler.java:58)
at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler$1.run(WorkspaceExecuteCommandHandler.java:215)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler.executeCommand(WorkspaceExecuteCommandHandler.java:205)
at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$4(JDTLanguageServer.java:507)
at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:75)
at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture$Completion.exec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: LineLength is not allowed as a child in Checker
at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:493)
at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:198)
at com.shengchen.checkstyle.checker.CheckerService.setConfiguration(CheckerService.java:67)
at com.shengchen.checkstyle.runner.DelegateCommandHandler.setConfiguration(DelegateCommandHandler.java:79)
... 17 more

And when I switch Checkstyle version on 10 (where it was originally), it writes this: {"message":"com/puppycrawl/tools/checkstyle/api/AuditListener","cause":{"message":"com.puppycrawl.tools.checkstyle.api.AuditListener"}}

And this in Java Support extension:

Caused by: java.lang.NoClassDefFoundError: com/puppycrawl/tools/checkstyle/api/AuditListener
at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.base/java.lang.Class.getConstructor0(Unknown Source)
at java.base/java.lang.Class.getConstructor(Unknown Source)
at com.shengchen.checkstyle.runner.CheckstyleLoader.loadCheckerService(CheckstyleLoader.java:49)
at com.shengchen.checkstyle.runner.DelegateCommandHandler.setConfiguration(DelegateCommandHandler.java:75)
... 17 more
Caused by: java.lang.ClassNotFoundException: com.puppycrawl.tools.checkstyle.api.AuditListener
at java.base/java.net.URLClassLoader.findClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
... 23 more

[Error - 1:21:00] 9. 3. 2022 1:21:00 Error in calling delegate command handler
null
java.lang.reflect.InvocationTargetException
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 com.shengchen.checkstyle.runner.DelegateCommandHandler.executeCommand(DelegateCommandHandler.java:58)
at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler$1.run(WorkspaceExecuteCommandHandler.java:215)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler.executeCommand(WorkspaceExecuteCommandHandler.java:205)
at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$4(JDTLanguageServer.java:507)
at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:75)
at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture$Completion.exec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: com/puppycrawl/tools/checkstyle/api/AuditListener
at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.base/java.lang.Class.getConstructor0(Unknown Source)
at java.base/java.lang.Class.getConstructor(Unknown Source)
at com.shengchen.checkstyle.runner.CheckstyleLoader.loadCheckerService(CheckstyleLoader.java:49)
at com.shengchen.checkstyle.runner.DelegateCommandHandler.setConfiguration(DelegateCommandHandler.java:75)
... 17 more
Caused by: java.lang.ClassNotFoundException: com.puppycrawl.tools.checkstyle.api.AuditListener
at java.base/java.net.URLClassLoader.findClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
... 23 more

@pitris90
Copy link
Author

pitris90 commented Mar 9, 2022

EDIT: I found a problem... I remembered that I recently installed also Mypy extension for handling Mypy for Python. And as you can see there is some weird conflict. I solved it by turning off Mypy extension for my Java workspace

@jdneo
Copy link
Owner

jdneo commented Mar 9, 2022

sounds wired, I'm trying to understand why a Python extension could affect Java ones. 🤔

@jdneo
Copy link
Owner

jdneo commented Mar 9, 2022

And one more thing: checkstyle rules differs from different checkstyle version. You need to make sure the version and your rules are compatibale

@pitris90
Copy link
Author

pitris90 commented Mar 9, 2022

There is an option called: Mypy: Run Using Active Interpreter
Use the active Python interpreter (selected in the Python extension) to run dmypy itself, instead of the mypy.dmypyExecutable setting. Note: your code is always checked against the active interpreter – this setting only controls the interpreter used to run dmypy itself.

I had it set to True, because on False it didnt work on my Python files and this option when it is set to True seems to be a problem

@pitris90
Copy link
Author

pitris90 commented Mar 9, 2022

And one more thing: checkstyle rules differs from different checkstyle version. You need to make sure the version and your rules are compatibale

I simply have to use latest version - 10 - otherwise plugin has some problems too

@jdneo
Copy link
Owner

jdneo commented Mar 9, 2022

I had it set to True, because on False it didnt work on my Python files and this option when it is set to True seems to be a problem

But you are using Checkstyle to check your Java code right? I cannot understand my the Python's setting would affect that.

@pitris90
Copy link
Author

pitris90 commented Mar 9, 2022

I had it set to True, because on False it didnt work on my Python files and this option when it is set to True seems to be a problem

But you are using Checkstyle to check your Java code right? I cannot understand my the Python's setting would affect that.

Of course :D But that Python extension was enabled too and with that setting it caused this weird conflict. I don't understand it either... You can take a look on it, its Mypy extension ->
image

And try to turn that mentioned setting to on

@pitris90
Copy link
Author

pitris90 commented Mar 9, 2022

But there is still this message when i set checkstyle version on 8.43 for example (In IntelliJ it works with this version too): {"message":"com/puppycrawl/tools/checkstyle/api/AuditListener","cause":{"message":"com.puppycrawl.tools.checkstyle.api.AuditListener"}}

@pitris90 pitris90 changed the title CheckStyle doesnt work with my configuration xml file CheckStyle doesnt work with Mypy extension or on lower versions Mar 9, 2022
@jdneo
Copy link
Owner

jdneo commented Mar 10, 2022

Would you mind to share a sample project?

@pitris90
Copy link
Author

pitris90 commented Mar 12, 2022

Would you mind to share a sample project?

For fixing that message i mentioned above? Because this speccifically is my school project which, I am afraid, I can't share 😄

@pitris90
Copy link
Author

Would you mind to share a sample project?

^
|

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

No branches or pull requests

2 participants