Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add checkstyle rules #723

Merged
merged 8 commits into from
May 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 23 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,29 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
<dependencies>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>autorest-build-tools</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>6.18</version>
</dependency>
</dependencies>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<propertyExpansion>samedir=runtimes/build-tools/src/main/resources</propertyExpansion>
<suppressionsLocation>suppressions.xml</suppressionsLocation>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down Expand Up @@ -133,12 +156,6 @@
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
Expand Down
3 changes: 2 additions & 1 deletion runtimes/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ android:
- extra-android-m2repository
sudo: false
script:
- mvn clean package
- mvn clean install
- mvn checkstyle:check
- cd ./azure-android-client-authentication && ./gradlew check
7 changes: 4 additions & 3 deletions runtimes/azure-client-authentication/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ apply plugin: 'checkstyle'
version = '1.0.0-SNAPSHOT'

checkstyle {
configFile = new File("$rootDir/Tools/checkstyle/checkstyle.xml")
configProperties = [samedir: "$rootDir/Tools/checkstyle"]
reportsDir = new File("$rootDir/Tools/checkstyle/reports")
toolVersion = "6.18"
configFile = new File("$rootDir/ClientRuntimes/Java/build-tools/src/main/resources/checkstyle.xml")
configProperties = [samedir: "$rootDir/ClientRuntimes/Java/build-tools/src/main/resources"]
reportsDir = new File("$rootDir/ClientRuntimes/Java/build-tools/reports")
}

dependencies {
Expand Down
8 changes: 4 additions & 4 deletions runtimes/azure-client-runtime/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ apply plugin: 'checkstyle'
version = '1.0.0-SNAPSHOT'

checkstyle {
toolVersion = "6.9"
configFile = new File("$rootDir/Tools/checkstyle/checkstyle.xml")
configProperties = [samedir: "$rootDir/Tools/checkstyle"]
reportsDir = new File("$rootDir/Tools/checkstyle/reports")
toolVersion = "6.18"
configFile = new File("$rootDir/ClientRuntimes/Java/build-tools/src/main/resources/checkstyle.xml")
configProperties = [samedir: "$rootDir/ClientRuntimes/Java/build-tools/src/main/resources"]
reportsDir = new File("$rootDir/ClientRuntimes/Java/build-tools/reports")
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
import com.microsoft.rest.ServiceResponse;
import com.microsoft.rest.ServiceResponseCallback;
import com.microsoft.rest.ServiceResponseWithHeaders;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.Response;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Url;

import java.io.IOException;
import java.lang.reflect.Type;
Expand All @@ -22,13 +28,6 @@
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.Response;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Url;

/**
* An instance of this class defines a ServiceClient that handles polling and
* retrying for long running operations when accessing Azure resources.
Expand Down Expand Up @@ -288,8 +287,7 @@ public <T> ServiceResponse<T> getPostOrDeleteResult(Response<ResponseBody> respo
}

// Check if operation failed
if (AzureAsyncOperation.getFailedStatuses().contains(pollingState.getStatus()))
{
if (AzureAsyncOperation.getFailedStatuses().contains(pollingState.getStatus())) {
throw new CloudException("Async operation failed");
}

Expand Down Expand Up @@ -778,7 +776,7 @@ class PutPatchPollingTask<T> extends AsyncPollingTask<T> {
* @param serviceCall the ServiceCall object tracking Retrofit calls.
* @param clientCallback the client callback to call when a terminal status is hit.
*/
public PutPatchPollingTask(final PollingState<T> pollingState, final String url, final ServiceCall serviceCall, final ServiceCallback<T> clientCallback) {
PutPatchPollingTask(final PollingState<T> pollingState, final String url, final ServiceCall serviceCall, final ServiceCallback<T> clientCallback) {
this.serviceCall = serviceCall;
this.pollingState = pollingState;
this.url = url;
Expand Down Expand Up @@ -835,7 +833,7 @@ class PostDeletePollingTask<T> extends AsyncPollingTask<T> {
* @param serviceCall the ServiceCall object tracking Retrofit calls.
* @param clientCallback the client callback to call when a terminal status is hit.
*/
public PostDeletePollingTask(final PollingState<T> pollingState, final ServiceCall serviceCall, final ServiceCallback<T> clientCallback) {
PostDeletePollingTask(final PollingState<T> pollingState, final ServiceCall serviceCall, final ServiceCallback<T> clientCallback) {
this.serviceCall = serviceCall;
this.pollingState = pollingState;
this.clientCallback = clientCallback;
Expand Down Expand Up @@ -867,8 +865,7 @@ public void run() {
}
} else {
// Check if operation failed
if (AzureAsyncOperation.getFailedStatuses().contains(pollingState.getStatus()))
{
if (AzureAsyncOperation.getFailedStatuses().contains(pollingState.getStatus())) {
clientCallback.failure(new ServiceException("Async operation failed"));
} else {
clientCallback.success(new ServiceResponse<>(pollingState.getResource(), pollingState.getResponse()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

import com.microsoft.rest.RestException;

import javax.xml.bind.DataBindingException;
import javax.xml.ws.WebServiceException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
Expand All @@ -17,9 +19,6 @@
import java.util.ListIterator;
import java.util.NoSuchElementException;

import javax.xml.bind.DataBindingException;
import javax.xml.ws.WebServiceException;

/**
* Defines a list response from a paging operation. The pages are
* lazy initialized when an instance of this class is iterated.
Expand Down Expand Up @@ -128,7 +127,7 @@ private class ListItr implements ListIterator<E> {
*
* @param index the position in the list to start.
*/
public ListItr(int index) {
ListItr(int index) {
itemsListItr = items.listIterator(index);
}

Expand Down
47 changes: 47 additions & 0 deletions runtimes/build-tools/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!--
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License. See License.txt in the project root for
license information.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.microsoft.azure</groupId>
<artifactId>autorest-clientruntime-for-java</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>autorest-build-tools</artifactId>
<packaging>jar</packaging>

<name>Build tools for AutoRest client runtime for Java</name>
<description>This package contains the build tools for AutoRest generated Java clients.</description>
<url>https://github.com/Azure/autorest-clientruntime-for-java</url>

<licenses>
<license>
<name>The MIT License (MIT)</name>
<url>http://opensource.org/licenses/MIT</url>
<distribution>repo</distribution>
</license>
</licenses>

<scm>
<url>scm:git:https://github.com/Azure/autorest-clientruntime-for-java</url>
<connection>scm:git:git@github.com:Azure/autorest-clientruntime-for-java.git</connection>
<tag>HEAD</tag>
</scm>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<legal><![CDATA[[INFO] Any downloads listed may be third party software. Microsoft grants you no rights for third party software.]]></legal>
</properties>

<developers>
<developer>
<id>microsoft</id>
<name>Microsoft</name>
</developer>
</developers>
</project>
Loading