Skip to content

Commit

Permalink
style: code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
yiteam committed Jun 2, 2023
1 parent d9eeb5f commit 0a5b0ac
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
5 changes: 4 additions & 1 deletion src/main/java/team/yi/gradle/plugin/BaseTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
import de.skuzzle.semantic.Version;
import lombok.extern.slf4j.Slf4j;
import org.gradle.api.DefaultTask;
import org.gradle.api.tasks.*;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.Optional;
import org.gradle.api.tasks.OutputFile;
import org.gradle.api.tasks.TaskAction;
import org.gradle.api.tasks.options.Option;
import team.yi.tools.semanticgitlog.VersionStrategy;
import team.yi.tools.semanticgitlog.config.GitlogSettings;
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/team/yi/gradle/plugin/ChangelogTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@
import team.yi.tools.semanticgitlog.git.GitRepo;
import team.yi.tools.semanticgitlog.model.ReleaseLog;
import team.yi.tools.semanticgitlog.render.MustacheGitlogRender;
import team.yi.tools.semanticgitlog.service.*;
import team.yi.tools.semanticgitlog.service.CommitLocaleService;
import team.yi.tools.semanticgitlog.service.GitlogService;
import team.yi.tools.semanticgitlog.service.ScopeProfileService;

import java.io.File;
import java.io.IOException;
import java.util.*;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

@Slf4j
public class ChangelogTask extends BaseTask {
Expand Down Expand Up @@ -54,9 +58,7 @@ public void execute(final GitRepo gitRepo) throws IOException {
}

private void saveToFile(final GitRepo gitRepo) throws IOException {
Set<FileSet> fileSets = this.getFileSets();

if (fileSets == null) fileSets = new HashSet<>();
final Set<FileSet> fileSets = new HashSet<>(this.getFileSets());

if (fileSets.isEmpty()) {
if (log.isInfoEnabled()) {
Expand All @@ -69,8 +71,6 @@ private void saveToFile(final GitRepo gitRepo) throws IOException {
fileSets.add(new FileSet(template, target));
}

if (fileSets.isEmpty()) return;

final GitlogSettings gitlogSettings = this.gitlogSettings();

final CommitLocaleService commitLocaleProvider = new CommitLocaleService(gitlogSettings.getDefaultLang());
Expand Down

0 comments on commit 0a5b0ac

Please sign in to comment.