rspec/rules/S101/csharp/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

56 lines
1.6 KiB
Plaintext

== Why is this an issue?
Shared naming conventions allow teams to collaborate efficiently. This rule checks whether or not type names are using PascalCase. To reduce noise, two consecutive upper case characters are allowed unless they form the whole type name. So, ``++MyXClass++`` is compliant, but ``++XC++`` on its own is not.
=== Noncompliant code example
[source,csharp]
----
class my_class {...}
class SOMEName42 {...}
----
=== Compliant solution
[source,csharp]
----
class MyClass {...}
class SomeName42 {...}
----
=== Exceptions
* The rule ignores types that are marked with ``++ComImportAttribute++`` or ``++InterfaceTypeAttribute++``.
* The rule allows for two-letter acronyms in which both letters are capitalized, as shown in the following identifier: ``++IOStream++``
* The rule allows having ``++'_'++`` characters in class names inside test projects.
[source,csharp]
----
class Some_Name___42 {...} // valid in test
class Some_name___42 {...} // still not valid
class Some_Name_XC {...} // invalid because of XC, should be Some_Name_Xc
----
== Resources
* https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/capitalization-conventions[Microsoft Capitalization Conventions]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
* Rename [class|interface|struct] "XXX" to match PascalCase naming rules, consider using "Xxx".
* Rename [class|interface|struct] "XXX" to match PascalCase naming rules, trim underscores from the name.
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]