Skip to content

Commit

Permalink
Issue checkstyle#3685: Refactoring for RightCurlyCheck.java
Browse files Browse the repository at this point in the history
Issue checkstyle#3685: formatted code properly
  • Loading branch information
sagarshah94 committed Mar 2, 2017
1 parent 1a49cda commit 36ddcdf
Showing 1 changed file with 16 additions and 8 deletions.
Expand Up @@ -175,20 +175,28 @@ public void visitToken(DetailAST ast) {

if (rcurly != null) {
final String violation;
if (shouldStartLine) {
final String targetSourceLine = getLines()[rcurly.getLineNo() - 1];
violation = validate(details, option, true, targetSourceLine);
}
else {
violation = validate(details, option, false, "");
}

violation = validate(details, option,
shouldStartLine, getTargetSourceLine(rcurly.getLineNo() - 1));
if (!violation.isEmpty()) {
log(rcurly, violation, "}", rcurly.getColumnNo() + 1);
}
}
}

/**
* Fetches line based on passed line no.
* @param lineNo for fetching lines.
* @return lines associated with line no.
*/
private String getTargetSourceLine(int lineNo) {
if (shouldStartLine) {
return getLines()[lineNo];
}
else {
return "";
}
}

/**
* Does general validation.
* @param details for validation.
Expand Down

0 comments on commit 36ddcdf

Please sign in to comment.