[ANN] CheckStyle IDEA 1.0

Good afternoon,

CheckStyle-IDEA 1.0 has been released. This plugin provides CheckStyle integration for IDEA and, at long last, should now have all the basic features required for it to be useful.

Among the many changes are:
- New: Static scanning for current module implemented.
- New: Ability to add third-party checks.
- New: Ability to define external properties.
- New: Now works with IDEA 7M1.
- Fixed: Exceptions defined in project will no longer generate
a CheckStyle error once they have been compiled.

Source code and bug tracking are available at http://code.google.com/p/checkstyle-idea/

Suggestions, brickbats, bouquets or plain old bug reports are all welcomed.

Cheers,
James

0
9 comments

CheckStyle IDEA by infernus.org.

Nomen est omen?

Editing the Checkstyle settings shuts down IDEA.

Stack trace in idea.log:

2007-04-16 09:55:36,250 ERROR - ij.components.ComponentManager -
java.lang.IllegalStateException: Cannot find project base directory.
at org.infernus.idea.checkstyle.CheckStylePlugin.getProjectPath(CheckStylePlugin.java:121)
at org.infernus.idea.checkstyle.CheckStylePlugin.]]>(CheckStylePlugin.java:163)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at org.picocontainer.defaults.InstantiatingComponentAdapter.newInstance(InstantiatingComponentAdapter.java:193)
at org.picocontainer.defaults.ConstructorInjectionComponentAdapter$1.run(ConstructorInjectionComponentAdapter.java:220)
at org.picocontainer.defaults.ThreadLocalCyclicDependencyGuard.observe(ThreadLocalCyclicDependencyGuard.java:53)
at org.picocontainer.defaults.ConstructorInjectionComponentAdapter.getComponentInstance(ConstructorInjectionComponentAdapter.java:248)
at org.picocontainer.defaults.DecoratingComponentAdapter.getComponentInstance(DecoratingComponentAdapter.java:60)
at org.picocontainer.defaults.CachingComponentAdapter.getComponentInstance(CachingComponentAdapter.java:58)
at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter$1.getComponentInstance(ComponentManagerImpl.java:2)
at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter.getComponentInstance(ComponentManagerImpl.java:25)
at com.intellij.util.pico.DefaultPicoContainer.getLocalInstance(DefaultPicoContainer.java:193)
at com.intellij.util.pico.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:180)
at com.intellij.util.pico.DefaultPicoContainer.getComponentInstance(DefaultPicoContainer.java:162)
at org.picocontainer.alternatives.AbstractDelegatingMutablePicoContainer.getComponentInstance(AbstractDelegatingMutablePicoContainer.java:75)
at com.intellij.openapi.components.impl.ComponentManagerImpl.a(ComponentManagerImpl.java:86)
at com.intellij.openapi.components.impl.ComponentManagerImpl.a(ComponentManagerImpl.java:51)
at com.intellij.openapi.components.impl.ComponentManagerImpl.initComponents(ComponentManagerImpl.java:64)
at com.intellij.openapi.components.impl.ComponentManagerImpl.init(ComponentManagerImpl.java:98)
at com.intellij.openapi.project.impl.ProjectImpl.init(ProjectImpl.java:4)
at com.intellij.openapi.project.impl.ProjectManagerImpl.getDefaultProject(ProjectManagerImpl.java:158)
at com.intellij.ide.fileTemplates.impl.FileTemplateImpl.writeExternal(FileTemplateImpl.java:27)
at com.intellij.ide.fileTemplates.impl.FileTemplateManagerImpl.c(FileTemplateManagerImpl.java:94)
at com.intellij.ide.fileTemplates.impl.FileTemplateManagerImpl.writeExternal(FileTemplateManagerImpl.java:171)
at com.intellij.openapi.components.impl.stores.DefaultStateSerializer.serializeState(DefaultStateSerializer.java:1)
at com.intellij.openapi.components.impl.stores.XmlElementStorage.setState(XmlElementStorage.java:37)
at com.intellij.openapi.components.impl.stores.ComponentStoreImpl.a(ComponentStoreImpl.java:99)
at com.intellij.openapi.components.impl.stores.ComponentStoreImpl.commit(ComponentStoreImpl.java:86)
at com.intellij.openapi.components.impl.stores.ComponentStoreImpl.doSave(ComponentStoreImpl.java:82)
at com.intellij.openapi.components.impl.stores.ApplicationStoreImpl.doSave(ApplicationStoreImpl.java:11)
at com.intellij.openapi.components.impl.stores.ComponentStoreImpl.save(ComponentStoreImpl.java:5)
at com.intellij.openapi.application.impl.ApplicationImpl.saveSettings(ApplicationImpl.java:56)
at com.intellij.ide.SaveAndSyncHandler.b(SaveAndSyncHandler.java:0)
at com.intellij.ide.SaveAndSyncHandler.access$200(SaveAndSyncHandler.java:22)
at com.intellij.ide.SaveAndSyncHandler$3.onFrameDeactivated(SaveAndSyncHandler.java:4)
at com.intellij.ide.FrameStateManagerImpl.a(FrameStateManagerImpl.java:29)
at com.intellij.ide.FrameStateManagerImpl.access$100(FrameStateManagerImpl.java:33)
at com.intellij.ide.FrameStateManagerImpl$1.run(FrameStateManagerImpl.java:4)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:15)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at com.intellij.ide.IdeEventQueue.b(IdeEventQueue.java:44)
at com.intellij.ide.IdeEventQueue.a(IdeEventQueue.java:83)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:6)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
2007-04-16 09:55:36,250 ERROR - ij.components.ComponentManager - IntelliJ IDEA 7.0M1 Build #6819
2007-04-16 09:55:36,250 ERROR - ij.components.ComponentManager - JDK: 1.5.0_11
2007-04-16 09:55:36,250 ERROR - ij.components.ComponentManager - VM: Java HotSpot(TM) Client VM
2007-04-16 09:55:36,250 ERROR - ij.components.ComponentManager - Vendor: Sun Microsystems Inc.
2007-04-16 09:55:36,250 ERROR - ij.components.ComponentManager - OS: Windows XP
2007-04-16 09:55:36,250 ERROR - ij.components.ComponentManager - Last Action: CheckStyleCurrentFileAction
2007-04-16 09:55:36,250 INFO - #com.intellij.idea.Main - -


IDEA SHUTDOWN -



2007-04-16 09:55:36,250 INFO - #com.intellij.idea.Main - -


Statistics -



2007-04-16 09:55:36,265 INFO - #com.intellij.idea.Main - Internalize_hits=0
2007-04-16 09:55:36,265 INFO - #com.intellij.idea.Main - Internalize_misses=0
2007-04-16 09:55:36,265 INFO - #com.intellij.idea.Main - -


0

That will, of course, teach me to make last minute hacks.

Did you have a project loaded at the time? If so, what variety? Thanks!

0

What exactly do you mean by "variety" here? (I did have a project loaded which consisted of three Java modules and one Web module, each having a few thousand Java classes, JSPs and other fancy stuff.)

Regards,
Jens

0

Danke - that was exactly what I was interested in.

IDEA 7.0M1 has changed way you retrieve the project path from the Project API. In particular, the path may now be null, yet there's no JavaDoc supplied to say under what circumstances. It's especially odd, given it's a project-level plug-in.

In any case, the spot in the stack trace below is the logging on start-up. I've changed that, and also other callers, to handle null items. I'm just testing now, so a release shouldn't be too far away. Testing, mind, is likely to be just a sanity check as I haven't managed to reproduce it. It may not help that I don't have any large projects at home, or a Win XP box to try on...

As a side note, any issues raised on http://code.google.com/p/checkstyle-idea/issues/list are more likely to see a quick response, as I don't check this forum too often.

Apologies for the inconvenience, and thanks for letting me know.

Cheers,
James

0

I just wonder why you'd want to use CheckStyle with Idea at all.
Are there any features that Idea's built-in inspections do not handle?

0

I can only think that you'd want to use it if you want standardised inspections across multiple IDE environments, since CheckStyle appears to be supported in just about every IDE under the sun.

0

Stephen Friedrich wrote:

I just wonder why you'd want to use CheckStyle with Idea at all.
Are there any features that Idea's built-in inspections do not handle?


There might be, but that's not the reason.

The main reason is that you can call Checkstyle from your IDE, from Ant
and from Maven. This way you can have one configuration file for code
style. Then you can use it in your day-to-day work inside IDEA, in you
Ant build scripts and get a Maven report for it, both of which are
interesting if you do continuous integration.

0

Hello Dennis,

The main reason is that you can call Checkstyle from your IDE, from
Ant and from Maven. This way you can have one configuration file for
code style. Then you can use it in your day-to-day work inside IDEA,
in you Ant build scripts and get a Maven report for it, both of which
are interesting if you do continuous integration.


Well, actually you can also run IDEA's inspections from your IDE, from Ant
and from Maven. (See inspect.bat) And the report that TeamCity generates
for IDEA's server-side inspection looks really nice. :)

--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Which is all very well, except when you're in an environment where most people use Eclipse.

So, yes, you can duplicate most of it via IDEA's inspections, or standardise with IDEA, but for those of us who break the rules and use IDEA it does lend a little consistency :)

0

Please sign in to leave a comment.