Skip to content

Commit

Permalink
chore: enable lint presubmit and run code formatter (#312)
Browse files Browse the repository at this point in the history
* Add lint test and com.coveo:fmt-maven-plugin configuration

* Run the formatter
  • Loading branch information
chingor13 committed Jul 30, 2019
1 parent 2815eb9 commit 58fbdea
Show file tree
Hide file tree
Showing 51 changed files with 2,491 additions and 2,058 deletions.
19 changes: 17 additions & 2 deletions .kokoro/build.sh
Expand Up @@ -22,6 +22,21 @@ java -version
echo $JOB_TYPE

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

bash $KOKORO_GFILE_DIR/codecov.sh
case ${JOB_TYPE} in
test)
mvn test -B
bash ${KOKORO_GFILE_DIR}/codecov.sh
;;
lint)
mvn com.coveo:fmt-maven-plugin:check
;;
javadoc)
mvn javadoc:javadoc javadoc:test-javadoc
;;
integration)
mvn -B -pl ${INTEGRATION_TEST_ARGS} -DtrimStackTrace=false -fae verify
;;
*)
;;
esac
13 changes: 13 additions & 0 deletions .kokoro/continuous/lint.cfg
@@ -0,0 +1,13 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Configure the docker image for kokoro-trampoline.

env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/java8"
}

env_vars: {
key: "JOB_TYPE"
value: "lint"
}
13 changes: 13 additions & 0 deletions .kokoro/presubmit/lint.cfg
@@ -0,0 +1,13 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Configure the docker image for kokoro-trampoline.

env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/java8"
}

env_vars: {
key: "JOB_TYPE"
value: "lint"
}
26 changes: 14 additions & 12 deletions appengine/java/com/google/auth/appengine/AppEngineCredentials.java
Expand Up @@ -41,7 +41,6 @@
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.Collection;
Expand All @@ -58,9 +57,10 @@
public class AppEngineCredentials extends GoogleCredentials implements ServiceAccountSigner {

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

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

/**
* {@inheritDoc}
*
* @deprecated AppEngineCredentials should be instantiated via its Builder. See
* https://github.com/googleapis/google-auth-library-java#google-auth-library-appengine
* https://github.com/googleapis/google-auth-library-java#google-auth-library-appengine
*/
@Deprecated
public static GoogleCredentials getApplicationDefault() throws IOException {
Expand All @@ -82,8 +83,9 @@ public static GoogleCredentials getApplicationDefault() throws IOException {

/**
* {@inheritDoc}
*
* @deprecated AppEngineCredentials should be instantiated via its Builder. See
* https://github.com/googleapis/google-auth-library-java#google-auth-library-appengine
* https://github.com/googleapis/google-auth-library-java#google-auth-library-appengine
*/
@Deprecated
public static GoogleCredentials getApplicationDefault(HttpTransportFactory transportFactory)
Expand All @@ -94,15 +96,15 @@ public static GoogleCredentials getApplicationDefault(HttpTransportFactory trans

private AppEngineCredentials(Collection<String> scopes, AppIdentityService appIdentityService) {
this.scopes = scopes == null ? ImmutableSet.<String>of() : ImmutableList.copyOf(scopes);
this.appIdentityService = appIdentityService != null ? appIdentityService
: AppIdentityServiceFactory.getAppIdentityService();
this.appIdentityService =
appIdentityService != null
? appIdentityService
: AppIdentityServiceFactory.getAppIdentityService();
this.appIdentityServiceClassName = this.appIdentityService.getClass().getName();
scopesRequired = this.scopes.isEmpty();
}

/**
* Refresh the access token by getting it from the App Identity service
*/
/** Refresh the access token by getting it from the App Identity service */
@Override
public AccessToken refreshAccessToken() throws IOException {
if (createScopedRequired()) {
Expand All @@ -113,7 +115,7 @@ public AccessToken refreshAccessToken() throws IOException {
Date expirationTime = accessTokenResponse.getExpirationTime();
return new AccessToken(accessToken, expirationTime);
}

@Override
public boolean createScopedRequired() {
return scopesRequired;
Expand Down

0 comments on commit 58fbdea

Please sign in to comment.