rspec/rules/S122/csharp/rule.adoc

42 lines
851 B
Plaintext
Raw Normal View History

2023-06-16 15:38:45 +02:00
:noncompliant: csharp/noncompliant.adoc
:compliant: csharp/compliant.adoc
2020-06-30 10:16:44 +02:00
include::../description.adoc[]
=== Exceptions
2020-06-30 10:16:44 +02:00
2023-06-16 15:38:45 +02:00
The rule ignores:
2020-06-30 10:16:44 +02:00
2023-06-16 15:38:45 +02:00
* block statements
* anonymous functions containing a single statement
2021-02-02 15:02:10 +01:00
[source,csharp]
2020-06-30 10:16:44 +02:00
----
2023-06-16 15:38:45 +02:00
Func<object, bool> item1 = o => { return true; }; // Compliant by exception
2020-06-30 10:16:44 +02:00
Func<object, bool> item1 = o => { var r = false; return r; }; // Noncompliant
----
== Resources
=== Documentation
* https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/csharp-formatting-options[C# formatting options]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
include::../highlighting.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]