Skip to content

Commit 4ba91e8

Browse files
John Burnswakingrufus
authored andcommitted
clean up some ArchRule violations
1 parent 2d65f50 commit 4ba91e8

File tree

10 files changed

+30
-19
lines changed

10 files changed

+30
-19
lines changed

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ dependencies {
5151
testImplementation("uk.org.webcompere:system-stubs-junit4:2.0.1")
5252
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.13.4")
5353
testImplementation("org.junit.jupiter:junit-jupiter-params:5.13.4")
54+
archRulesTestImplementation("org.spockframework:spock-junit4:2.3-groovy-4.0")
5455
}
5556

5657
tasks.withType<Test> {

gradle.lockfile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
cglib:cglib-nodep:3.2.2=archRulesTestRuntimeClasspath,integTestRuntimeClasspath,runtimeClasspath,testRuntimeClasspath
55
com.netflix.nebula:nebula-archrules-core:0.5.3=archRulesCompileClasspath,archRulesRuntimeClasspath,archRulesTestCompileClasspath,archRulesTestRuntimeClasspath
66
com.tngtech.archunit:archunit:1.4.1=archRulesCompileClasspath,archRulesRuntimeClasspath,archRulesTestCompileClasspath,archRulesTestRuntimeClasspath
7-
junit:junit:4.13.2=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
7+
junit:junit:4.13.2=archRulesTestCompileClasspath,archRulesTestRuntimeClasspath,compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
88
net.bytebuddy:byte-buddy-agent:1.11.13=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
99
net.bytebuddy:byte-buddy:1.15.11=archRulesCompileClasspath,archRulesRuntimeClasspath,archRulesTestCompileClasspath,archRulesTestRuntimeClasspath,compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
10-
org.apache.groovy:groovy-bom:4.0.4=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
11-
org.apache.groovy:groovy:4.0.4=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
10+
org.apache.groovy:groovy-bom:4.0.4=archRulesTestCompileClasspath,archRulesTestRuntimeClasspath,compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
11+
org.apache.groovy:groovy:4.0.4=archRulesTestCompileClasspath,archRulesTestRuntimeClasspath,compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
1212
org.apiguardian:apiguardian-api:1.1.2=archRulesCompileClasspath,archRulesTestCompileClasspath,compileClasspath,integTestCompileClasspath,testCompileClasspath
1313
org.assertj:assertj-core:3.27.3=archRulesCompileClasspath,archRulesRuntimeClasspath,archRulesTestCompileClasspath,archRulesTestRuntimeClasspath,compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
14-
org.hamcrest:hamcrest-core:1.3=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
15-
org.hamcrest:hamcrest:2.2=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
14+
org.hamcrest:hamcrest-core:1.3=archRulesTestCompileClasspath,archRulesTestRuntimeClasspath,compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
15+
org.hamcrest:hamcrest:2.2=archRulesTestCompileClasspath,archRulesTestRuntimeClasspath,compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
1616
org.jetbrains.kotlin:kotlin-reflect:2.2.0=compileClasspath,embeddedKotlin,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
1717
org.jetbrains.kotlin:kotlin-stdlib:2.2.0=archRulesCompileClasspath,archRulesRuntimeClasspath,archRulesTestCompileClasspath,archRulesTestRuntimeClasspath,compileClasspath,embeddedKotlin,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
1818
org.jetbrains:annotations:13.0=archRulesCompileClasspath,archRulesRuntimeClasspath,archRulesTestCompileClasspath,archRulesTestRuntimeClasspath,compileClasspath,embeddedKotlin,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
@@ -31,8 +31,8 @@ org.objenesis:objenesis:2.4=archRulesTestRuntimeClasspath,runtimeClasspath
3131
org.objenesis:objenesis:3.2=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
3232
org.opentest4j:opentest4j:1.3.0=archRulesCompileClasspath,archRulesRuntimeClasspath,archRulesTestCompileClasspath,archRulesTestRuntimeClasspath,compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
3333
org.slf4j:slf4j-api:2.0.17=archRulesCompileClasspath,archRulesRuntimeClasspath,archRulesTestCompileClasspath,archRulesTestRuntimeClasspath
34-
org.spockframework:spock-core:2.3-groovy-4.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
35-
org.spockframework:spock-junit4:2.3-groovy-4.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
34+
org.spockframework:spock-core:2.3-groovy-4.0=archRulesTestCompileClasspath,archRulesTestRuntimeClasspath,compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
35+
org.spockframework:spock-junit4:2.3-groovy-4.0=archRulesTestCompileClasspath,archRulesTestRuntimeClasspath,compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
3636
uk.org.webcompere:system-stubs-core:2.0.1=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
3737
uk.org.webcompere:system-stubs-junit4:2.0.1=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
3838
empty=annotationProcessor,archRulesAnnotationProcessor,archRulesTestAnnotationProcessor,integTestAnnotationProcessor,testAnnotationProcessor

src/archRules/java/com/netflix/nebula/test/archrules/NebulaTestArchRules.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.tngtech.archunit.lang.ArchRule;
55
import com.tngtech.archunit.lang.Priority;
66
import com.tngtech.archunit.lang.syntax.ArchRuleDefinition;
7+
import org.jspecify.annotations.NullMarked;
78

89
import java.util.Collections;
910
import java.util.Map;
@@ -14,18 +15,19 @@
1415
import static com.tngtech.archunit.core.domain.JavaClass.Predicates.resideOutsideOfPackages;
1516
import static com.tngtech.archunit.core.domain.properties.CanBeAnnotated.Predicates.annotatedWith;
1617

18+
@NullMarked
1719
public class NebulaTestArchRules implements ArchRulesService {
18-
static ArchRule noDeprecatedNebulaTest = ArchRuleDefinition.priority(Priority.MEDIUM)
20+
static final ArchRule DEPRECATED = ArchRuleDefinition.priority(Priority.MEDIUM)
1921
.noClasses().that(resideOutsideOfPackages("nebula.test.."))
2022
.should().dependOnClassesThat(resideInAPackage("nebula.test..")
2123
.and(annotatedWith(Deprecated.class)))
2224
.orShould().accessTargetWhere(targetOwner(resideInAPackage("nebula.test.."))
2325
.and(target(annotatedWith(Deprecated.class))))
2426
.allowEmptyShould(true)
25-
.because("deprecated APIs will be removed in roux 6");
27+
.because("deprecated APIs will be removed in future version of nebula-test");
2628

2729
@Override
2830
public Map<String, ArchRule> getRules() {
29-
return Collections.singletonMap("noDeprecatedNebulaTest", noDeprecatedNebulaTest);
31+
return Collections.singletonMap("noDeprecatedNebulaTest", DEPRECATED);
3032
}
3133
}

src/archRulesTest/java/com/netflix/nebula/test/archrules/NebulaTestArchRulesTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class NebulaTestArchRulesTest {
1111

1212
@Test
1313
public void testNebulaTestArchRule() {
14-
EvaluationResult result = Runner.check(NebulaTestArchRules.noDeprecatedNebulaTest, Failing.class);
14+
EvaluationResult result = Runner.check(NebulaTestArchRules.DEPRECATED, Failing.class);
1515
assertThat(result.hasViolation()).isTrue();
1616
}
1717

src/main/java/nebula/test/dsl/Plugin.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package nebula.test.dsl;
22

3+
import org.jspecify.annotations.NullMarked;
34
import org.jspecify.annotations.Nullable;
45

6+
@NullMarked
57
public class Plugin {
68
@Nullable
79
private String builtIn;

src/main/java/nebula/test/dsl/Repository.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@
44
// public sealed class Repository permits BuiltIn, Maven {
55
// }
66

7+
import org.jspecify.annotations.NullMarked;
8+
9+
@NullMarked
710
public abstract class Repository {
811
}
912

13+
@NullMarked
1014
final class BuiltIn extends Repository {
1115
public BuiltIn(String functionName) {
1216
this.functionName = functionName;
@@ -15,6 +19,7 @@ public BuiltIn(String functionName) {
1519
final String functionName;
1620
}
1721

22+
@NullMarked
1823
final class Maven extends Repository {
1924
public Maven(String url) {
2025
this.url = url;

src/main/java/nebula/test/dsl/SettingsBuilder.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package nebula.test.dsl;
22

3+
import org.jspecify.annotations.NullMarked;
34
import org.jspecify.annotations.Nullable;
45

56
import java.io.File;
@@ -10,6 +11,7 @@
1011
import java.util.HashSet;
1112
import java.util.Set;
1213

14+
@NullMarked
1315
public class SettingsBuilder {
1416
private final File projectDir;
1517
private final PluginManagementBuilder pluginManagement = new PluginManagementBuilder();

src/main/java/nebula/test/dsl/SourcesBuilder.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
package nebula.test.dsl;
22

3+
import org.jspecify.annotations.NullMarked;
4+
35
import java.io.File;
46

57
/**
68
* Represents the "src" directory of a project
79
*/
10+
@NullMarked
811
public class SourcesBuilder {
912
private final File sourcesDir;
1013

src/test/java/nebula/test/SupportedGradleVersion.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package nebula.test;
22

33
public enum SupportedGradleVersion {
4-
MIN("8.14.2"), MAX("9.2.1");
4+
MIN("8.14.3"), MAX("9.2.1");
55
public final String version;
66
SupportedGradleVersion(String version) {
77
this.version = version;

src/test/kotlin/nebula/test/dsl/KotlinDslTest.kt

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,8 @@ public clss Main { // compile error
228228
assertThat(result2).task(":compileJava").hasOutcome(TaskOutcome.FROM_CACHE)
229229
}
230230

231-
@ParameterizedTest
232-
@EnumSource(SupportedGradleVersion::class)
233-
fun `test rawBuildScript is additive`(gradleVersion: SupportedGradleVersion) {
231+
@Test
232+
fun `test rawBuildScript is additive`() {
234233
val runner = testProject(testProjectDir) {
235234
properties {
236235
buildCache(true)
@@ -247,10 +246,7 @@ public clss Main { // compile error
247246
}
248247
}
249248

250-
val result = runner.run("build") {
251-
forwardOutput()
252-
withGradleVersion(gradleVersion.version)
253-
}
249+
val result = runner.run("build")
254250

255251
assertThat(result)
256252
.hasNoDeprecationWarnings()

0 commit comments

Comments
 (0)