rspec/rules/S3603/csharp/rule.adoc

48 lines
707 B
Plaintext
Raw Normal View History

include::../description.adoc[]
2023-07-03 15:45:51 +02:00
== How to fix it
=== Code examples
==== Noncompliant code example
2023-07-03 15:45:51 +02:00
[source,csharp,diff-id=1,diff-type=noncompliant]
----
class Person
{
private int age;
2023-07-03 15:45:51 +02:00
[Pure] // Noncompliant. The method makes a state change
void ConfigureAge(int age) =>
this.age = age;
}
----
2023-07-03 15:45:51 +02:00
==== Compliant solution
2023-07-03 15:45:51 +02:00
[source,csharp,diff-id=1,diff-type=compliant]
----
class Person
{
private int age;
2023-07-03 15:45:51 +02:00
void ConfigureAge(int age) =>
this.age = age;
}
----
2023-07-03 15:45:51 +02:00
include::../resources.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
include::../highlighting.adoc[]
endif::env-github,rspecator-view[]