Skip to content

Commit b24b109

Browse files
committed
cleanup
1 parent 5a54ab4 commit b24b109

File tree

5 files changed

+14
-15
lines changed

5 files changed

+14
-15
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,8 @@ spotlessChangelog { // all defaults
174174
remote 'origin'
175175
branch 'main'
176176
// default value is false, but if you set it to true, then it will
177-
// disable ssh host key checking (.ssh/known_hosts)
177+
// disable ssh host key checking (.ssh/known_hosts).
178+
// Can also set by command line arg `-PsshDisableStrictHostKeyChecking`.
178179
sshDisableStrictHostKeyChecking false
179180
}
180181

spotless-changelog-lib/src/main/java/com/diffplug/spotless/changelog/GitActions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void checkCanPush() throws GitAPIException, IOException {
7373
}
7474
push(cfg.branch, RemoteRefUpdate.Status.UP_TO_DATE);
7575
} catch (GitAPIException e) {
76-
throw new IllegalArgumentException("You can set user/pass with any of these environment variables: " + envVars(), e);
76+
throw new IllegalArgumentException("You can set user/pass with any of these environment variables: " + envVars() + ", or try -PsshDisableStrictHostKeyChecking on ssh remotes", e);
7777
}
7878
}
7979

spotless-changelog-lib/src/main/java/com/diffplug/spotless/changelog/GitCfg.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019-2020 DiffPlug
2+
* Copyright (C) 2019-2021 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

spotless-changelog-plugin-gradle/src/main/java/com/diffplug/spotless/changelog/gradle/ChangelogExtension.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019-2020 DiffPlug
2+
* Copyright (C) 2019-2021 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -54,7 +54,7 @@ public ChangelogExtension(Project project) {
5454
/**
5555
* Parses the changelog and calculates the next version. Once this
5656
* has been done, the user can't change the configuration at all.
57-
* Use {@link #assertNotCalculatedYet()} on every mutation to check for this.
57+
* Use {@link #assertNotCalculatedYet()} on every mutation to check for this.
5858
*/
5959
ChangelogAndNext model() {
6060
if (model == null) {
@@ -123,7 +123,7 @@ public void versionSchema(Class<? extends NextVersionFunction> functionClass) th
123123
* If any of these strings are found in the `## [Unreleased]` section, then the
124124
* next version will bump the `added` place in `breaking.added.fixed` (unless
125125
* overruled by `ifFoundBumpBreaking`).
126-
*
126+
*
127127
* Default value is `['### Added']`
128128
*/
129129
public void ifFoundBumpAdded(List<String> toFind) {
@@ -139,7 +139,7 @@ public void ifFoundBumpAdded(String... toFind) {
139139
/**
140140
* If any of these strings are found in the `## [Unreleased]` section, then the
141141
* next version will bump the `breaking` place in `breaking.added.fixed`.
142-
*
142+
*
143143
* Default value is `['**BREAKING**']`.
144144
*/
145145
public void ifFoundBumpBreaking(List<String> toFind) {
@@ -163,7 +163,7 @@ public void forceNextVersion(String forceNextVersion) {
163163
* appended to the end, unless you add `-Prelease=true` to the gradle command line.
164164
* Essentially, it asks like a gun safety where all versions are nerfed to `-SNAPSHOT`,
165165
* until you allow a release by adding `-Prelease`.
166-
*
166+
*
167167
* Enabling this mode should look like this in your buildscript: `appendDashSnapshotUnless_dashPrelease=true`
168168
*/
169169
public void setAppendDashSnapshotUnless_dashPrelease(boolean appendSnapshot) {
@@ -175,15 +175,12 @@ public void setAppendDashSnapshotUnless_dashPrelease(boolean appendSnapshot) {
175175
/**
176176
* If you set this to true, then the ssh host key checking over ssh:// remotes will be disabled.
177177
* By default strict host key checking is enabled. Make sure that there is an entry
178-
* in the know_hosts file for given ssh remote.
179-
* You can add `-PsshDisableStrictHostKeyChecking=true` to the gradle command.
180-
* Note: this command line parameter overrides buildscript setting.
178+
* in know_hosts file for given ssh remote.
179+
* You can also add `-PsshDisableStrictHostKeyChecking` to the gradle command.
181180
* In your buildscript you can disable checking with `sshDisableStrictHostKeyChecking = true`
182181
*/
183182
public void setSshDisableStrictHostKeyChecking(boolean disableStrictHostKeyChecking) {
184-
gitCfg.disableStrictHostKeyChecking = project.getRootProject().hasProperty("sshDisableStrictHostKeyChecking")
185-
? Boolean.parseBoolean((String) project.getRootProject().property("sshDisableStrictHostKeyChecking"))
186-
: disableStrictHostKeyChecking;
183+
gitCfg.disableStrictHostKeyChecking = disableStrictHostKeyChecking;
187184
}
188185

189186
// tag and push

spotless-changelog-plugin-gradle/src/main/java/com/diffplug/spotless/changelog/gradle/ChangelogPlugin.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019-2020 DiffPlug
2+
* Copyright (C) 2019-2021 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -46,6 +46,7 @@ public void apply(Project project) {
4646

4747
ChangelogExtension extension = project.getExtensions().create(ChangelogExtension.NAME, ChangelogExtension.class, project);
4848
project.getTasks().register(PrintTask.NAME, PrintTask.class, extension);
49+
extension.gitCfg.disableStrictHostKeyChecking = project.getRootProject().findProperty("sshDisableStrictHostKeyChecking") != null;
4950

5051
TaskProvider<CheckTask> check = project.getTasks().register(CheckTask.NAME, CheckTask.class, extension);
5152
TaskProvider<BumpTask> bump = project.getTasks().register(BumpTask.NAME, BumpTask.class, extension);

0 commit comments

Comments
 (0)