Skip to content

Commit 2e37358

Browse files
committed
Some code style changes
1 parent 7482fdb commit 2e37358

File tree

7 files changed

+22
-38
lines changed

7 files changed

+22
-38
lines changed

src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ public abstract class AbstractGitFlowMojo extends AbstractMojo {
206206
*
207207
* @since 1.18.0
208208
*/
209-
@Parameter(property="projectVersionPolicyId")
209+
@Parameter(property = "projectVersionPolicyId")
210210
private String projectVersionPolicyId;
211211

212212
/** Maven session. */
@@ -222,8 +222,9 @@ public abstract class AbstractGitFlowMojo extends AbstractMojo {
222222
/** Maven settings. */
223223
@Parameter(defaultValue = "${settings}", readonly = true)
224224
protected Settings settings;
225+
225226
@Component
226-
protected Map<String,VersionPolicy> versionPolicies;
227+
protected Map<String, VersionPolicy> versionPolicies;
227228

228229
/**
229230
* Initializes command line executables.
@@ -1414,5 +1415,4 @@ protected VersionPolicy getVersionPolicy() {
14141415
}
14151416
return null;
14161417
}
1417-
14181418
}

src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowFeatureStartMojo.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
145145
properties.put("featureName", featureBranchName);
146146

147147
// git commit -a -m updating versions for feature branch
148-
gitCommit(commitMessages.getFeatureStartMessage(),
149-
properties);
148+
gitCommit(commitMessages.getFeatureStartMessage(), properties);
150149
}
151150
}
152151

@@ -156,8 +155,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
156155
}
157156

158157
if (pushRemote) {
159-
gitPush(gitFlowConfig.getFeatureBranchPrefix()
160-
+ featureBranchName, false);
158+
gitPush(gitFlowConfig.getFeatureBranchPrefix() + featureBranchName, false);
161159
}
162160
} catch (CommandLineException | VersionParseException e) {
163161
throw new MojoFailureException("feature-start", e);

src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowHotfixFinishMojo.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,11 @@ public void execute() throws MojoExecutionException, MojoFailureException {
164164
// support branch hotfix
165165
String supportBranchName = null;
166166
boolean supportHotfix = hotfixBranchName
167-
.startsWith(gitFlowConfig.getHotfixBranchPrefix()
168-
+ gitFlowConfig.getSupportBranchPrefix());
167+
.startsWith(gitFlowConfig.getHotfixBranchPrefix() + gitFlowConfig.getSupportBranchPrefix());
169168
// get support branch name w/o version part
170169
if (supportHotfix) {
171-
supportBranchName = hotfixBranchName.substring(
172-
gitFlowConfig.getHotfixBranchPrefix().length());
173-
supportBranchName = supportBranchName.substring(0,
174-
supportBranchName.lastIndexOf('/'));
170+
supportBranchName = hotfixBranchName.substring(gitFlowConfig.getHotfixBranchPrefix().length());
171+
supportBranchName = supportBranchName.substring(0, supportBranchName.lastIndexOf('/'));
175172
}
176173

177174
// fetch and check remote
@@ -260,8 +257,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
260257
// check whether release branch exists
261258
// git for-each-ref --count=1 --format="%(refname:short)"
262259
// refs/heads/release/*
263-
final String releaseBranch = gitFindBranches(
264-
gitFlowConfig.getReleaseBranchPrefix(), true);
260+
final String releaseBranch = gitFindBranches(gitFlowConfig.getReleaseBranchPrefix(), true);
265261

266262
if (supportBranchName == null) {
267263
// if release branch exists merge hotfix changes into it

src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowHotfixStartMojo.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
110110
branches[i] = supportBranches[i];
111111
}
112112
// add production branch to the list
113-
branches[supportBranches.length] = gitFlowConfig
114-
.getProductionBranch();
113+
branches[supportBranches.length] = gitFlowConfig.getProductionBranch();
115114

116115
List<String> numberedList = new ArrayList<>();
117116
StringBuilder str = new StringBuilder("Branches:")
@@ -125,8 +124,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
125124
String branchNumber = null;
126125
try {
127126
while (StringUtils.isBlank(branchNumber)) {
128-
branchNumber = prompter.prompt(str.toString(),
129-
numberedList);
127+
branchNumber = prompter.prompt(str.toString(), numberedList);
130128
}
131129
} catch (PrompterException e) {
132130
throw new MojoFailureException("hotfix-start", e);
@@ -162,7 +160,8 @@ public void execute() throws MojoExecutionException, MojoFailureException {
162160
final String currentVersion = getCurrentProjectVersion();
163161

164162
// get default hotfix version
165-
final String defaultVersion = new GitFlowVersionInfo(currentVersion, getVersionPolicy()).hotfixVersion(tychoBuild, hotfixVersionDigitToIncrement);
163+
final String defaultVersion = new GitFlowVersionInfo(currentVersion, getVersionPolicy()).hotfixVersion(tychoBuild,
164+
hotfixVersionDigitToIncrement);
166165

167166
if (defaultVersion == null) {
168167
throw new MojoFailureException(

src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowReleaseFinishMojo.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
274274
if (!skipTag) {
275275
String tagVersion = currentVersion;
276276
if ((tychoBuild || useSnapshotInRelease) && ArtifactUtils.isSnapshot(currentVersion)) {
277-
tagVersion = currentVersion.replace("-"
278-
+ Artifact.SNAPSHOT_VERSION, "");
277+
tagVersion = currentVersion.replace("-" + Artifact.SNAPSHOT_VERSION, "");
279278
}
280279

281280
messageProperties.put("version", tagVersion);
@@ -327,12 +326,10 @@ public void execute() throws MojoExecutionException, MojoFailureException {
327326
if (!commitDevelopmentVersionAtStart) {
328327
// get next snapshot version
329328
final String nextSnapshotVersion;
330-
if (!settings.isInteractiveMode()
331-
&& StringUtils.isNotBlank(developmentVersion)) {
329+
if (!settings.isInteractiveMode() && StringUtils.isNotBlank(developmentVersion)) {
332330
nextSnapshotVersion = developmentVersion;
333331
} else {
334-
GitFlowVersionInfo versionInfo = new GitFlowVersionInfo(
335-
currentVersion, getVersionPolicy());
332+
GitFlowVersionInfo versionInfo = new GitFlowVersionInfo(currentVersion, getVersionPolicy());
336333
if (digitsOnlyDevVersion) {
337334
versionInfo = versionInfo.digitsVersionInfo();
338335
}
@@ -342,8 +339,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
342339
}
343340

344341
if (StringUtils.isBlank(nextSnapshotVersion)) {
345-
throw new MojoFailureException(
346-
"Next snapshot version is blank.");
342+
throw new MojoFailureException("Next snapshot version is blank.");
347343
}
348344

349345
// mvn versions:set -DnewVersion=... -DgenerateBackupPoms=false

src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowReleaseStartMojo.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
152152
checkUncommittedChanges();
153153

154154
// git for-each-ref --count=1 refs/heads/release/*
155-
final String releaseBranch = gitFindBranches(
156-
gitFlowConfig.getReleaseBranchPrefix(), true);
155+
final String releaseBranch = gitFindBranches(gitFlowConfig.getReleaseBranchPrefix(), true);
157156

158157
if (StringUtils.isNotBlank(releaseBranch)) {
159158
throw new MojoFailureException(
@@ -217,14 +216,12 @@ public void execute() throws MojoExecutionException, MojoFailureException {
217216
if (commitDevelopmentVersionAtStart) {
218217
// mvn versions:set ...
219218
// git commit -a -m ...
220-
commitProjectVersion(projectVersion,
221-
commitMessages.getReleaseStartMessage());
219+
commitProjectVersion(projectVersion, commitMessages.getReleaseStartMessage());
222220

223221
// git branch release/... develop
224222
gitCreateBranch(fullBranchName, startPoint);
225223

226-
final String nextSnapshotVersion =
227-
getNextSnapshotVersion(releaseVersion);
224+
final String nextSnapshotVersion = getNextSnapshotVersion(releaseVersion);
228225

229226
// mvn versions:set ...
230227
// git commit -a -m ...
@@ -238,8 +235,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
238235

239236
// mvn versions:set ...
240237
// git commit -a -m ...
241-
commitProjectVersion(projectVersion,
242-
commitMessages.getReleaseStartMessage());
238+
commitProjectVersion(projectVersion, commitMessages.getReleaseStartMessage());
243239
}
244240

245241
if (installProject) {

src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowVersionInfo.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,7 @@ private String nextVersion(final Integer index, boolean snapshot) {
113113
VersionPolicyRequest request = new VersionPolicyRequest().setVersion(this.toString());
114114
if (snapshot) {
115115
return versionPolicy.getDevelopmentVersion(request).getVersion();
116-
}
117-
else {
116+
} else {
118117
return versionPolicy.getReleaseVersion(request).getVersion();
119118
}
120119
} catch (PolicyException | VersionParseException ex) {

0 commit comments

Comments
 (0)