Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (636)
Games in Android Showcase (178)
games submitted by our members
Games in WIP (686)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Static Code Analyzers  (Read 3107 times)
0 Members and 1 Guest are viewing this topic.
Offline fletchergames

Senior Devvie

« Posted 2011-05-17 21:34:30 »

I'm trying to use static code analyzers to streamline my code and make it more readable.  The code's supposed to be open source, and I want it to actually be useable.

This isn't about performance so much as usability, but I wasn't sure where else to put this.

I've been getting my static code analyzers in the form of eclipse plug-ins.

First, I tried Unnecessary Code Detector (  This worked pretty well.  I shut off all the warnings about changing visibility because most of them seemed unimportant, but I found the plug-in useful for removing unused code.  It also helped me find a few class stubs that I had created with the intention of implementing specific features.  I now have these specific features listed on my todo list so that I can implement them.

It also has the ability to check for dependency cycles (where class A calls class B and class B also calls class A).  Limiting dependencies is desireable, though I didn't do much with this.  It simply wasn't worth the time sorting out the mess.  Some of the cycles are perfectly acceptable for various reasons.

Second, I tried PMD (  This found a ridiculous number of problems, most of which seem to be about obscure code style issues that seem somewhat arbitrary to me.  I am changing some of my code to match their naming conventions and such, but many of the warnings appear to be unimportant.

Does anyone have any advice about any other static code analyzer plug-ins to use or any comments about their experiences with static code analysis?
Offline ra4king

JGO Kernel

Medals: 409
Projects: 3
Exp: 5 years

I'm the King!

« Reply #1 - Posted 2011-05-17 22:13:51 »

Haha I have never had any code problems. I usually set rules for what my naming and code style should be when I work on something so my code is always neat and tidy when I look back Cheesy

Offline zammbi

JGO Coder

Medals: 4

« Reply #2 - Posted 2011-05-18 01:15:01 »

I used pmd but found it too annoying.

I basically just use findbugs.

Current project - Rename and Sort
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline fletchergames

Senior Devvie

« Reply #3 - Posted 2011-05-18 18:28:11 »

I'm installing Find Bugs and will try it out tomorrow or Friday.  Even if it just catches a couple of things I want to change, it's worth trying out.

Online Spasi
« Reply #4 - Posted 2011-05-18 19:01:29 »

The community edition of IntelliJ IDEA has everything you need, except duplicate code detection. Everything's configurable too, so for example you can automatically format your code the way you like, use only the inspections that are interesting to you, etc.
Offline zammbi

JGO Coder

Medals: 4

« Reply #5 - Posted 2011-05-19 01:11:09 »

Oh yes IntelliJ IDEA also was quite good in picking things that findbugs missed.

Current project - Rename and Sort
Offline fletchergames

Senior Devvie

« Reply #6 - Posted 2011-05-23 03:47:20 »

Find Bugs appears to be working out ok.  It isn't going to change anything drastically, but I'm rearranging some of my code.  It's relatively easy to locate problems with all these tools unless they find a superabundance of warnings about nothing.  Fortunately, you can turn most of that stuff off.

I don't think I want to go so far as to switch to a different IDE to get better static code analyzers.  It looks like I can use the IntelliJ IDEA for free because I'm making an open source game, but I don't want to encounter problems if I suddenly decide to use the same engine to make a shareware game.  I could just buy the IDE, but I don't want it badly enough.
Online Spasi
« Reply #7 - Posted 2011-05-23 08:42:10 »

It looks like I can use the IntelliJ IDEA for free because I'm making an open source game, but I don't want to encounter problems if I suddenly decide to use the same engine to make a shareware game.  I could just buy the IDE, but I don't want it badly enough.

That only applies to the Ultimate edition, which is really targeted to web/enterprise development. You can use the Community edition just like you use Eclipse. Going all the way and switching IDEs is very hard for any developer and a personal matter really, bu in this case I highly recommended giving IDEA a try. You could at least use it on the side just for its inspection and quick-fix features.
Offline Cero
« Reply #8 - Posted 2011-08-16 03:21:58 »

eclipse warnings -> Find Bugs -> PMD

generally I have no eclipse or find bugs warnings
having no PMD warnings should be impossible, I think its a great tool, just don't take it too seriously

although find bugs has a problem with java 7, in that every System.out or .err are null pointer for it
kinda annoying

Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

Dwinin (61 views)
2015-11-07 13:29:08

Rems19 (75 views)
2015-10-31 01:36:56

Rems19 (68 views)
2015-10-31 01:32:37

williamwoles (103 views)
2015-10-23 10:42:59

williamwoles (91 views)
2015-10-23 10:42:45

Jervac_ (105 views)
2015-10-18 23:29:12

DarkCart (131 views)
2015-10-16 00:58:11

KaiHH (113 views)
2015-10-11 14:10:14

KaiHH (153 views)
2015-10-11 13:26:18

BurntPizza (166 views)
2015-10-08 03:11:46
Rendering resources
by Roquen
2015-11-13 14:37:59

Rendering resources
by Roquen
2015-11-13 14:36:58

Math: Resources
by Roquen
2015-10-22 07:46:10

Networking Resources
by Roquen
2015-10-16 07:12:30

Rendering resources
by Roquen
2015-10-15 07:40:48

Math: Inequality properties
by Roquen
2015-10-01 13:30:46

Math: Inequality properties
by Roquen
2015-09-30 16:06:05

HotSpot Options
by Roquen
2015-08-29 11:33:11 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!