rspec/rules/S6673/how-dotnet.adoc

41 lines
1.1 KiB
Plaintext

== How to fix it
Make sure that the placeholder positions and the argument positions match. Use local variables, fields, or properties for the arguments and name the placeholders accordingly.
=== Code examples
==== Noncompliant code example
'path' and 'fileName' are swapped and therefore assigned to the wrong placeholders.
include::{language}/example_2_noncompliant.adoc[]
==== Compliant solution
Swap the arguments.
include::{language}/example_2_compliant.adoc[]
==== Noncompliant code example
'Name' is detected but 'Folder' is not. The placeholder's name should correspond to the name from the argument.
include::{language}/example_3_noncompliant.adoc[]
==== Compliant solution
Swap the arguments and rename the placeholder to 'DirectoryName'.
include::{language}/example_3_compliant.adoc[]
==== Noncompliant code example
Not detected: A name for the arguments can not be inferred. Use locals to support detection.
include::{language}/example_4_noncompliant.adoc[]
==== Compliant solution
Help detection by using arguments with a name.
include::{language}/example_4_compliant.adoc[]