Skip to content

Commit

Permalink
Create result entries even when no changes (#429)
Browse files Browse the repository at this point in the history
The primary purpose of this change is to enable the collection of
codemod descriptions even when no actual changes are present. It also
aligns codemodder-java with the existing behavior of codemodder-python.
  • Loading branch information
drdavella authored Jul 25, 2024
1 parent bf886d3 commit 964f558
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@ void it_injects_dependency_even_when_no_poms_included() throws Exception {

verifyNoFailedFiles(report);
List<CodeTFResult> results = report.getResults();
assertThat(results.size(), is(1));
CodeTFResult result = results.get(0);
CodeTFResult result =
results.stream()
.filter(r -> r.getCodemod().equals("pixee:java/harden-java-deserialization"))
.findFirst()
.orElseThrow();
List<CodeTFChangesetEntry> changeset = result.getChangeset();
assertThat(changeset.size(), is(3));
assertThat(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,8 @@ public Integer call() throws IOException {

log.info("running codemod: {}", codemod.getId());
CodeTFResult result = codemodExecutor.execute(filePaths);
if (!result.getChangeset().isEmpty() || !result.getFailedFiles().isEmpty()) {
results.add(result);
}
results.add(result);

if (!result.getChangeset().isEmpty()) {
log.info("changed:");
result
Expand Down

0 comments on commit 964f558

Please sign in to comment.