Skip to content

Commit

Permalink
Issue checkstyle#14955: updated LineLength ignorePattern property in …
Browse files Browse the repository at this point in the history
…google config
  • Loading branch information
Zopsss authored and romani committed Jun 12, 2024
1 parent 5875fce commit e637a1b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public void testLineLength() throws Exception {
final String[] expected = {
"5: " + getCheckMessage(LineLengthCheck.class, "maxLineLen", 100, 112),
"29: " + getCheckMessage(LineLengthCheck.class, "maxLineLen", 100, 113),
"198: " + getCheckMessage(LineLengthCheck.class, "maxLineLen", 100, 154),
};

final Configuration checkConfig = getModuleConfig("LineLength");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,28 @@ void toManyArgs(int aArg1, int aArg2, int aArg3, int aArg4, int aArg5,
int aArg6, int aArg7, int aArg8, int aArg9)
{
}

/**
* Very long url with https: https://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java
*/
String https = "200 OK";

/**
* Very long url with http: http://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java
*/
String http = "200 OK";

// Very long url with ftp: ftp://ftp.example.com/areallyyyyyyyyyyyylongggggggggggggggggggggggurlllll.text
int ftp = 0;

// Very long url with invalid href: href="www.google.com/search?hl=en&q=java+style+guide+checkstyle+check+href+length+limit&btnG=Google+Search // warn
int invalidHref = 88;

// Very long url with valid href: href="www.google.com/search?hl=en&q=java+style+guide+checkstyle+check+href+length+limit&btnG=Google+Search"
int validHref = 54;

// Very long url with valid href: href = "www.google.com/search?hl=en&q=java+style+guide+checkstyle+check+href+length+limit&btnG=Google+Search"
int validHrefWithWhiteSpaces = 54;
}

/** Test class for variable naming in for each clause. */
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/google_checks.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
<module name="LineLength">
<property name="fileExtensions" value="java"/>
<property name="max" value="100"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
<property name="ignorePattern"
value="^package.*|^import.*|href\s*=\s*&quot;[^&quot;]*&quot;|http://|https://|ftp://"/>
</module>

<module name="TreeWalker">
Expand Down

0 comments on commit e637a1b

Please sign in to comment.