rspec/rules/S117/java/rule.adoc

74 lines
1.0 KiB
Plaintext
Raw Normal View History

== Why is this an issue?
2020-06-30 10:16:44 +02:00
include::../description.adoc[]
=== Noncompliant code example
2020-06-30 10:16:44 +02:00
2021-01-27 13:42:22 +01:00
With the default regular expression ``++^[a-z][a-zA-Z0-9]*$++``:
2022-02-04 17:28:24 +01:00
[source,java]
2020-06-30 10:16:44 +02:00
----
public void doSomething(int my_param) {
int LOCAL;
...
}
----
=== Compliant solution
2020-06-30 10:16:44 +02:00
2022-02-04 17:28:24 +01:00
[source,java]
2020-06-30 10:16:44 +02:00
----
public void doSomething(int myParam) {
int local;
...
}
----
=== Exceptions
2020-06-30 10:16:44 +02:00
Loop counters are ignored by this rule.
[source,java]
2020-06-30 10:16:44 +02:00
----
for (int i_1 = 0; i_1 < limit; i_1++) { // Compliant
// ...
}
----
2021-01-27 13:42:22 +01:00
as well as one-character ``++catch++`` variables:
[source,java]
2020-06-30 10:16:44 +02:00
----
try {
//...
} catch (Exception e) { // Compliant
}
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
=== Parameters
.format
****
----
^[a-z][a-zA-Z0-9]*$
----
Regular expression used to check the names against.
****
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]