Static code analysis
Static code analysis tools read the code just like the compiler and analyze it, but instead of compilation, they try to find errors or mistakes in it. Not the syntax errors. For that, we already have the Java compiler. Mistakes, such as using a loop variable outside a loop, which may be absolutely valid but is usually bad style and, many times, such usage comes from some simple mistakes. They also check that the code follows the styling rules that we set.
Static code analyzers help identify many small and obvious errors in the code. Sometimes, they are annoying, warning about something that may not be really a problem. In such a case, it is better to code the program a bit differently, not because we want the static code ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access