2023-10-17 09:45:51 +02:00
|
|
|
: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})?$
|
2023-05-03 11:06:20 +02:00
|
|
|
|
2023-10-17 09:45:51 +02:00
|
|
|
include::../rule.adoc[]
|
2020-06-30 10:16:44 +02:00
|
|
|
|
2023-10-17 09:45:51 +02:00
|
|
|
=== Code examples
|
2021-02-02 15:02:10 +01:00
|
|
|
|
2023-10-17 09:45:51 +02:00
|
|
|
==== Noncompliant code example
|
2020-06-30 10:16:44 +02:00
|
|
|
|
2023-10-17 09:45:51 +02:00
|
|
|
With the default regular expression ``{regex}``, bringing the following constraints:
|
2021-02-02 15:02:10 +01:00
|
|
|
|
2023-10-17 09:45:51 +02:00
|
|
|
* 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
|
2020-06-30 10:16:44 +02:00
|
|
|
|
2023-10-17 09:45:51 +02:00
|
|
|
[source,vbnet,diff-id=1,diff-type=noncompliant]
|
2020-06-30 10:16:44 +02:00
|
|
|
----
|
|
|
|
Module Module1
|
|
|
|
Sub Main()
|
|
|
|
Dim Foo = 0 ' Noncompliant
|
|
|
|
End Sub
|
|
|
|
End Module
|
|
|
|
----
|
|
|
|
|
2023-10-17 09:45:51 +02:00
|
|
|
==== Compliant solution
|
2020-06-30 10:16:44 +02:00
|
|
|
|
2023-10-17 09:45:51 +02:00
|
|
|
[source,vbnet,diff-id=1,diff-type=compliant]
|
2020-06-30 10:16:44 +02:00
|
|
|
----
|
|
|
|
Module Module1
|
|
|
|
Sub Main()
|
|
|
|
Dim foo = 0 ' Compliant
|
|
|
|
End Sub
|
|
|
|
End Module
|
|
|
|
----
|
2021-06-02 20:44:38 +02:00
|
|
|
|
2023-10-17 09:45:51 +02:00
|
|
|
== 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
|
|
|
|
|
2021-06-03 09:05:38 +02:00
|
|
|
ifdef::env-github,rspecator-view[]
|
2021-09-20 15:38:42 +02:00
|
|
|
|
|
|
|
'''
|
|
|
|
== Implementation Specification
|
|
|
|
(visible only on this page)
|
|
|
|
|
2023-10-17 09:45:51 +02:00
|
|
|
include::../message.adoc[]
|
2021-09-20 15:38:42 +02:00
|
|
|
|
2023-10-17 09:45:51 +02:00
|
|
|
include::../parameters.adoc[]
|
2021-09-20 15:38:42 +02:00
|
|
|
|
2021-06-08 15:52:13 +02:00
|
|
|
'''
|
2021-06-02 20:44:38 +02:00
|
|
|
== Comments And Links
|
|
|
|
(visible only on this page)
|
|
|
|
|
|
|
|
include::../comments-and-links.adoc[]
|
2023-06-22 10:38:01 +02:00
|
|
|
|
2021-06-03 09:05:38 +02:00
|
|
|
endif::env-github,rspecator-view[]
|