Save your reputation, eliminate non-Java bugs

DZone 's Guide to

Save your reputation, eliminate non-Java bugs

· Java Zone ·
Free Resource

Recently, when we talked about Static Code Analysis, I made a promise to come back with some more examples on how to find bugs automatically in non-Java code. We've seen already how static code analysis engines parse your code into an Abstract Syntax Tree (AST) and then search for known bug patterns in that AST. They can help you either on-demand to provide an interactive colorful report, or on-the-fly, while you edit the code, shape it, refactor and polish.

A natural demand once you get addicted to having your code inspected automatically is to obtain the same assistance outside of the Java code.

I don't know your exact situation, but chances are high that a great deal of the code on your Java projects these days is written in other languages. Think of all the JavaScript code out there, XML documents, HTML pages, SQL or HQL queries, CSS definitions or plain property files, not mentioning the increasing number of Groovy, Ruby and Scala files. Or Clojure anyone?

What a limitation it would be for a tool if it ignored such a large portion of your code-base and let you suffer without any help!

In IntelliJ IDEA, a great deal of the bug patterns in the database target non-Java languages.

So you can search for bugs in JavaScript,

tune your HTML,

fix CSS,


improve Hibernate queries

or type Groovy without fear.

The list of supported technologies obviously doesn't end here, but you've seen enough to get an idea. Being able to spot such problems in code can be virtually a life-saver.

The last important point to mention here. You might have noticed that Static Code Analysis in non-Java code feels exactly the same as in Java code. Same markers, behavior and keyboard shortcuts. Don't waste time learning the tool, just straight use it.



Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}