
## Review A dedicated reviewer checked the rule description successfully for: - [ ] logical errors and incorrect information - [ ] information gaps and missing content - [ ] text style and tone - [ ] PR summary and labels follow [the guidelines](https://github.com/SonarSource/rspec/#to-modify-an-existing-rule)
83 lines
2.6 KiB
Plaintext
83 lines
2.6 KiB
Plaintext
:identifier_capital_plural: Local variables
|
|
:identifier: local variable
|
|
:identifier_plural: local variables
|
|
:identifier_or: local variable
|
|
:regex: ^[a-z][a-z0-9]*([A-Z]{1,3}[a-z0-9]+)*([A-Z]{2})?$
|
|
|
|
include::../rule.adoc[]
|
|
|
|
=== Code examples
|
|
|
|
==== Noncompliant code example
|
|
|
|
With the default regular expression ``{regex}``, bringing the following constraints:
|
|
|
|
* Camel casing, starting with a lowercase character, for example backColor
|
|
* Short abbreviations of 2 letters can be capitalized only when not at the beginning, for example id, productID
|
|
* Longer abbreviations need to be lowercased, for example html
|
|
|
|
[source,vbnet,diff-id=1,diff-type=noncompliant]
|
|
----
|
|
Module Module1
|
|
Sub Main()
|
|
Dim Foo = 0 ' Noncompliant
|
|
End Sub
|
|
End Module
|
|
----
|
|
|
|
==== Compliant solution
|
|
|
|
[source,vbnet,diff-id=1,diff-type=compliant]
|
|
----
|
|
Module Module1
|
|
Sub Main()
|
|
Dim foo = 0 ' Compliant
|
|
End Sub
|
|
End Module
|
|
----
|
|
|
|
== Resources
|
|
|
|
=== Documentation
|
|
|
|
* Microsoft Learn - https://learn.microsoft.com/en-us/dotnet/visual-basic/programming-guide/program-structure/naming-conventions[Visual Basic Naming Conventions]
|
|
* Wikipedia - https://en.wikipedia.org/wiki/Naming_convention_(programming)[Naming Convention (programming)]
|
|
|
|
=== Related rules
|
|
|
|
* S101 - Class names should comply with a naming convention
|
|
* S114 - Interface names should comply with a naming convention
|
|
* S119 - Generic type parameter names should comply with a naming convention
|
|
* S1542 - Functions and procedures should comply with a naming convention
|
|
* S1654 - Method parameters should follow a naming convention
|
|
* S2304 - Namespace names should comply with a naming convention
|
|
* S2342 - Enumeration types should comply with a naming convention
|
|
* S2343 - Enumeration values should comply with a naming convention
|
|
* S2347 - Event handlers should comply with a naming convention
|
|
* S2348 - Events should comply with a naming convention
|
|
* S2362 - Private constants should comply with a naming convention
|
|
* S2363 - "Private Shared ReadOnly" fields should comply with a naming convention
|
|
* S2364 - "Private" fields should comply with a naming convention
|
|
* S2366 - Properties should comply with a naming convention
|
|
* S2367 - Non-private constants should comply with a naming convention
|
|
* S2369 - Non-private fields should comply with a naming convention
|
|
* S2370 - Non-private "Shared ReadOnly" fields should comply with a naming convention
|
|
|
|
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[]
|