:identifier_capital_plural: Local variables and method parameters
:identifier: local variable and method parameter
:identifier_plural: local variables and method parameters
:identifier_or: local variable or method parameter
:regex: ^[a-z][a-zA-Z0-9]*$

include::../introduction.adoc[]

include::../why-is-this-an-issue.adoc[]

include::../what-is-the-potential-impact.adoc[]

=== Exceptions

Loop counters are ignored by this rule.

[source,java]
----
for (int i_1 = 0; i_1 < limit; i_1++) {  // Compliant
  // ...
}
----
as well as one-character ``++catch++`` variables:

[source,java]
----
try {
//...
} catch (Exception e) { // Compliant
}
----

include::../how-to-fix-it.adoc[]

=== Code examples

==== Noncompliant code example

With the default regular expression ``{regex}``:

[source,java,diff-id=1,diff-type=noncompliant]
----
public class MyClass {
    public void doSomething(int myParam) {
      int LOCAL;    // Noncompliant
      // ...
    }
}
----

==== Compliant solution

[source,java,diff-id=1,diff-type=compliant]
----
public class MyClass {
    public void doSomething(int my_param) {
      int local;
      // ...
    }
}
----

== Resources

=== Documentation

* Oracle - https://www.oracle.com/java/technologies/javase/codeconventions-namingconventions.html[Java SE Naming Conventions]
* Geeksforgeeks - https://www.geeksforgeeks.org/java-naming-conventions/[Java Naming Conventions]
* Wikipedia - https://en.wikipedia.org/wiki/Naming_convention_(programming)[Naming Convention (programming)]

=== Related rules

* S100 - Method names should comply with a naming convention
* S101 - Class names should comply with a naming convention
* S114 - Interface names should comply with a naming convention
* S115 - Constant names should comply with a naming convention
* S116 - Field names should comply with a naming convention
* S118 - Abstract class names should comply with a naming convention
* S119 - Type parameter names should comply with a naming convention
* S120 - Package names should comply with a naming convention
* S1312 - Loggers should be "private static final" and should share a naming convention
* S3008 - Static non-final field names should comply with a naming convention
* S3577 - Test classes should comply with a naming convention
* S3578 - Test methods should comply with a naming convention
* S4174 - Local constants should follow naming conventions for constants

ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

include::../message.adoc[]

include::../parameters.adoc[]

'''
== Comments And Links
(visible only on this page)

include::../comments-and-links.adoc[]

endif::env-github,rspecator-view[]
