Compare commits

...

8 Commits

Author SHA1 Message Date
Zsolt Kolbay
ff1c316542 Post-rebase cleanup 2024-05-03 14:37:09 +02:00
Cristian Ambrosini
1e30208a46 Extend the rule specification to consider the log level of the calls 2024-05-03 14:32:52 +02:00
Cristian Ambrosini
95365a6e7f Fix grammar - add/remove resources 2024-05-03 14:32:18 +02:00
Cristian Ambrosini
1ceaed10f8 Change default threshold to 2 2024-05-03 14:31:57 +02:00
Cristian Ambrosini
7f60b1eff0 Improve the rule description: define block and statement count 2024-05-03 14:31:57 +02:00
Cristian Ambrosini
d3f9afa35d Add VB snippets 2024-05-03 14:31:02 +02:00
Cristian Ambrosini
9f0d07611e First draft specification 2024-05-03 14:30:38 +02:00
cristian-ambrosini-sonarsource
3b14d578fb Create rule S6664 2024-05-03 14:29:42 +02:00
7 changed files with 54 additions and 3 deletions

View File

@ -0,0 +1,16 @@
[source,vbnet,diff-id=1,diff-type=compliant]
----
Private Sub MyMethod(ByVal items As List(Of MyObject))
logger.Debug("The operation started")
For Each item In items
logger.Information($"Evaluating {item.Name}")
Dim result = Evaluate(item)
If item.Name Is String.Empty Then
logger.Error("Invalid item name")
End If
logger.Information($"End item evaluation with result: {result}")
Next
logger.Debug("The operation ended")
End Sub
----

View File

@ -0,0 +1,13 @@
[source,vbnet]
----
Private Sub MyMethod(ByVal items As List(Of MyObject))
logger.Debug("The operation started")
For Each item In items
logger.Debug($"Evaluating {item.Name}")
Dim result = Evaluate(item)
logger.Debug($"Evaluating resulted in {result}")
Next
logger.Debug("The operation ended")
End Sub
----

View File

@ -0,0 +1,2 @@
{
}

View File

@ -0,0 +1,17 @@
[source,vbnet,diff-id=1,diff-type=noncompliant]
----
Private Sub MyMethod(ByVal items As List(Of MyObject))
logger.Debug("The operation started")
For Each item In items
logger.Information($"Evaluating {item.Name}") ' Noncompliant
Dim result = Evaluate(item)
logger.Information($"Evaluating resulted in {result}") ' Secondary 1
If item.Name Is String.Empty Then
logger.Error("Invalid item name")
End If
logger.Information("End item evaluation") ' Secondary 2
Next
logger.Debug("The operation ended")
End Sub
----

View File

@ -0,0 +1,3 @@
:language: vbnet
include::../rule.adoc[]