-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Amaury Levé
authored
Feb 7, 2019
1 parent
8d8d7e4
commit f310ce8
Showing
24 changed files
with
631 additions
and
258 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<p>When the names of parameters in a procedure call match the names of the procedure arguments, it contributes to a clearer, more readable code. | ||
However, when the names match but are passed in a different order than the method arguments, it indicates a mistake in the parameter order which will | ||
likely lead to unexpected results.</p> | ||
<h2>Noncompliant Code Example</h2> | ||
<pre> | ||
Public Function Divide(ByVal divisor As Integer, ByVal dividend As Integer) As Double | ||
Return divisor / dividend | ||
End Function | ||
|
||
Public Sub DoTheThing() | ||
Dim divisor = 15 | ||
Dim dividend = 5 | ||
|
||
Dim result = Divide(dividend, divisor) // Noncompliant; operation succeeds, but result is unexpected | ||
//... | ||
End Sub | ||
</pre> | ||
<h2>Compliant Solution</h2> | ||
<pre> | ||
Public Function Divide(ByVal divisor As Integer, ByVal dividend As Integer) As Double | ||
Return divisor / dividend | ||
End Function | ||
|
||
Public Sub DoTheThing() | ||
Dim divisor = 15 | ||
Dim dividend = 5 | ||
|
||
Dim result = Divide(divisor, dividend) | ||
//... | ||
End Sub | ||
</pre> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"title": "Parameters should be passed in the correct order", | ||
"type": "CODE_SMELL", | ||
"status": "ready", | ||
"remediation": { | ||
"func": "Constant\/Issue", | ||
"constantCost": "5min" | ||
}, | ||
"tags": [ | ||
|
||
], | ||
"defaultSeverity": "Major", | ||
"ruleSpecification": "RSPEC-2234", | ||
"sqKey": "S2234", | ||
"scope": "All" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ | |
"S2068", | ||
"S2077", | ||
"S2178", | ||
"S2234", | ||
"S2255", | ||
"S2304", | ||
"S2340", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ | |
"S1940", | ||
"S2068", | ||
"S2178", | ||
"S2234", | ||
"S2304", | ||
"S2340", | ||
"S2342", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.