Skip to content

Commit bb88d02

Browse files
author
Quintin Willison
committed
Add the unnecessary ruleset to our use of CodeNarc, fixing violations.
1 parent dc285cd commit bb88d02

7 files changed

Lines changed: 32 additions & 31 deletions

File tree

android/build.gradle

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ android {
3535
targetSdkVersion 24
3636
versionCode 1
3737
versionName version
38-
setProperty("archivesBaseName", "ably-android-$versionName")
39-
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
40-
testInstrumentationRunnerArgument "class", "io.ably.lib.test.android.AndroidPushTest"
38+
setProperty('archivesBaseName', "ably-android-$versionName")
39+
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
40+
testInstrumentationRunnerArgument 'class', 'io.ably.lib.test.android.AndroidPushTest'
4141
//testInstrumentationRunnerArgument "class", "io.ably.lib.test.rest.RestSuite,io.ably.lib.test.realtime.RealtimeSuite,io.ably.lib.test.android.AndroidSuite,io.ably.lib.test.android.AndroidPushTest"
42-
testInstrumentationRunnerArgument "timeout_msec", "300000"
42+
testInstrumentationRunnerArgument 'timeout_msec', '300000'
4343
// testInstrumentationRunnerArgument "ABLY_ENV", "\"$System.env.ABLY_ENV\""
4444
consumerProguardFiles 'proguard.txt'
4545
}
@@ -87,9 +87,9 @@ dependencies {
8787
implementation 'com.google.firebase:firebase-messaging:17.3.4'
8888
androidTestImplementation 'com.android.support.test:runner:0.5'
8989
androidTestImplementation 'com.android.support.test:rules:0.5'
90-
androidTestImplementation "com.crittercism.dexmaker:dexmaker:1.4"
91-
androidTestImplementation "com.crittercism.dexmaker:dexmaker-dx:1.4"
92-
androidTestImplementation "com.crittercism.dexmaker:dexmaker-mockito:1.4"
90+
androidTestImplementation 'com.crittercism.dexmaker:dexmaker:1.4'
91+
androidTestImplementation 'com.crittercism.dexmaker:dexmaker-dx:1.4'
92+
androidTestImplementation 'com.crittercism.dexmaker:dexmaker-mockito:1.4'
9393
}
9494

9595
configurations {

android/maven.gradle

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
apply plugin: 'maven'
22
apply plugin: 'signing'
33

4-
final String groupId = "io.ably"
5-
final String artifactId = "ably-android"
4+
final String groupId = 'io.ably'
5+
final String artifactId = 'ably-android'
66
final String localReleaseDest = "${buildDir}/release/${version}"
77
final String mavenUser = hasProperty('ossrhUsername') ? ossrhUsername : ''
88
final String mavenPassword = hasProperty('ossrhPassword') ? ossrhPassword : ''
@@ -19,11 +19,11 @@ uploadArchives {
1919

2020
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
2121

22-
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
22+
repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/') {
2323
authentication(userName: mavenUser, password: mavenPassword)
2424
}
2525

26-
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
26+
snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots/') {
2727
authentication(userName: mavenUser, password: mavenPassword)
2828
}
2929
pom.groupId = groupId
@@ -70,7 +70,7 @@ uploadArchives {
7070
pom.whenConfigured { p ->
7171
p.dependencies = p.dependencies.findAll {
7272
// Exclude dependency on lib subproject.
73-
dep -> dep.artifactId != "lib"
73+
dep -> dep.artifactId != 'lib'
7474
}.findAll {
7575
// Exclude Google services since we don't want to impose a particular
7676
// version on users. Ideally we would specify a version range,
@@ -102,8 +102,8 @@ task zipRelease(type: Zip) {
102102
tasks.whenTaskAdded { task ->
103103
if (task.name == 'assembleRelease') {
104104
task.doLast {
105-
logger.quiet("Release ${version} can be found at ${localReleaseDest}/");
106-
logger.quiet("Release ${version} zipped can be found ${buildDir}/release-${version}.zip");
105+
logger.quiet("Release ${version} can be found at ${localReleaseDest}/")
106+
logger.quiet("Release ${version} zipped can be found ${buildDir}/release-${version}.zip")
107107
}
108108

109109
task.dependsOn(uploadArchives)
@@ -118,7 +118,7 @@ task sourcesJar(type: Jar) {
118118

119119
task javadoc(type: Javadoc) {
120120
source = android.sourceSets.main.java.srcDirs
121-
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
121+
classpath += project.files(android.bootClasspath.join(File.pathSeparator))
122122
failOnError false
123123
}
124124

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ repositories {
1010
}
1111

1212
nexusStaging {
13-
packageGroup = "io.ably"
13+
packageGroup = 'io.ably'
1414
}

common.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ repositories {
55

66
group = 'io.ably'
77
version = '1.2.2'
8-
description = """Ably java client library"""
8+
description = 'Ably java client library'
99

1010
tasks.withType(Javadoc) {
1111
// To prevent javadoc warnings with Java 8

gradle-lint/src/main/groovy/build-script-rules.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ ruleset {
1515
}
1616

1717
ruleset 'rulesets/groovyism.xml'
18+
ruleset 'rulesets/unnecessary.xml'
1819
}

java/build.gradle

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jar {
4343
baseName = 'ably-java'
4444
from {
4545
configurations.compile.collect { file ->
46-
file.isDirectory() ? file : zipTree(file)
46+
file.directory ? file : zipTree(file)
4747
}
4848
}
4949
includes = ['**/io/ably/**']
@@ -57,7 +57,7 @@ task fullJar(type: Jar) {
5757
classifier = 'full'
5858
from {
5959
configurations.compile.collect { file ->
60-
file.isDirectory() ? file : zipTree(file)
60+
file.directory ? file : zipTree(file)
6161
}
6262
}
6363
with jar
@@ -78,20 +78,20 @@ artifacts {
7878

7979
task testRealtimeSuite(type: Test) {
8080
filter {
81-
includeTestsMatching "*RealtimeSuite"
81+
includeTestsMatching '*RealtimeSuite'
8282
}
8383
beforeTest { descriptor ->
84-
logger.lifecycle("-> " + descriptor)
84+
logger.lifecycle("-> $descriptor")
8585
}
8686
outputs.upToDateWhen { false }
8787
}
8888

8989
task testRestSuite(type: Test) {
9090
filter {
91-
includeTestsMatching "*RestSuite"
91+
includeTestsMatching '*RestSuite'
9292
}
9393
beforeTest { descriptor ->
94-
logger.lifecycle("-> " + descriptor)
94+
logger.lifecycle("-> $descriptor")
9595
}
9696
outputs.upToDateWhen { false }
9797
}
@@ -104,11 +104,11 @@ as it only contains the REST and Realtime suites.
104104
*/
105105
task runUnitTests(type: Test) {
106106
filter {
107-
excludeTestsMatching "io.ably.lib.test.*"
107+
excludeTestsMatching 'io.ably.lib.test.*'
108108
}
109109
beforeTest { descriptor ->
110110
// informational, so we're not flying blind at runtime
111-
logger.lifecycle("-> " + descriptor)
111+
logger.lifecycle("-> $descriptor")
112112
}
113113

114114
// force tests to run every time this task is invoked

java/maven.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ apply plugin: 'java'
22
apply plugin: 'maven'
33
apply plugin: 'signing'
44

5-
final String groupId = "io.ably"
6-
final String artifactId = "ably-java"
5+
final String groupId = 'io.ably'
6+
final String artifactId = 'ably-java'
77
final String localReleaseDest = "${buildDir}/release/${version}"
88
final String mavenUser = hasProperty('ossrhUsername') ? ossrhUsername : ''
99
final String mavenPassword = hasProperty('ossrhPassword') ? ossrhPassword : ''
@@ -20,11 +20,11 @@ uploadArchives {
2020

2121
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
2222

23-
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
23+
repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/') {
2424
authentication(userName: mavenUser, password: mavenPassword)
2525
}
2626

27-
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
27+
snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots/') {
2828
authentication(userName: mavenUser, password: mavenPassword)
2929
}
3030

@@ -91,8 +91,8 @@ task zipRelease(type: Zip) {
9191

9292
task assembleRelease {
9393
doLast {
94-
logger.quiet("Release ${version} can be found at ${localReleaseDest}");
95-
logger.quiet("Release ${version} zipped can be found ${buildDir}/release-${version}.zip");
94+
logger.quiet("Release ${version} can be found at ${localReleaseDest}")
95+
logger.quiet("Release ${version} zipped can be found ${buildDir}/release-${version}.zip")
9696
}
9797
dependsOn(uploadArchives)
9898
dependsOn(zipRelease)

0 commit comments

Comments
 (0)