Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ public GeneratePatchFile(String repoPath, String testerPath,
this.repository = new FileRepositoryBuilder().setGitDir(gitDir)
.readEnvironment().findGitDir().build();
git = new Git(repository);
}
catch (IOException ex) {
} catch (IOException ex) {
ex.printStackTrace();
}
diffReportDirName = new File(".").getAbsoluteFile().getParent() + "/DiffReport";
Expand Down Expand Up @@ -261,14 +260,11 @@ private void generateTwoCommitDiffPatch(RevCommit commitOld, RevCommit commitNew
private void generateDiffPatchWithGitCommand(int headNum, String patchFormat) throws Exception {
if ("show".equals(patchFormat)) {
runShellCommand("git show > show.patch");
}
else if ("diff".equals(patchFormat)) {
} else if ("diff".equals(patchFormat)) {
runShellCommand("git diff HEAD~1 HEAD > show.patch");
}
else if ("format".equals(patchFormat)) {
} else if ("format".equals(patchFormat)) {
runShellCommand("git format-patch -1");
}
else {
} else {
throw new IllegalArgumentException("patchFormat should be 'show', 'diff' or 'format'");
}
final File repoDir = new File(repoPath);
Expand Down Expand Up @@ -405,8 +401,7 @@ private void generateSummaryIndexHtml() {
}
out.write("</h2>\n</body></html>");

}
catch (IOException ex) {
} catch (IOException ex) {
ex.printStackTrace();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ public static void main(String[] args) throws Exception {
final String commitParam = args[6];
if (commitParam.matches("(0|[1-9]\\d*)")) {
generatePatchFile.generatePatch(Integer.parseInt(args[6]));
}
else {
} else {
final String[] commitIds = commitParam.split(",");
final Set<String> commitSet = new HashSet<>(Arrays.asList(commitIds));
generatePatchFile.generatePatch(commitSet);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ public static void copyDir(File src, File dest) throws IOException {
final File destFile = new File(dest, file);
copyDir(srcFile, destFile);
}
}
else {
} else {
final InputStream inputStream = new FileInputStream(src);
final OutputStream outputStream = new FileOutputStream(dest);
final int size = 1024;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,7 @@ public boolean accept(TreeWalkerAuditEvent event) {
&& (isNeverSuppressCheck(event)
|| isMatchingByContextStrategy(event)
|| isLineMatching(event));
}
else {
} else {
result = isFileNameMatching(event)
&& (isNeverSuppressCheck(event)
|| isLineMatching(event));
Expand Down Expand Up @@ -238,8 +237,7 @@ private boolean lineMatching(int currentLine) {
final int endLine = singleLineRangeList.get(1) + 1;
if (startLine == endLine) {
result = currentLine == startLine;
}
else {
} else {
result = currentLine >= startLine && currentLine < endLine;
}
if (result) {
Expand Down Expand Up @@ -311,8 +309,7 @@ private DetailAST getAncestorAst(TreeWalkerAuditEvent event) {
eventAst = eventAst.getParent();
}
}
}
else if (containsShortName(checkNamesForContextStrategyByTokenOrParentSet, event)) {
} else if (containsShortName(checkNamesForContextStrategyByTokenOrParentSet, event)) {
if (eventAst != null) {
eventAst = eventAst.getParent();
}
Expand Down Expand Up @@ -408,8 +405,7 @@ private static void setChildAstLineNo(Map<String, Integer> childAstLineNoMap, De
final int lineNo = ast.getLineNo();
if (lineNo < childAstLineNoMap.get(MIN)) {
childAstLineNoMap.put(MIN, lineNo);
}
else if (lineNo > childAstLineNoMap.get(MAX)) {
} else if (lineNo > childAstLineNoMap.get(MAX)) {
childAstLineNoMap.put(MAX, lineNo);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,13 @@ private void addSingleLineRange(List<List<Integer>> lineRangeList, Edit edit) {
if (lineRange != null) {
lineRangeList.add(lineRange);
}
}
else if (Strategy.PATCHEDLINE == strategy) {
} else if (Strategy.PATCHEDLINE == strategy) {
final List<Integer> lineRange = getLineRange(edit,
Arrays.asList(Edit.Type.INSERT, Edit.Type.REPLACE));
if (lineRange != null) {
lineRangeList.add(lineRange);
}
}
else {
} else {
final List<Integer> lineRange = getLineRange(edit,
Arrays.asList(Edit.Type.INSERT, Edit.Type.REPLACE,
Edit.Type.DELETE));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,10 @@ public void finishLocalSetup() throws CheckstyleException {
if (optional) {
if (FilterUtil.isFileExists(file)) {
loadPatchFile();
}
else {
} else {
filters = new HashSet<>();
}
}
else {
} else {
loadPatchFile();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,10 @@ public void finishLocalSetup() throws CheckstyleException {
if (optional) {
if (FilterUtil.isFileExists(file)) {
loadPatchFile();
}
else {
} else {
filters = new PatchFilterSet();
}
}
else {
} else {
loadPatchFile();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ private static boolean isTreeWalkerChecksMatching(AuditEvent event) {
result = true;
}
return result;
}
catch (ClassNotFoundException ex) {
} catch (ClassNotFoundException ex) {
throw new IllegalStateException("Class " + sourceName + " not found", ex);
}
}
Expand Down
Loading