Skip to content

Commit

Permalink
Issue #13345: Enable UnnecessarySemicolonAfterOuterTypeDeclarationChe…
Browse files Browse the repository at this point in the history
…ckExamplesTest
  • Loading branch information
prathm3 authored and romani committed May 5, 2024
1 parent d497c9c commit 6daffc6
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 35 deletions.
Expand Up @@ -19,12 +19,12 @@

package com.puppycrawl.tools.checkstyle.checks.coding;

import org.junit.jupiter.api.Disabled;
import static com.puppycrawl.tools.checkstyle.checks.coding.UnnecessarySemicolonAfterOuterTypeDeclarationCheck.MSG_SEMI;

import org.junit.jupiter.api.Test;

import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport;

@Disabled("until https://github.com/checkstyle/checkstyle/issues/13345")
public class UnnecessarySemicolonAfterOuterTypeDeclarationCheckExamplesTest
extends AbstractExamplesModuleTestSupport {
@Override
Expand All @@ -36,18 +36,20 @@ protected String getPackageLocation() {
@Test
public void testExample1() throws Exception {
final String[] expected = {

"17:2: " + getCheckMessage(MSG_SEMI),
"21:2: " + getCheckMessage(MSG_SEMI),
"25:2: " + getCheckMessage(MSG_SEMI),
"29:2: " + getCheckMessage(MSG_SEMI),
};

verifyWithInlineConfigParser(getPath("Example1.txt"), expected);
verifyWithInlineConfigParser(getPath("Example1.java"), expected);
}

@Test
public void testExample2() throws Exception {
final String[] expected = {

"19:2: " + getCheckMessage(MSG_SEMI),
};

verifyWithInlineConfigParser(getPath("Example2.txt"), expected);
verifyWithInlineConfigParser(getPath("Example2.java"), expected);
}
}
Expand Up @@ -6,12 +6,13 @@
</module>
*/

// xdoc section -- start
class A {
package com.puppycrawl.tools.checkstyle.checks.coding.unnecessarysemicolonafteroutertypedeclaration;

class Nested {
// xdoc section -- start
class Example1 {
class Nested {

}; // OK, nested type declarations are ignored
}; // OK, nested type declarations are ignored

}; // violation

Expand All @@ -23,7 +24,7 @@ enum C {

}; // violation

{@literal @}interface D {
@interface D {

}; // violation
// xdoc section -- end
Expand Up @@ -8,20 +8,26 @@
</module>
*/

package com.puppycrawl.tools.checkstyle.checks.coding.unnecessarysemicolonafteroutertypedeclaration;

// xdoc section -- start
class A {
class Example2 {
class Nested {

}; // OK, nested type declarations are ignored

}; // violation

interface B {
interface T {

}; // OK
};

enum C {
enum U {

}; // OK
};

{@literal @}interface D {
@interface V {

}; // OK
};
// xdoc section -- end

Expand Up @@ -80,11 +80,10 @@
Example:
</p>
<source>
class A {
class Example1 {
class Nested {

class Nested {

}; // OK, nested type declarations are ignored
}; // OK, nested type declarations are ignored

}; // violation

Expand All @@ -96,7 +95,7 @@ enum C {

}; // violation

{@literal @}interface D {
@interface D {

}; // violation
</source>
Expand All @@ -117,21 +116,24 @@ enum C {
Example:
</p>
<source>
class A {
class Example2 {
class Nested {

}; // OK, nested type declarations are ignored

}; // violation

interface B {
interface T {

}; // OK
};

enum C {
enum U {

}; // OK
};

{@literal @}interface D {
@interface V {

}; // OK
};
</source>
</subsection>

Expand Down
Expand Up @@ -35,15 +35,15 @@
</p>
<macro name="example">
<param name="path"
value="resources/com/puppycrawl/tools/checkstyle/checks/coding/unnecessarysemicolonafteroutertypedeclaration/Example1.txt"/>
value="resources/com/puppycrawl/tools/checkstyle/checks/coding/unnecessarysemicolonafteroutertypedeclaration/Example1.java"/>
<param name="type" value="config"/>
</macro>
<p id="Example1-code">
Example:
</p>
<macro name="example">
<param name="path"
value="resources/com/puppycrawl/tools/checkstyle/checks/coding/unnecessarysemicolonafteroutertypedeclaration/Example1.txt"/>
value="resources/com/puppycrawl/tools/checkstyle/checks/coding/unnecessarysemicolonafteroutertypedeclaration/Example1.java"/>
<param name="type" value="code"/>
</macro>
<p id="Example2-config">
Expand All @@ -52,15 +52,15 @@
</p>
<macro name="example">
<param name="path"
value="resources/com/puppycrawl/tools/checkstyle/checks/coding/unnecessarysemicolonafteroutertypedeclaration/Example2.txt"/>
value="resources/com/puppycrawl/tools/checkstyle/checks/coding/unnecessarysemicolonafteroutertypedeclaration/Example2.java"/>
<param name="type" value="config"/>
</macro>
<p id="Example2-code">
Example:
</p>
<macro name="example">
<param name="path"
value="resources/com/puppycrawl/tools/checkstyle/checks/coding/unnecessarysemicolonafteroutertypedeclaration/Example2.txt"/>
value="resources/com/puppycrawl/tools/checkstyle/checks/coding/unnecessarysemicolonafteroutertypedeclaration/Example2.java"/>
<param name="type" value="code"/>
</macro>
</subsection>
Expand Down

0 comments on commit 6daffc6

Please sign in to comment.