Skip to content

Commit ac0f9ea

Browse files
committed
Normalise format/indentation of source code
Set up the Spotless plugin to check/enforce the format/indentation of the whole source code, currently set to use Google Java Style (AOSP).
1 parent da84956 commit ac0f9ea

File tree

77 files changed

+6581
-6400
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+6581
-6400
lines changed

build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ subprojects {
2828
spotless {
2929
java {
3030
licenseHeaderFile "$rootDir/gradle/spotless/license.java"
31+
32+
googleJavaFormat().style('AOSP')
3133
}
3234
}
3335
}

subprojects/zap-clientapi-ant/src/main/java/org/zaproxy/clientapi/ant/AbstractActiveScanTask.java

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,32 @@
2525

2626
public abstract class AbstractActiveScanTask extends ZapTask {
2727

28-
private String url;
29-
30-
public String getUrl() {
31-
return url;
32-
}
33-
34-
public void setUrl(String url) {
35-
this.url = url;
36-
}
37-
38-
@Override
39-
public void execute() throws BuildException {
40-
try {
41-
waitForActiveScan(extractValue(startScan()));
42-
} catch (Exception e) {
43-
throw new BuildException(e);
44-
}
45-
}
46-
47-
protected abstract ApiResponse startScan() throws ClientApiException;
48-
49-
private void waitForActiveScan(String scanId) throws ClientApiException, InterruptedException {
50-
int progress;
51-
do {
52-
progress = Integer.parseInt(extractValue(getClientApi().ascan.status(scanId)));
53-
Thread.sleep(1000);
54-
} while (progress < 100);
55-
}
28+
private String url;
29+
30+
public String getUrl() {
31+
return url;
32+
}
33+
34+
public void setUrl(String url) {
35+
this.url = url;
36+
}
37+
38+
@Override
39+
public void execute() throws BuildException {
40+
try {
41+
waitForActiveScan(extractValue(startScan()));
42+
} catch (Exception e) {
43+
throw new BuildException(e);
44+
}
45+
}
46+
47+
protected abstract ApiResponse startScan() throws ClientApiException;
48+
49+
private void waitForActiveScan(String scanId) throws ClientApiException, InterruptedException {
50+
int progress;
51+
do {
52+
progress = Integer.parseInt(extractValue(getClientApi().ascan.status(scanId)));
53+
Thread.sleep(1000);
54+
} while (progress < 100);
55+
}
5656
}

subprojects/zap-clientapi-ant/src/main/java/org/zaproxy/clientapi/ant/AccessUrlTask.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,24 @@
2222
import org.apache.tools.ant.BuildException;
2323

2424
public class AccessUrlTask extends ZapTask {
25-
26-
private String url;
27-
28-
@Override
29-
public void execute() throws BuildException {
30-
try {
31-
this.getClientApi().accessUrl(url);
32-
33-
} catch (Exception e) {
34-
throw new BuildException(e);
35-
}
36-
}
3725

38-
public String getUrl() {
39-
return url;
40-
}
26+
private String url;
4127

42-
public void setUrl(String url) {
43-
this.url = url;
44-
}
28+
@Override
29+
public void execute() throws BuildException {
30+
try {
31+
this.getClientApi().accessUrl(url);
32+
33+
} catch (Exception e) {
34+
throw new BuildException(e);
35+
}
36+
}
37+
38+
public String getUrl() {
39+
return url;
40+
}
41+
42+
public void setUrl(String url) {
43+
this.url = url;
44+
}
4545
}

subprojects/zap-clientapi-ant/src/main/java/org/zaproxy/clientapi/ant/ActiveScanSubtreeTask.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@
2424

2525
public class ActiveScanSubtreeTask extends AbstractActiveScanTask {
2626

27-
@Override
28-
protected ApiResponse startScan() throws ClientApiException {
29-
return this.getClientApi().ascan.scan(getUrl(), "true", "false", "", "", "");
30-
}
31-
27+
@Override
28+
protected ApiResponse startScan() throws ClientApiException {
29+
return this.getClientApi().ascan.scan(getUrl(), "true", "false", "", "", "");
30+
}
3231
}

subprojects/zap-clientapi-ant/src/main/java/org/zaproxy/clientapi/ant/ActiveScanUrlTask.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424

2525
public class ActiveScanUrlTask extends AbstractActiveScanTask {
2626

27-
@Override
28-
protected ApiResponse startScan() throws ClientApiException {
29-
return this.getClientApi().ascan.scan(getUrl(), "false", "false", "", "", "");
30-
}
27+
@Override
28+
protected ApiResponse startScan() throws ClientApiException {
29+
return this.getClientApi().ascan.scan(getUrl(), "false", "false", "", "", "");
30+
}
3131
}

subprojects/zap-clientapi-ant/src/main/java/org/zaproxy/clientapi/ant/AlertCheckTask.java

Lines changed: 50 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -21,47 +21,60 @@
2121

2222
import java.util.ArrayList;
2323
import java.util.List;
24-
2524
import org.apache.tools.ant.BuildException;
2625
import org.zaproxy.clientapi.core.Alert;
2726

2827
public class AlertCheckTask extends ZapTask {
29-
30-
private List<AlertTask> ignoreAlertTasks = new ArrayList<>();
31-
private List<AlertTask> requireAlertTasks = new ArrayList<>();
32-
33-
@Override
34-
public void execute() throws BuildException {
35-
try {
36-
List<Alert> ignoreAlerts = new ArrayList<>(ignoreAlertTasks.size());
37-
List<Alert> requireAlerts = new ArrayList<>(requireAlertTasks.size());
38-
for (AlertTask alert: ignoreAlertTasks) {
39-
ignoreAlerts.add(new Alert(alert.getName(), alert.getUrl(), alert.getRisk(), alert.getConfidence(), alert.getParam(), alert.getOther()));
40-
}
41-
for (AlertTask alert: requireAlertTasks) {
42-
requireAlerts.add(new Alert(alert.getName(), alert.getUrl(), alert.getRisk(), alert.getConfidence(), alert.getParam(), alert.getOther()));
43-
}
44-
45-
this.getClientApi().checkAlerts(ignoreAlerts, requireAlerts);
46-
47-
} catch (Exception e) {
48-
throw new BuildException(e);
49-
}
50-
}
5128

52-
public void addIgnoreAlert(AlertTask alert) {
53-
this.ignoreAlertTasks.add(alert);
54-
}
55-
56-
public void addRequireAlert(AlertTask alert) {
57-
this.requireAlertTasks.add(alert);
58-
}
59-
60-
public List<AlertTask> getIgnoreAlerts() {
61-
return ignoreAlertTasks;
62-
}
29+
private List<AlertTask> ignoreAlertTasks = new ArrayList<>();
30+
private List<AlertTask> requireAlertTasks = new ArrayList<>();
31+
32+
@Override
33+
public void execute() throws BuildException {
34+
try {
35+
List<Alert> ignoreAlerts = new ArrayList<>(ignoreAlertTasks.size());
36+
List<Alert> requireAlerts = new ArrayList<>(requireAlertTasks.size());
37+
for (AlertTask alert : ignoreAlertTasks) {
38+
ignoreAlerts.add(
39+
new Alert(
40+
alert.getName(),
41+
alert.getUrl(),
42+
alert.getRisk(),
43+
alert.getConfidence(),
44+
alert.getParam(),
45+
alert.getOther()));
46+
}
47+
for (AlertTask alert : requireAlertTasks) {
48+
requireAlerts.add(
49+
new Alert(
50+
alert.getName(),
51+
alert.getUrl(),
52+
alert.getRisk(),
53+
alert.getConfidence(),
54+
alert.getParam(),
55+
alert.getOther()));
56+
}
57+
58+
this.getClientApi().checkAlerts(ignoreAlerts, requireAlerts);
59+
60+
} catch (Exception e) {
61+
throw new BuildException(e);
62+
}
63+
}
64+
65+
public void addIgnoreAlert(AlertTask alert) {
66+
this.ignoreAlertTasks.add(alert);
67+
}
68+
69+
public void addRequireAlert(AlertTask alert) {
70+
this.requireAlertTasks.add(alert);
71+
}
72+
73+
public List<AlertTask> getIgnoreAlerts() {
74+
return ignoreAlertTasks;
75+
}
6376

64-
public List<AlertTask> getRequireAlerts() {
65-
return requireAlertTasks;
66-
}
77+
public List<AlertTask> getRequireAlerts() {
78+
return requireAlertTasks;
79+
}
6780
}

0 commit comments

Comments
 (0)