Skip to content

Commit

Permalink
Issue checkstyle#13213: Remove // ok comments from input files
Browse files Browse the repository at this point in the history
  • Loading branch information
malak-elbanna authored and romani committed Dec 1, 2024
1 parent 9db7149 commit b050607
Show file tree
Hide file tree
Showing 20 changed files with 103 additions and 103 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package com.google.checkstyle.test.chapter2filebasic.rule21filename;

// violation below 'Top-level class MyAnnotation1 has to reside in its own source file.'
@interface MyAnnotation1 { // ok
@interface MyAnnotation1 {
String name();

int version();
}

/** Some javadoc. */
@MyAnnotation1(name = "ABC", version = 1)
public class InputFileName1 {} // ok
public class InputFileName1 {}

// violation below 'Top-level class Enum1 has to reside in its own source file.'
enum Enum1 {
Expand All @@ -25,7 +25,7 @@ public String toString() {
}

// violation below 'Top-level class TestRequireThisEnum has to reside in its own source file.'
interface TestRequireThisEnum { // ok
interface TestRequireThisEnum {
enum DayOfWeek {
SUNDAY,
MONDAY,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.google.checkstyle.test.chapter2filebasic.rule21filename;

/** Test for illegal tokens. */
public class InputFileName2 { // ok
public class InputFileName2 {
/** Some javadoc. */
public void defaultMethod() {
int i = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

// violation below 'Top-level class InputFileName3 has to reside in its own source file.'
@MyAnnotation2(name = "ABC", version = 1)
class InputFileName3 {} // ok
class InputFileName3 {}

// violation below 'Top-level class Enum2 has to reside in its own source file.'
enum Enum2 { // ok
enum Enum2 {
A,
B,
C;
Expand All @@ -25,7 +25,7 @@ public String toString() {
}

// violation below 'Top-level class TestRequireThisEnum2 has to reside in its own source file.'
interface TestRequireThisEnum2 { // ok
interface TestRequireThisEnum2 {
enum DayOfWeek {
SUNDAY,
MONDAY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public Object fooChar() {
public void multiplyString() {
String unitAbbrev2 = "asd\u03bcsasd";
// violation above 'Unicode escape(s) usage should be avoided.'
String unitAbbrev3 = "aBc\u03bcssdf\u03bc"; /* Greek letter mu, "s"*/ // ok
String unitAbbrev3 = "aBc\u03bcssdf\u03bc"; /* Greek letter mu, "s"*/
String unitAbbrev4 = "\u03bcaBc\u03bcssdf\u03bc";
// violation above 'Unicode escape(s) usage should be avoided.'
String allCharactersEscaped = "\u03bc\u03bc";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,23 +123,23 @@ private enum Suit {
HEARTS,
SPADES,
DIAMONDS
} // ok
}
}

// violation below 'Top-level class WithArraysLeft2 has to reside in its own source file.'
class WithArraysLeft2 { // ok
String[] s1 = {""}; // ok
String[] empty = {}; // ok
String[] s2 = { // ok
class WithArraysLeft2 {
String[] s1 = {""};
String[] empty = {};
String[] s2 = {
"foo", "foo",
};
String[] s3 = { // ok
String[] s3 = {
"foo", "foo",
};
String[] s4 = { // ok
String[] s4 = {
"foo", "foo",
};
String[] s5 = {"foo", "foo"}; // ok
String[] s5 = {"foo", "foo"};
}

// violation below 'Top-level class InputRightCurlyOther22 has to reside in its own source file.'
Expand All @@ -156,51 +156,51 @@ int foo() throws InterruptedException {
try {
if (x > 0) {
break;
} else if (x < 0) { // ok
} else if (x < 0) {

;
} else {
break;
} // ok
}
switch (a) {
case 0:
break;
default:
break;
} // ok
}
} catch (Exception e) {
break;
} // ok
} // ok
}
}

synchronized (this) {
do {
x = 2;
} while (x == 2); // ok
} // ok
} while (x == 2);
}

this.wait(666); // Bizarre, but legal

for (int k = 0; k < 1; k++) {
String innerBlockVariable = "";
} // ok
}

if (System.currentTimeMillis() > 1000) {
return 1;
} else {
return 2;
}
} // ok
}

static {
int x = 1;
} // ok
}

/** some javadoc. */
public enum GreetingsEnum {
HELLO,
GOODBYE
} // ok
}

void method2() {
boolean flag = true;
Expand All @@ -213,8 +213,8 @@ void method2() {
if (flag) {
System.identityHashCode("some foo");
}
} // ok
} // ok
}
}

/**
* Test input for closing brace if that brace terminates a statement or the body of a constructor.
Expand Down Expand Up @@ -244,7 +244,7 @@ class FooInner2 {
class InnerFoo {
public void fooInnerMethod() {}
}
} // ok
}

// violation below 'Top-level class EnumContainer2 has to reside in its own source file.'
class EnumContainer2 {
Expand All @@ -253,21 +253,21 @@ private enum Suit {
HEARTS,
SPADES,
DIAMONDS
} // ok
}
}

// violation below 'Top-level class WithArrays2 has to reside in its own source file.'
class WithArrays2 {
String[] test = {""}; // ok
String[] empty = {}; // ok
String[] test = {""};
String[] empty = {};
String[] s1 = {
"foo", "foo",
}; // ok
};
String[] s2 = {
"foo", "foo",
}; // ok
};
String[] s3 = {
"foo", "foo",
}; // ok
String[] s4 = {"foo", "foo"}; // ok
};
String[] s4 = {"foo", "foo"};
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/** some javadoc. */
public class InputFormattedTryCatchIfElse {

@interface TesterAnnotation {} // ok
@interface TesterAnnotation {}

void foo() throws Exception {
int a = 90;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class InputEmptyCatchBlockViolationsByComment {
private void foo() {
try {
throw new RuntimeException();
} catch (Exception expected) { // ok
} catch (Exception expected) {
// Expected
}
}
Expand Down Expand Up @@ -51,7 +51,7 @@ private void foo5() {
private void some() {
try {
throw new IOException();
} catch (IOException e) { // ok
} catch (IOException e) {
/* ololo
* blalba
*/
Expand All @@ -61,7 +61,7 @@ private void some() {
private void some1() {
try {
throw new IOException();
} catch (IOException e) { // ok
} catch (IOException e) {
/* lalala
* This is expected
*/
Expand All @@ -71,7 +71,7 @@ private void some1() {
private void some2() {
try {
throw new IOException();
} catch (IOException e) { // ok
} catch (IOException e) {
/*
* This is expected
* lalala
Expand All @@ -82,7 +82,7 @@ private void some2() {
private void some3() {
try {
throw new IOException();
} catch (IOException e) { // ok
} catch (IOException e) {
// some comment
// This is expected
}
Expand All @@ -91,7 +91,7 @@ private void some3() {
private void some4() {
try {
throw new IOException();
} catch (IOException e) { // ok
} catch (IOException e) {
// This is expected
// some comment
}
Expand All @@ -100,7 +100,7 @@ private void some4() {
private void some5() {
try {
throw new IOException();
} catch (IOException e) { // ok
} catch (IOException e) {
/* some comment */
// This is expected
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class InputEmptyCatchBlockViolationsByVariableName {
private void foo() {
try {
throw new RuntimeException();
} catch (Exception expected) { // ok
} catch (Exception expected) {

}
}
Expand All @@ -22,7 +22,7 @@ private void foo1() {
private void foo2() {
try {
throw new IOException();
} catch (IOException | NullPointerException | ArithmeticException expected) { // ok
} catch (IOException | NullPointerException | ArithmeticException expected) {
}
}

Expand All @@ -36,7 +36,7 @@ private void foo3() { // comment
private void foo4() {
try {
throw new IOException();
} catch (IOException | NullPointerException | ArithmeticException expected) { // ok
} catch (IOException | NullPointerException | ArithmeticException expected) {
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ void foo() {
}
} catch (Exception e) {
/* ignore */
} finally { // ok
} finally {
/* ignore */
} // ok
}
}

void foo2() {
Expand All @@ -45,9 +45,9 @@ void foo() {
}
} catch (Exception e) {
/* ignore */
} finally { // ok
} finally {
/* ignore */
} // ok
}
}

void foo2() {
Expand Down Expand Up @@ -75,9 +75,9 @@ void foo() {
}
} catch (Exception e) {
/* ignore */
} finally { // ok
} finally {
/* ignore */
} // ok
}
}

void foo2() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ public class InputFormattedSeparatorWrap {
public void goodCase() {
int i = 0;
String s = "ffffooooString";
s.isEmpty(); // ok
s.isEmpty();
s.isEmpty();

foo(i, s); // ok
foo(i, s);
}

/** Some javadoc. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ public class InputFormattedSeparatorWrapComma {
public void goodCase() {
int i = 0;
String s = "ffffooooString";
s.isEmpty(); // ok
s.isEmpty();
s.isEmpty();

foo(i, s); // ok
foo(i, s);
}

/** Some javadoc. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ public void goodCase() {
int i = 0;
String s = "ffffooooString";
s
.isEmpty(); // ok
.isEmpty();
s.isEmpty();

foo(i,
s); // ok
s);
}

/** Some javadoc. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ public class InputSeparatorWrapComma {
public void goodCase() {
int i = 0;
String s = "ffffooooString";
s.isEmpty(); // ok
s.isEmpty();
s.isEmpty();

foo(i, s); // ok
foo(i, s);
}

/** Some javadoc. */
Expand Down
Loading

0 comments on commit b050607

Please sign in to comment.