Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SONARJAVA-5222 Modify rule S115: explain that CONST_CASE applies to String, primitiv… #4549

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions rules/S115/java/rule.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,23 @@ public enum MyEnum {
}
----

=== Exceptions

The rule applies to fields of primitive types (for example, ``float``), boxed primitives (``Float``), and Strings.
We do not apply it to other types, which can be mutated, or have methods with side effects.

[source,java]
----
public static final Logger log = getLogger(MyClass.class);
public static final List<Integer> myList = new ArrayList<>();

// call with side-effects
log.info("message")

// mutating an object
myList.add(28);
----

== Resources

=== External coding guidelines
Expand Down
Loading