Skip to content

Commit

Permalink
fix(#1426): less ifs
Browse files Browse the repository at this point in the history
  • Loading branch information
maxonfjvipon committed Oct 18, 2024
1 parent 5a47ed1 commit e494ec3
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions eo-maven-plugin/src/main/java/org/eolang/maven/fp/Footprint.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,8 @@ public Path apply(final Func<Path, String> content) throws Exception {
);
}
final Path result;
if (Footprint.exists(this.target)) {
if (Footprint.isAfter(this.target, this.source)) {
result = this.target;
} else {
result = this.dependentOnCache(content);
}
if (Footprint.exists(this.target) && Footprint.isAfter(this.target, this.source)) {
result = this.target;
} else {
result = this.dependentOnCache(content);
}
Expand All @@ -112,18 +108,13 @@ public Path apply(final Func<Path, String> content) throws Exception {
* @param content Content function
* @return Path to target
* @throws IOException If fails to check files last modified time
* @checkstyle NestedIfDepthCheck (30 lines)
*/
private Path dependentOnCache(final Func<Path, String> content) throws Exception {
final Path result;
if (this.cache.cacheable()) {
final Path cached = this.cache.path();
if (Footprint.exists(cached)) {
if (Footprint.isAfter(cached, this.source)) {
result = this.copiedFromCache();
} else {
result = this.updatedAll(content);
}
if (Footprint.exists(cached) && Footprint.isAfter(cached, this.source)) {
result = this.copiedFromCache();
} else {
result = this.updatedAll(content);
}
Expand Down

0 comments on commit e494ec3

Please sign in to comment.