Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Jan 18, 2016
2 parents 0dd2974 + 687c040 commit 74e6144
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private void checkMethod(final String[] lines, final int start,
final boolean oneliner = start == end - 1;
for (int pos = start; pos < end; ++pos) {
final String line = lines[pos].trim();
if (line.startsWith("//")) {
if (line.startsWith("//") || line.startsWith("/*")) {
final String comment = line.substring(2).trim();
if (!comment.startsWith("@checkstyle") && !oneliner) {
this.log(pos + 1, "Comments in method body are prohibited");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,36 @@ public final class Invalid {
* Comments.
*/
public Invalid(String name, String value) {
/* Comments */
int i;
// Comments
}
public void print(String format, String text) {
// Comments
int c = 0;
/* Comments */
}

public int invalidCommentInside() {
final int first = 1;
/* invalid comment */ final int second = 2;
return first + second;
}

public int invalidMultilineInside() {
/**
* invalid multiline comment
*/
}

void submit() {
new Runnable() {
@Override
public void run() {
/* run
*/
}
};
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,8 @@ public interface ValidInterface {
* Some method with no body
*/
void method();

/* Some plain comment outside method*/
void method();
/* Another plain comment outside method */
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
11:Comments in method body are prohibited
14:Comments in method body are prohibited
10:Comments in method body are prohibited
12:Comments in method body are prohibited
15:Comments in method body are prohibited
17:Comments in method body are prohibited
22:Comments in method body are prohibited
27:Comments in method body are prohibited
36:Comments in method body are prohibited

0 comments on commit 74e6144

Please sign in to comment.