sevntu-checkstyle / sevntu.checkstyle

Additional Checkstyle checks, that could be added as extension to EclipseCS plugin and maven-checkstyle-plugin, Sonar checkstyle plugin, extension for CheckStyle IDEA plugin.
http://sevntu-checkstyle.github.io/sevntu.checkstyle/
190 stars 147 forks source link

Create ExtendedConstantNameCheck sticktly following java convention for UPPER_CASE naming #155

Open isopov opened 10 years ago

isopov commented 10 years ago

See https://github.com/checkstyle/checkstyle/issues/23

The following are considered to be constants:

All static final primitive types (Remember that all interface fields are inherently static final). All static final object reference types that are never followed by "." All static final arrays that are never followed by "["

Consider making some options like special treatment for arrays, user-supplied list for types that can be considered constant nevertheless they are objects followed my "." in some cases (e.g. String).

cameronsstone commented 10 years ago

FYI: This is google's take on it: http://google-styleguide.googlecode.com/svn/trunk/javaguide.html#s5.2.4-constant-names

Sounds like this will be tricky to automate. I would be happy with the Intellij approach of optionally ignoring mutables.

romani commented 9 years ago

discussion: http://stackoverflow.com/questions/1417190/should-a-static-final-logger-be-declared-in-upper-case/12069687#12069687

Document: http://www.scribd.com/doc/15884743/Java-Coding-Style-by-Achut-Reddy

romani commented 9 years ago

@cameronsstone ,

from http://checkstyle.sourceforge.net/google_style.html " Every constant is a static final field, but not all static final fields are constants - impossible to check such rule. "