Skip to content

Commit

Permalink
#2231 - redundant parentheses in comments
Browse files Browse the repository at this point in the history
  • Loading branch information
maxonfjvipon committed Jul 11, 2023
1 parent de0e4c9 commit 9a92959
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ final class RedundantParentheses implements Predicate<String> {
/**
* Pattern for string literals.
*/
private static final Pattern PATTERN = Pattern.compile("(?ms)\"\"\".*?\"\"\"|\".*?\"");
private static final Pattern PATTERN = Pattern.compile("(?ms)#.*?\\n|\"\"\".*?\"\"\"|\".*?\"");

/**
* The callback that will be called in case if redundant parentheses is found.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ static Stream<Arguments> testCases() {
Arguments.of("[] > foo\n ((1.add 1)) > x", false),
Arguments.of("[] > foo\n 1.add 1 > x\n (1.add 1)", false),
Arguments.of("[] > foo\n 1.add 1 > x\n (1.add 1) > y", false),
Arguments.of("[] > foo\n add > x\n (1)\n (1)\n", false)
Arguments.of("[] > foo\n add > x\n (1)\n (1)\n", false),
Arguments.of("# Comment().\n[] > obj\n", true)
);
}
}

0 comments on commit 9a92959

Please sign in to comment.