Skip to content

Commit

Permalink
Fix some code smells
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcel Steinbeck committed Dec 13, 2023
1 parent d99dd0a commit 01d3224
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ default Type getType() {
Validate.validateState(old.isPresent() || nev.isPresent(),
"Neither the old nor the new file is available");

if (!old.isPresent()) {
if (old.isEmpty()) {
return Type.ADD;
}
if (!nev.isPresent()) {
if (nev.isEmpty()) {
return Type.REMOVE;
}
return old.get().getRelativePath()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ default List<Issue> getIssues() {
* otherwise.
*/
default boolean isFirst() {
return !getPredecessorRevision().isPresent();
return getPredecessorRevision().isEmpty();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ private LocalDateTime parseDateTime(final String pDateTime,
} catch (final ParseException ignored) { /* try next */ }
try {
final int year = Integer.parseInt(pDateTime);
return LocalDateTime.of(year, 0, 0, 0, 0);
return LocalDateTime.of(year, 1, 1, 0, 0);
} catch (final NumberFormatException |
DateTimeParseException ignored) { /* try next */ }
throw new IllegalArgumentException(String.format(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public RevisionRange next() {
try {
final Optional<RevisionRange> range =
AbstractVSCEngine.this.next();
if (!range.isPresent()) {
if (range.isEmpty()) {
throw new NoSuchElementException();
}
return range.get();
Expand Down

0 comments on commit 01d3224

Please sign in to comment.