Skip to content

Commit a2d2c4f

Browse files
authored
chore: enable lint presubmit and run code formatter (#312)
* Add lint test and com.coveo:fmt-maven-plugin configuration * Run the formatter
1 parent 7fbab45 commit a2d2c4f

File tree

51 files changed

+2491
-2058
lines changed

Some content is hidden

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

51 files changed

+2491
-2058
lines changed

google-auth-library-java/.kokoro/build.sh

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,21 @@ java -version
2222
echo $JOB_TYPE
2323

2424
mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
25-
mvn test -B
2625

27-
bash $KOKORO_GFILE_DIR/codecov.sh
26+
case ${JOB_TYPE} in
27+
test)
28+
mvn test -B
29+
bash ${KOKORO_GFILE_DIR}/codecov.sh
30+
;;
31+
lint)
32+
mvn com.coveo:fmt-maven-plugin:check
33+
;;
34+
javadoc)
35+
mvn javadoc:javadoc javadoc:test-javadoc
36+
;;
37+
integration)
38+
mvn -B -pl ${INTEGRATION_TEST_ARGS} -DtrimStackTrace=false -fae verify
39+
;;
40+
*)
41+
;;
42+
esac
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Configure the docker image for kokoro-trampoline.
4+
5+
env_vars: {
6+
key: "TRAMPOLINE_IMAGE"
7+
value: "gcr.io/cloud-devrel-kokoro-resources/java8"
8+
}
9+
10+
env_vars: {
11+
key: "JOB_TYPE"
12+
value: "lint"
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Configure the docker image for kokoro-trampoline.
4+
5+
env_vars: {
6+
key: "TRAMPOLINE_IMAGE"
7+
value: "gcr.io/cloud-devrel-kokoro-resources/java8"
8+
}
9+
10+
env_vars: {
11+
key: "JOB_TYPE"
12+
value: "lint"
13+
}

google-auth-library-java/appengine/java/com/google/auth/appengine/AppEngineCredentials.java

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
import com.google.common.base.MoreObjects;
4242
import com.google.common.collect.ImmutableList;
4343
import com.google.common.collect.ImmutableSet;
44-
4544
import java.io.IOException;
4645
import java.io.ObjectInputStream;
4746
import java.util.Collection;
@@ -58,9 +57,10 @@
5857
public class AppEngineCredentials extends GoogleCredentials implements ServiceAccountSigner {
5958

6059
private static final Logger LOGGER = Logger.getLogger(AppEngineCredentials.class.getName());
61-
private static final String APPLICATION_DEFAULT_CREDENTIALS_WARNING = "You are attempting to "
62-
+ "fetch Application Default Credentials from com.google.auth.appengine.AppEngineCredentials."
63-
+ " This method will not return a com.google.auth.appengine.AppEngineCredentials instance.";
60+
private static final String APPLICATION_DEFAULT_CREDENTIALS_WARNING =
61+
"You are attempting to "
62+
+ "fetch Application Default Credentials from com.google.auth.appengine.AppEngineCredentials."
63+
+ " This method will not return a com.google.auth.appengine.AppEngineCredentials instance.";
6464
private static final long serialVersionUID = -2627708355455064660L;
6565

6666
private final String appIdentityServiceClassName;
@@ -71,8 +71,9 @@ public class AppEngineCredentials extends GoogleCredentials implements ServiceAc
7171

7272
/**
7373
* {@inheritDoc}
74+
*
7475
* @deprecated AppEngineCredentials should be instantiated via its Builder. See
75-
* https://github.com/googleapis/google-auth-library-java#google-auth-library-appengine
76+
* https://github.com/googleapis/google-auth-library-java#google-auth-library-appengine
7677
*/
7778
@Deprecated
7879
public static GoogleCredentials getApplicationDefault() throws IOException {
@@ -82,8 +83,9 @@ public static GoogleCredentials getApplicationDefault() throws IOException {
8283

8384
/**
8485
* {@inheritDoc}
86+
*
8587
* @deprecated AppEngineCredentials should be instantiated via its Builder. See
86-
* https://github.com/googleapis/google-auth-library-java#google-auth-library-appengine
88+
* https://github.com/googleapis/google-auth-library-java#google-auth-library-appengine
8789
*/
8890
@Deprecated
8991
public static GoogleCredentials getApplicationDefault(HttpTransportFactory transportFactory)
@@ -94,15 +96,15 @@ public static GoogleCredentials getApplicationDefault(HttpTransportFactory trans
9496

9597
private AppEngineCredentials(Collection<String> scopes, AppIdentityService appIdentityService) {
9698
this.scopes = scopes == null ? ImmutableSet.<String>of() : ImmutableList.copyOf(scopes);
97-
this.appIdentityService = appIdentityService != null ? appIdentityService
98-
: AppIdentityServiceFactory.getAppIdentityService();
99+
this.appIdentityService =
100+
appIdentityService != null
101+
? appIdentityService
102+
: AppIdentityServiceFactory.getAppIdentityService();
99103
this.appIdentityServiceClassName = this.appIdentityService.getClass().getName();
100104
scopesRequired = this.scopes.isEmpty();
101105
}
102106

103-
/**
104-
* Refresh the access token by getting it from the App Identity service
105-
*/
107+
/** Refresh the access token by getting it from the App Identity service */
106108
@Override
107109
public AccessToken refreshAccessToken() throws IOException {
108110
if (createScopedRequired()) {
@@ -113,7 +115,7 @@ public AccessToken refreshAccessToken() throws IOException {
113115
Date expirationTime = accessTokenResponse.getExpirationTime();
114116
return new AccessToken(accessToken, expirationTime);
115117
}
116-
118+
117119
@Override
118120
public boolean createScopedRequired() {
119121
return scopesRequired;

0 commit comments

Comments
 (0)