diff --git a/analyzers/tests/SonarAnalyzer.UnitTest/TestCases/CommentsShouldNotBeEmpty.cs b/analyzers/tests/SonarAnalyzer.UnitTest/TestCases/CommentsShouldNotBeEmpty.cs index 32884440c2d..74f22be8f1f 100644 --- a/analyzers/tests/SonarAnalyzer.UnitTest/TestCases/CommentsShouldNotBeEmpty.cs +++ b/analyzers/tests/SonarAnalyzer.UnitTest/TestCases/CommentsShouldNotBeEmpty.cs @@ -2,18 +2,42 @@ [Obsolete] // Ipsem Lorum public class SingleLine // -// Noncompliant@-1 (inline comment) -{ +// hey + +// Noncompliant@-3 (inline comment) +{ // Ipsem Lorum // - // Noncompliant@-1 (a lot of whitespace before) + + // Noncompliant@-2 (a lot of whitespace before) // - // Noncompliant@-1 (a lot of whitespace after) + + // Noncompliant@-2 (a lot of whitespace after) // * // Ipsem Lorum // - // Noncompliant @-1 + + // hey + // + // + // + + // + // + // hey + // + // + // + + // + // + // + // hey + // + // + // + // @@ -36,6 +60,73 @@ public class SingleLine // // // // /** */ + + // + // + // hey + // + // + // there + // + // + + // + // + // + /// text + // Noncompliant@-4 + + // + // + // + /* + * text + */ + // Noncompliant@-6 + + // + // + // + /** + * text + */ + // Noncompliant@-6 + + void Method() + { + // Noncompliant@+2 + + // + // + // + var x = 42; // + // + // + // + + // Noncompliant@-5 + // Noncompliant@-5 + + // + // + // hello + // + // + var y = 42; // + // + // + // + // there + + // Noncompliant@-6 + + // + } // + // + + // Noncompliant@-4 + // Noncompliant@-4 + // Noncompliant@-4 } [Obsolete] /// Ipsem Lorum @@ -58,6 +149,7 @@ public class SingleLineDocumentation /// /// hey there /// hey there + /// text /// /// /// diff --git a/analyzers/tests/SonarAnalyzer.UnitTest/TestCases/CommentsShouldNotBeEmpty.vb b/analyzers/tests/SonarAnalyzer.UnitTest/TestCases/CommentsShouldNotBeEmpty.vb index 20201da2e88..66af30b900a 100644 --- a/analyzers/tests/SonarAnalyzer.UnitTest/TestCases/CommentsShouldNotBeEmpty.vb +++ b/analyzers/tests/SonarAnalyzer.UnitTest/TestCases/CommentsShouldNotBeEmpty.vb @@ -1,25 +1,55 @@ Public Class Testcases Public Sub Comment() ' - ' Noncompliant@-1 (inline comment) + + ' Noncompliant@-2 (inline comment) Dim x = 42 'Ipsem Lorum Dim y = 42 ' Ipsem Lorum Dim z = 42 ' - ' Noncompliant@-1 (whitespace) + + ' Noncompliant@-2 Dim a = 42 '''Ipsem Lorum Dim b = 42 ''' Ipsem Lorum Dim c = 42 ''' ' - ' Noncompliant@-1 (whitespace) + + ' Noncompliant@-2 (whitespace) + + + ' + ' + ' + ' hey + + ' hey + ' + ' + ' + + ' Noncompliant@+2 + + ' + ' + ' + ' + + ' Noncompliant@+2 + + ' + + ' + ' + ' + + ' Noncompliant@-4 ' * ' Ipsem Lorum 'Ipsem Lorum ' - ' Noncompliant @-1 ' @@ -44,6 +74,12 @@ '' '''''' + + ' + ' + ' + ''' Ipsem Lorum + ' Noncompliant@-4 End Sub Public Sub DocumentationComment()