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

Make PMD check a configurable inspection (real-time scan) #134

Open
uhafner opened this issue Mar 28, 2023 · 7 comments
Open

Make PMD check a configurable inspection (real-time scan) #134

uhafner opened this issue Mar 28, 2023 · 7 comments

Comments

@uhafner
Copy link

uhafner commented Mar 28, 2023

I'm not sure if inspection is the correct naming, but the Checkstyle IntelliJ plugin registered its checks as an IntelliJ Inspection.

Bildschirm­foto 2023-03-28 um 11 47 21

It would be very helpful if the same approach would be available by the PMD plugin. Then there would be a single entry point for static analysis tools and PMD will be running automatically during the development cycle (if configured so). Currently I need to manually run PMD using the context menu, it would be much simpler if the PMD checks would run automatically with the set of configured inspections.

Bildschirm­foto 2023-03-28 um 11 50 40

@martenbohlin
Copy link
Contributor

I am looking into this issue, will probably not be a inspector but will still mark problematic lines in the editor when you edit files.

martenbohlin added a commit to martenbohlin/PMD-Intellij that referenced this issue Oct 15, 2023
martenbohlin added a commit to martenbohlin/PMD-Intellij that referenced this issue Oct 17, 2023
amitdev added a commit that referenced this issue Nov 1, 2023
Show annotations in editor, and allow quick-fix to surpress. Issue #134
@sashokbg
Copy link
Contributor

Hello I see the #152 has been merged but I cannot see any "realtime checks" in my intellij having the latest version installed. Am I missing something ? @amitdev

@sashokbg
Copy link
Contributor

I checked-out the latest version of the plugin and installed from zip file locally and I encounter some exception:

Any ideas ?

ExternalToolPass:

com.intellij.diagnostic.PluginException: annotator: com.intellij.plugins.bodhi.pmd.annotator.PMDExternalAnnotator@5849ccc (class com.intellij.plugins.bodhi.pmd.annotator.PMDExternalAnnotator) [Plugin: PMDPlugin]
at com.intellij.diagnostic.PluginProblemReporterImpl.createPluginExceptionByClass(PluginProblemReporterImpl.java:23)
at com.intellij.diagnostic.PluginException.createByClass(PluginException.java:89)
at com.intellij.codeInsight.daemon.impl.ExternalToolPass.processError(ExternalToolPass.java:251)
at com.intellij.codeInsight.daemon.impl.ExternalToolPass.doAnnotate(ExternalToolPass.java:210)
at com.intellij.codeInsight.daemon.impl.ExternalToolPass.doAnnotate(ExternalToolPass.java:201)
at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.lambda$run$0(ExternalToolPass.java:164)
at com.intellij.codeInsight.daemon.impl.ExternalToolPass.runChangeAware(ExternalToolPass.java:266)
at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.lambda$run$2(ExternalToolPass.java:164)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:186)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:604)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:679)
at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:635)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:603)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:61)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:173)
at com.intellij.openapi.progress.util.BackgroundTaskUtil.runUnderDisposeAwareIndicator(BackgroundTaskUtil.java:360)
at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.run(ExternalToolPass.java:162)
at com.intellij.util.ui.update.Update.runUpdate(Update.java:114)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:348)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:338)
at com.intellij.util.ui.update.MergingUpdateQueue.doFlush(MergingUpdateQueue.java:295)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:277)
at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:246)
at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:254)
at com.intellij.util.Alarm$Request.runSafely(Alarm.java:373)
at com.intellij.util.Alarm$Request.run(Alarm.java:360)
at com.intellij.util.concurrency.Propagation.contextAwareCallable$lambda$2(propagation.kt:328)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at com.intellij.util.concurrency.SchedulingWrapper$MyScheduledFutureTask.run(SchedulingWrapper.java:272)
at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:249)
at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:31)
at com.intellij.util.concurrency.BoundedTaskExecutor$1.executeFirstTaskAndHelpQueue(BoundedTaskExecutor.java:227)
at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:218)
at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:215)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.UnsupportedOperationException: Failed to map LightVirtualFile: /fragment.java (filesystem com.intellij.testFramework.LightVirtualFileBase$MyVirtualFileSystem@6ad346fa) into nio Path
at com.intellij.openapi.vfs.VirtualFile.toNioPath(VirtualFile.java:164)
at com.intellij.plugins.bodhi.pmd.annotator.FileInfo.getFile(FileInfo.java:24)
at com.intellij.plugins.bodhi.pmd.annotator.PMDExternalAnnotator.doAnnotate(PMDExternalAnnotator.java:37)
at com.intellij.plugins.bodhi.pmd.annotator.PMDExternalAnnotator.doAnnotate(PMDExternalAnnotator.java:21)
at com.intellij.codeInsight.daemon.impl.ExternalToolPass.doAnnotate(ExternalToolPass.java:207)
... 37 more

@sashokbg
Copy link
Contributor

I managed to make it work with a custom ruleset.xml but for some reason I cannot make it work with the pre-defined rulesets

@sashokbg
Copy link
Contributor

Hello, I have opened #154 that fixes some issues and improves performance by sending all rulesets at once to the PMD engine instead of iterating over each one

@martenbohlin
Copy link
Contributor

I checked-out the latest version of the plugin and installed from zip file locally and I encounter some exception:

Any ideas ?

ExternalToolPass:
com.intellij.diagnostic.PluginException: annotator: com.intellij.plugins.bodhi.pmd.annotator.PMDExternalAnnotator@5849ccc (class com.intellij.plugins.bodhi.pmd.annotator.PMDExternalAnnotator) [Plugin: PMDPlugin]
at com.intellij.diagnostic.PluginProblemReporterImpl.createPluginExceptionByClass(PluginProblemReporterImpl.java:23)
at com.intellij.diagnostic.PluginException.createByClass(PluginException.java:89)
at com.intellij.codeInsight.daemon.impl.ExternalToolPass.processError(ExternalToolPass.java:251)
at com.intellij.codeInsight.daemon.impl.ExternalToolPass.doAnnotate(ExternalToolPass.java:210)
at com.intellij.codeInsight.daemon.impl.ExternalToolPass.doAnnotate(ExternalToolPass.java:201)
at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.lambda$run$0(ExternalToolPass.java:164)
at com.intellij.codeInsight.daemon.impl.ExternalToolPass.runChangeAware(ExternalToolPass.java:266)
at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.lambda$run$2(ExternalToolPass.java:164)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:186)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:604)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:679)
at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:635)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:603)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:61)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:173)
at com.intellij.openapi.progress.util.BackgroundTaskUtil.runUnderDisposeAwareIndicator(BackgroundTaskUtil.java:360)
at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.run(ExternalToolPass.java:162)
at com.intellij.util.ui.update.Update.runUpdate(Update.java:114)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:348)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:338)
at com.intellij.util.ui.update.MergingUpdateQueue.doFlush(MergingUpdateQueue.java:295)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:277)
at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:246)
at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:254)
at com.intellij.util.Alarm$Request.runSafely(Alarm.java:373)
at com.intellij.util.Alarm$Request.run(Alarm.java:360)
at com.intellij.util.concurrency.Propagation.contextAwareCallable$lambda$2(propagation.kt:328)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at com.intellij.util.concurrency.SchedulingWrapper$MyScheduledFutureTask.run(SchedulingWrapper.java:272)
at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:249)
at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:31)
at com.intellij.util.concurrency.BoundedTaskExecutor$1.executeFirstTaskAndHelpQueue(BoundedTaskExecutor.java:227)
at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:218)
at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:215)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.UnsupportedOperationException: Failed to map LightVirtualFile: /fragment.java (filesystem com.intellij.testFramework.LightVirtualFileBase$MyVirtualFileSystem@6ad346fa) into nio Path
at com.intellij.openapi.vfs.VirtualFile.toNioPath(VirtualFile.java:164)
at com.intellij.plugins.bodhi.pmd.annotator.FileInfo.getFile(FileInfo.java:24)
at com.intellij.plugins.bodhi.pmd.annotator.PMDExternalAnnotator.doAnnotate(PMDExternalAnnotator.java:37)
at com.intellij.plugins.bodhi.pmd.annotator.PMDExternalAnnotator.doAnnotate(PMDExternalAnnotator.java:21)
at com.intellij.codeInsight.daemon.impl.ExternalToolPass.doAnnotate(ExternalToolPass.java:207)
... 37 more

I think PR #155 fixes this issue, but I have not found how to reproduce, so I am not sure.

@SoulOfSet
Copy link

Just curious on the status of this?

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

4 participants