From 8f13d14ff07d587fe2a57c94ccf1d2219091251a Mon Sep 17 00:00:00 2001 From: Blake Ball Date: Thu, 30 Mar 2017 13:09:23 -0500 Subject: [PATCH 1/9] :bug: fix checkstyle ignore failure --- build.gradle | 4 ---- core/build.gradle | 4 ---- dialog/build.gradle | 3 --- 3 files changed, 11 deletions(-) diff --git a/build.gradle b/build.gradle index 278ed990bb1..701717e05b6 100644 --- a/build.gradle +++ b/build.gradle @@ -45,10 +45,6 @@ allprojects { subprojects { - checkstyleTest { - ignoreFailures = true - } - afterEvaluate { if (plugins.hasPlugin(JavaPlugin)) { rootProject.tasks.docs { diff --git a/core/build.gradle b/core/build.gradle index e0cce6588b2..d09e480a4ba 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -49,13 +49,9 @@ signArchives { } } -checkstyleTest { - ignoreFailures = true -} checkstyle { configFile = rootProject.file('checkstyle.xml') - ignoreFailures = true } task testJar(type: Jar) { diff --git a/dialog/build.gradle b/dialog/build.gradle index 05d7944b9da..fa650490246 100644 --- a/dialog/build.gradle +++ b/dialog/build.gradle @@ -49,9 +49,6 @@ signArchives { } } -checkstyleTest { - ignoreFailures = true -} checkstyle { configFile = rootProject.file('checkstyle.xml') } From 077417e122ec7a3811ef3809c7511a7f25e389e3 Mon Sep 17 00:00:00 2001 From: Blake Ball Date: Thu, 30 Mar 2017 14:11:03 -0500 Subject: [PATCH 2/9] :bug: test that checkstyle fails build --- .../developer_cloud/speech_to_text/v1/SpeechToTextTest.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/speech-to-text/src/test/java/com/ibm/watson/developer_cloud/speech_to_text/v1/SpeechToTextTest.java b/speech-to-text/src/test/java/com/ibm/watson/developer_cloud/speech_to_text/v1/SpeechToTextTest.java index 272130ca849..c09228103ca 100755 --- a/speech-to-text/src/test/java/com/ibm/watson/developer_cloud/speech_to_text/v1/SpeechToTextTest.java +++ b/speech-to-text/src/test/java/com/ibm/watson/developer_cloud/speech_to_text/v1/SpeechToTextTest.java @@ -388,9 +388,7 @@ public void testCreateRecognitionJob() throws InterruptedException, FileNotFound String id = "foo"; RecognitionJob job = loadFixture("src/test/resources/speech_to_text/job.json", RecognitionJob.class); - server.enqueue(new MockResponse() - .addHeader(CONTENT_TYPE, HttpMediaType.APPLICATION_JSON) - .setBody(GSON.toJson(job)) + server.enqueue(new MockResponse().addHeader(CONTENT_TYPE, HttpMediaType.APPLICATION_JSON).setBody(GSON.toJson(job)) ); RecognitionJob result = service.getRecognitionJob(id).execute(); From 496f2f41b75238bf89fe9d4484bf92aa94220c78 Mon Sep 17 00:00:00 2001 From: Blake Ball Date: Thu, 30 Mar 2017 15:09:23 -0500 Subject: [PATCH 3/9] :bug: test that checkstyle fails build --- build.gradle | 4 ++++ .../developer_cloud/speech_to_text/v1/SpeechToTextTest.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 701717e05b6..6f21ea9a1e2 100644 --- a/build.gradle +++ b/build.gradle @@ -45,6 +45,10 @@ allprojects { subprojects { + checkstyleTest { + ignoreFailures = false + } + afterEvaluate { if (plugins.hasPlugin(JavaPlugin)) { rootProject.tasks.docs { diff --git a/speech-to-text/src/test/java/com/ibm/watson/developer_cloud/speech_to_text/v1/SpeechToTextTest.java b/speech-to-text/src/test/java/com/ibm/watson/developer_cloud/speech_to_text/v1/SpeechToTextTest.java index c09228103ca..a544080ef23 100755 --- a/speech-to-text/src/test/java/com/ibm/watson/developer_cloud/speech_to_text/v1/SpeechToTextTest.java +++ b/speech-to-text/src/test/java/com/ibm/watson/developer_cloud/speech_to_text/v1/SpeechToTextTest.java @@ -388,7 +388,7 @@ public void testCreateRecognitionJob() throws InterruptedException, FileNotFound String id = "foo"; RecognitionJob job = loadFixture("src/test/resources/speech_to_text/job.json", RecognitionJob.class); - server.enqueue(new MockResponse().addHeader(CONTENT_TYPE, HttpMediaType.APPLICATION_JSON).setBody(GSON.toJson(job)) + server.enqueue(new MockResponse().addHeader(CONTENT_TYPE, HttpMediaType.APPLICATION_JSON).setBody(GSON.toJson(job)) ); RecognitionJob result = service.getRecognitionJob(id).execute(); From 9e442bed79ad29a613d104a64c920b4e77c55b3c Mon Sep 17 00:00:00 2001 From: Blake Ball Date: Thu, 30 Mar 2017 16:05:25 -0500 Subject: [PATCH 4/9] :bug: checkstyle ignoreFailure false --- alchemy/build.gradle | 1 + conversation/build.gradle | 1 + core/build.gradle | 1 + dialog/build.gradle | 1 + discovery/build.gradle | 4 ++-- document-conversion/build.gradle | 1 + java-sdk/build.gradle | 4 ++-- language-translation/build.gradle | 1 + language-translator/build.gradle | 1 + natural-language-classifier/build.gradle | 4 ++-- natural-language-understanding/build.gradle | 1 + personality-insights/build.gradle | 1 + retrieve-and-rank/build.gradle | 1 + speech-to-text/build.gradle | 5 +++++ .../developer_cloud/speech_to_text/v1/SpeechToTextTest.java | 4 +++- text-to-speech/build.gradle | 1 + tone-analyzer/build.gradle | 1 + tradeoff-analytics/build.gradle | 1 + visual-recognition/build.gradle | 4 ++-- 19 files changed, 29 insertions(+), 9 deletions(-) diff --git a/alchemy/build.gradle b/alchemy/build.gradle index c359a9fb9a8..79388f8f6eb 100644 --- a/alchemy/build.gradle +++ b/alchemy/build.gradle @@ -51,6 +51,7 @@ signArchives { checkstyle { configFile = rootProject.file('checkstyle.xml') + ignoreFailures = false } dependencies { diff --git a/conversation/build.gradle b/conversation/build.gradle index 6ae2f4f4e6a..8144c7cc135 100644 --- a/conversation/build.gradle +++ b/conversation/build.gradle @@ -51,6 +51,7 @@ signArchives { checkstyle { configFile = rootProject.file('checkstyle.xml') + ignoreFailures = false } dependencies { diff --git a/core/build.gradle b/core/build.gradle index d09e480a4ba..d3603ea02f5 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -52,6 +52,7 @@ signArchives { checkstyle { configFile = rootProject.file('checkstyle.xml') + ignoreFailures = false } task testJar(type: Jar) { diff --git a/dialog/build.gradle b/dialog/build.gradle index fa650490246..89fb4be4299 100644 --- a/dialog/build.gradle +++ b/dialog/build.gradle @@ -51,6 +51,7 @@ signArchives { checkstyle { configFile = rootProject.file('checkstyle.xml') + ignoreFailures = false } task testJar(type: Jar) { diff --git a/discovery/build.gradle b/discovery/build.gradle index c8f2e26897d..7a7e1f2fa50 100644 --- a/discovery/build.gradle +++ b/discovery/build.gradle @@ -50,12 +50,12 @@ signArchives { } checkstyleTest { - ignoreFailures = true + ignoreFailures = false } checkstyle { configFile = rootProject.file('checkstyle.xml') - ignoreFailures = true + ignoreFailures = false } dependencies { diff --git a/document-conversion/build.gradle b/document-conversion/build.gradle index bd73f24dc49..6a0f685688a 100644 --- a/document-conversion/build.gradle +++ b/document-conversion/build.gradle @@ -51,6 +51,7 @@ signArchives { checkstyle { configFile = rootProject.file('checkstyle.xml') + ignoreFailures = false } dependencies { diff --git a/java-sdk/build.gradle b/java-sdk/build.gradle index 1832b6dba4e..ea81fbae672 100644 --- a/java-sdk/build.gradle +++ b/java-sdk/build.gradle @@ -58,12 +58,12 @@ signArchives { } checkstyleTest { - ignoreFailures = true + ignoreFailures = false } checkstyle { configFile = rootProject.file('checkstyle.xml') - ignoreFailures = true + ignoreFailures = false } task testJar(type: Jar) { diff --git a/language-translation/build.gradle b/language-translation/build.gradle index fe5471c1bd0..90bea4844d4 100644 --- a/language-translation/build.gradle +++ b/language-translation/build.gradle @@ -51,6 +51,7 @@ signArchives { checkstyle { configFile = rootProject.file('checkstyle.xml') + ignoreFailures = false } dependencies { diff --git a/language-translator/build.gradle b/language-translator/build.gradle index e802c516ab0..364ba8e67fa 100644 --- a/language-translator/build.gradle +++ b/language-translator/build.gradle @@ -51,6 +51,7 @@ signArchives { checkstyle { configFile = rootProject.file('checkstyle.xml') + ignoreFailures = false } dependencies { diff --git a/natural-language-classifier/build.gradle b/natural-language-classifier/build.gradle index 8ea18151de4..317d94ae457 100644 --- a/natural-language-classifier/build.gradle +++ b/natural-language-classifier/build.gradle @@ -50,12 +50,12 @@ signArchives { } checkstyleTest { - ignoreFailures = true + ignoreFailures = false } checkstyle { configFile = rootProject.file('checkstyle.xml') - ignoreFailures = true + ignoreFailures = false } dependencies { diff --git a/natural-language-understanding/build.gradle b/natural-language-understanding/build.gradle index 4131fcd4723..7158f4f733d 100644 --- a/natural-language-understanding/build.gradle +++ b/natural-language-understanding/build.gradle @@ -51,6 +51,7 @@ signArchives { checkstyle { configFile = rootProject.file('checkstyle.xml') + ignoreFailures = false } dependencies { diff --git a/personality-insights/build.gradle b/personality-insights/build.gradle index ceaaa4581dd..01ee609fec7 100644 --- a/personality-insights/build.gradle +++ b/personality-insights/build.gradle @@ -51,6 +51,7 @@ signArchives { checkstyle { configFile = rootProject.file('checkstyle.xml') + ignoreFailures = false } dependencies { diff --git a/retrieve-and-rank/build.gradle b/retrieve-and-rank/build.gradle index bee1cb9be16..111a0dfb6aa 100644 --- a/retrieve-and-rank/build.gradle +++ b/retrieve-and-rank/build.gradle @@ -51,6 +51,7 @@ signArchives { checkstyle { configFile = rootProject.file('checkstyle.xml') + ignoreFailures = false } dependencies { diff --git a/speech-to-text/build.gradle b/speech-to-text/build.gradle index 52a1e240f0b..61e34327000 100644 --- a/speech-to-text/build.gradle +++ b/speech-to-text/build.gradle @@ -49,8 +49,13 @@ signArchives { } } +checkstyleTest { + ignoreFailures = false +} + checkstyle { configFile = rootProject.file('checkstyle.xml') + ignoreFailures = false } dependencies { diff --git a/speech-to-text/src/test/java/com/ibm/watson/developer_cloud/speech_to_text/v1/SpeechToTextTest.java b/speech-to-text/src/test/java/com/ibm/watson/developer_cloud/speech_to_text/v1/SpeechToTextTest.java index a544080ef23..272130ca849 100755 --- a/speech-to-text/src/test/java/com/ibm/watson/developer_cloud/speech_to_text/v1/SpeechToTextTest.java +++ b/speech-to-text/src/test/java/com/ibm/watson/developer_cloud/speech_to_text/v1/SpeechToTextTest.java @@ -388,7 +388,9 @@ public void testCreateRecognitionJob() throws InterruptedException, FileNotFound String id = "foo"; RecognitionJob job = loadFixture("src/test/resources/speech_to_text/job.json", RecognitionJob.class); - server.enqueue(new MockResponse().addHeader(CONTENT_TYPE, HttpMediaType.APPLICATION_JSON).setBody(GSON.toJson(job)) + server.enqueue(new MockResponse() + .addHeader(CONTENT_TYPE, HttpMediaType.APPLICATION_JSON) + .setBody(GSON.toJson(job)) ); RecognitionJob result = service.getRecognitionJob(id).execute(); diff --git a/text-to-speech/build.gradle b/text-to-speech/build.gradle index e40e914d0e9..605b3f13293 100644 --- a/text-to-speech/build.gradle +++ b/text-to-speech/build.gradle @@ -51,6 +51,7 @@ signArchives { checkstyle { configFile = rootProject.file('checkstyle.xml') + ignoreFailures = false } dependencies { diff --git a/tone-analyzer/build.gradle b/tone-analyzer/build.gradle index da0897a7adf..479060e5786 100644 --- a/tone-analyzer/build.gradle +++ b/tone-analyzer/build.gradle @@ -51,6 +51,7 @@ signArchives { checkstyle { configFile = rootProject.file('checkstyle.xml') + ignoreFailures = false } dependencies { diff --git a/tradeoff-analytics/build.gradle b/tradeoff-analytics/build.gradle index 34551041b75..52e6ff64f3b 100644 --- a/tradeoff-analytics/build.gradle +++ b/tradeoff-analytics/build.gradle @@ -51,6 +51,7 @@ signArchives { checkstyle { configFile = rootProject.file('checkstyle.xml') + ignoreFailures = false } dependencies { diff --git a/visual-recognition/build.gradle b/visual-recognition/build.gradle index 1be13ac38a5..da3e28a4b8b 100644 --- a/visual-recognition/build.gradle +++ b/visual-recognition/build.gradle @@ -50,12 +50,12 @@ signArchives { } checkstyleTest { - ignoreFailures = true + ignoreFailures = false } checkstyle { configFile = rootProject.file('checkstyle.xml') - ignoreFailures = true + ignoreFailures = false } dependencies { From cd8702648c4df1eb8b21bd9e3b01d4d7fcc2807b Mon Sep 17 00:00:00 2001 From: Blake Ball Date: Mon, 3 Apr 2017 11:00:49 -0500 Subject: [PATCH 5/9] :bug: checkstyle block --- build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.gradle b/build.gradle index 6f21ea9a1e2..a1217df6bfe 100644 --- a/build.gradle +++ b/build.gradle @@ -17,6 +17,10 @@ javadoc { source = 'src/main/java' } +checkstyle { + ignoreFailures = false +} + task docs(type: Javadoc) { destinationDir = file("$buildDir/docs/all") } From aeedfa7859ec91eb6aba80d7f9b641c60aaef19e Mon Sep 17 00:00:00 2001 From: Blake Ball Date: Mon, 3 Apr 2017 21:49:13 -0500 Subject: [PATCH 6/9] :bug: add more specific checkstyle blocks --- build.gradle | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/build.gradle b/build.gradle index a1217df6bfe..bff5f8770b9 100644 --- a/build.gradle +++ b/build.gradle @@ -21,6 +21,15 @@ checkstyle { ignoreFailures = false } +checkstyleMain { + ignoreFailures = false +} + +checkstyleTest { + ignoreFailures = false +} + + task docs(type: Javadoc) { destinationDir = file("$buildDir/docs/all") } @@ -49,6 +58,10 @@ allprojects { subprojects { + checkstyleMain { + ignoreFailures = false + } + checkstyleTest { ignoreFailures = false } From 856a1d22cb52d10abe78275c8602388b1796c502 Mon Sep 17 00:00:00 2001 From: Blake Ball Date: Mon, 3 Apr 2017 22:08:14 -0500 Subject: [PATCH 7/9] :bug: checkstyle added to travis --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 215d2572edb..1769051582c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,6 +34,8 @@ script: - ./gradlew test - ./gradlew codeCoverageReport - ./gradlew docs > /dev/null # build the javadoc + - ./gradlew checkstyleMain + - ./gradlew checkstyleTest after_success: - bash <(curl -s https://codecov.io/bash) From 98cce9c8d6e5c99c1b3de6d24f93f54a3fa6c682 Mon Sep 17 00:00:00 2001 From: Blake Ball Date: Mon, 3 Apr 2017 22:20:54 -0500 Subject: [PATCH 8/9] :bug: checkstyle fix trailing space --- .../com/ibm/watson/developer_cloud/service/WatsonService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/com/ibm/watson/developer_cloud/service/WatsonService.java b/core/src/main/java/com/ibm/watson/developer_cloud/service/WatsonService.java index d1e7e302f21..a6063b671b4 100644 --- a/core/src/main/java/com/ibm/watson/developer_cloud/service/WatsonService.java +++ b/core/src/main/java/com/ibm/watson/developer_cloud/service/WatsonService.java @@ -134,7 +134,7 @@ protected OkHttpClient configureHttpClient() { .build(); builder.connectionSpecs(Arrays.asList(spec, ConnectionSpec.CLEARTEXT)); - + return builder.build(); } From 9a4d5d72dc587474a257c0551f651886133a87ad Mon Sep 17 00:00:00 2001 From: Blake Ball Date: Mon, 3 Apr 2017 22:38:28 -0500 Subject: [PATCH 9/9] :bug: checkstyle fixes --- .../com/ibm/watson/developer_cloud/util/WaitFor.java | 4 +++- .../discovery/v1/DiscoveryServiceTest.java | 9 ++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/core/src/test/java/com/ibm/watson/developer_cloud/util/WaitFor.java b/core/src/test/java/com/ibm/watson/developer_cloud/util/WaitFor.java index b161c2ee557..4120bc59502 100644 --- a/core/src/test/java/com/ibm/watson/developer_cloud/util/WaitFor.java +++ b/core/src/test/java/com/ibm/watson/developer_cloud/util/WaitFor.java @@ -21,7 +21,9 @@ public class WaitFor { - private WaitFor() {} + private WaitFor() { + + } /** * Static method used to wait for a specific condition to be satisfied. diff --git a/discovery/src/test/java/com/ibm/watson/developer_cloud/discovery/v1/DiscoveryServiceTest.java b/discovery/src/test/java/com/ibm/watson/developer_cloud/discovery/v1/DiscoveryServiceTest.java index 7020cfc6e4b..9b9a6b2a711 100644 --- a/discovery/src/test/java/com/ibm/watson/developer_cloud/discovery/v1/DiscoveryServiceTest.java +++ b/discovery/src/test/java/com/ibm/watson/developer_cloud/discovery/v1/DiscoveryServiceTest.java @@ -73,7 +73,14 @@ import static org.junit.Assert.assertEquals; -import java.io.*; +import java.io.FileReader; +import java.io.FileNotFoundException; +import java.io.InputStream; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.BufferedWriter; import java.util.HashSet; import java.util.Set;