sonar presentation

18
Sonar

Upload: rainman-janixz-sian-chiroy

Post on 17-Sep-2015

108 views

Category:

Documents


6 download

DESCRIPTION

dummy sonar ppt

TRANSCRIPT

PowerPoint Presentation

Sonar Throwable.printStackTrace(...) should never be calledUse play.Logger;

System.out and System.err should not be used as loggersAgain, use Loggers

Constant names should comply with a naming conventionUse only uppercase words separated by underscore _ and numbers (not at the beginning)

if/else/for/while/do statements should always use curly braces

if/else/for/while/do statements should always use curly braces

For this case, use ternary operator

Strings literals should be placed on the left side when checking for equalityUse someText.equals(aVar) , because in this way u dont need to validate null for aVar

Class variable fields should not have public accessibility

Use private modifier and setter and getter methodsClass variable fields should not have public accessibility

Local variable and method parameter names should comply with a naming convention

Dont use underscore on variable namesField names should comply with a naming convention

Dont use underscore _ on local variable namesUnused local variables should be removed

Just delete these!

Method parameters, caught exceptions and foreach variables should not be reassignedDont reassigned method parameters, use:Log[] otherVariable = contactsIds; and use this, because the parameter could be used after this method by his original source

Right curly brace and next "else", "catch" and "finally" keywords should be located on the same line

AVOIDUSEClass names should comply with a naming convention

http://howtodoinjava.com/2013/04/04/java-exception-handling-best-practices/