rspec/rules/S117/java/rule.adoc

40 lines
585 B
Plaintext
Raw Normal View History

2020-06-30 10:16:44 +02:00
include::../description.adoc[]
== Noncompliant Code Example
With the default regular expression <code>^[a-z][a-zA-Z0-9]*$</code>:
2020-06-30 10:16:44 +02:00
----
public void doSomething(int my_param) {
int LOCAL;
...
}
----
== Compliant Solution
----
public void doSomething(int myParam) {
int local;
...
}
----
== Exceptions
Loop counters are ignored by this rule.
2020-06-30 10:16:44 +02:00
----
for (int i_1 = 0; i_1 < limit; i_1++) { // Compliant
// ...
}
----
as well as one-character <code>catch</code> variables:
2020-06-30 10:16:44 +02:00
----
try {
//...
} catch (Exception e) { // Compliant
}
----