rspec/rules/S100/csharp/rule.adoc

56 lines
1.3 KiB
Plaintext
Raw Normal View History

== Why is this an issue?
2023-06-06 17:27:22 +02:00
Shared naming conventions allow teams to collaborate efficiently.
2020-06-30 10:16:44 +02:00
2023-06-06 17:27:22 +02:00
This rule raises an issue when a method or a property name is not PascalCased.
For example, the method
2020-06-30 10:16:44 +02:00
2022-02-04 17:28:24 +01:00
[source,csharp]
2020-06-30 10:16:44 +02:00
----
2023-06-06 17:27:22 +02:00
public int doSomething() {...} // Noncompliant
2020-06-30 10:16:44 +02:00
----
2023-06-06 17:27:22 +02:00
should be renamed to
2020-06-30 10:16:44 +02:00
2022-02-04 17:28:24 +01:00
[source,csharp]
2020-06-30 10:16:44 +02:00
----
public int DoSomething() {...}
----
=== Exceptions
2020-06-30 10:16:44 +02:00
2023-06-06 17:27:22 +02:00
* The rule ignores members in types marked with `ComImportAttribute` or `InterfaceTypeAttribute`.
* The rule ignores `extern` methods.
* To reduce noise, two consecutive upper-case characters are allowed unless they form the full name. So, `MyXMethod` is compliant, but `XM` is not.
* The camel casing is not enforced when a name contains the ``++'_'++`` character.
2020-06-30 10:16:44 +02:00
[source,csharp]
2020-06-30 10:16:44 +02:00
----
2023-06-06 17:27:22 +02:00
void My_method_(){...} // Noncompliant, leading and trailing underscores are reported
void My_method(){...} // Compliant by exception
2020-06-30 10:16:44 +02:00
----
== Resources
2020-06-30 10:16:44 +02:00
2023-06-06 17:27:22 +02:00
=== Documentation
2020-06-30 10:16:44 +02:00
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)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]