Skip to content

Commit

Permalink
Merge pull request #5 from footaku/exclude-doma-implementation
Browse files Browse the repository at this point in the history
Exclude doma implementation
  • Loading branch information
footaku authored Nov 8, 2023
2 parents 5d0b24e + 52d93c4 commit 3c68474
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ plugins {
dependencies {
...
archUnitExtraLib('io.github.footaku:erai:0.0.4')
archUnitExtraLib('io.github.footaku:erai:0.0.5')
...
}
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group = "io.github.footaku"
version = "0.0.4"
version = "0.0.5"

repositories {
mavenLocal()
Expand Down Expand Up @@ -73,7 +73,7 @@ publishing {
create<MavenPublication>("mavenJava") {
groupId = "io.github.footaku"
artifactId = "erai"
version = "0.0.4"
version = "0.0.5"

pom {
name.set("erai")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.github.footaku.erai.rule;

import com.tngtech.archunit.core.domain.JavaModifier;
import io.github.footaku.erai.Erai;
import com.societegenerale.commons.plugin.rules.ArchRuleTest;
import com.societegenerale.commons.plugin.service.ScopePathProvider;
Expand Down Expand Up @@ -101,6 +102,10 @@ private boolean isDoma2Generated(JavaMethod input) {
return true;
}

if (classAnnotations.contains("org.seasar.doma.DaoImplementation")) {
return true;
}

return classAnnotations.contains("org.seasar.doma.EntityTypeImplementation")
&& clazz.getSimpleName().startsWith("_");
}
Expand Down Expand Up @@ -132,6 +137,11 @@ public boolean test(JavaMethod input) {
ArchCondition<JavaMethod> beAnnotatedWith = new ArchCondition<>("be annotated with non-null or nullable") {
@Override
public void check(JavaMethod input, ConditionEvents events) {
var modifiers = input.getModifiers();
if (modifiers.contains(JavaModifier.PRIVATE)) {
return;
}

var annotations = input.getAnnotations()
.stream()
.map(a -> a.getRawType().getName())
Expand Down

0 comments on commit 3c68474

Please sign in to comment.