Skip to content

Commit

Permalink
Issue #2639: RE is removed from allowed abbreviations
Browse files Browse the repository at this point in the history
  • Loading branch information
romani committed Nov 25, 2015
1 parent f8d7894 commit 56df508
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion config/checkstyle_checks.xml
Expand Up @@ -320,7 +320,7 @@
<module name="AbbreviationAsWordInName">
<property name="ignoreFinal" value="false"/>
<property name="allowedAbbreviationLength" value="1"/>
<property name="allowedAbbreviations" value="AST,CPP,RTE,RE,CSV"/>
<property name="allowedAbbreviations" value="AST,CPP,RTE,CSV"/>
</module>
<module name="AbstractClassName"/>
<module name="ClassTypeParameterName"/>
Expand Down
Expand Up @@ -87,9 +87,9 @@ public class WriteTagCheck
public static final String TAG_FORMAT = "type.tagFormat";

/** Compiled regexp to match tag. **/
private Pattern tagRE;
private Pattern tagRegExp;
/** Compiled regexp to match tag content. **/
private Pattern tagFormatRE;
private Pattern tagFormatRegExp;

/** Regexp to match tag. */
private String tag;
Expand All @@ -104,7 +104,7 @@ public class WriteTagCheck
*/
public void setTag(String tag) {
this.tag = tag;
tagRE = CommonUtils.createPattern(tag + "\\s*(.*$)");
tagRegExp = CommonUtils.createPattern(tag + "\\s*(.*$)");
}

/**
Expand All @@ -113,7 +113,7 @@ public void setTag(String tag) {
*/
public void setTagFormat(String format) {
tagFormat = format;
tagFormatRE = CommonUtils.createPattern(format);
tagFormatRegExp = CommonUtils.createPattern(format);
}

/**
Expand Down Expand Up @@ -174,19 +174,19 @@ public void visitToken(DetailAST ast) {
* @param comment the Javadoc comment for the type definition.
*/
private void checkTag(int lineNo, String... comment) {
if (tagRE == null) {
if (tagRegExp == null) {
return;
}

int tagCount = 0;
for (int i = 0; i < comment.length; i++) {
final String commentValue = comment[i];
final Matcher matcher = tagRE.matcher(commentValue);
final Matcher matcher = tagRegExp.matcher(commentValue);
if (matcher.find()) {
tagCount += 1;
final int contentStart = matcher.start(1);
final String content = commentValue.substring(contentStart);
if (tagFormatRE == null || tagFormatRE.matcher(content).find()) {
if (tagFormatRegExp == null || tagFormatRegExp.matcher(content).find()) {
logTag(lineNo + i - comment.length, tag, content);
}
else {
Expand Down

0 comments on commit 56df508

Please sign in to comment.