Ignore error in layered architecture for specific parameters
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
Research direction
Start by reading the layered architecture API and its dependency-condition tests; the issue does not name specific files or tests. Determine whether rules can distinguish a type used in a generic parameter from one used as a return value, and whether that distinction can be configured for selected parameters. Done means the example can ignore the generic-parameter dependency while still reporting the return-value dependency.
Written by the indexing model from the issue text.
Description
Hello, I was exploring the layered architecture and I was wondering if there was a way to ignore errors that are reported between different layers for specific parameters?
For example, we have a method in our controller:
@GetMapping("/users")
public List<UserDto> findUsers(Specification<UserDao> specification) {
return userService.findBy(specification);
}
In the layered architecture., I have the rules:
@ArchTest
public static final ArchRule layersShouldOnlyBeAccessedByTheCorrectLayer = layeredArchitecture()
.consideringOnlyDependenciesInLayers()
.layer("Controller").definedBy("..controller..")
.layer("Service").definedBy("..service..")
.layer("Repository").definedBy("..repository..")
.layer("Entity").definedBy("..entity..")
.whereLayer("Controller").mayNotBeAccessedByAnyLayer()
.whereLayer("Service").mayOnlyBeAccessedByLayers("Controller")
.whereLayer("Repository").mayOnlyBeAccessedByLayers("Service")
.whereLayer("Entity").mayOnlyBeAccessedByLayers("Service", "Repository");
In this instance, I would like to ignore that UserDao is used in a generic parameter but would like to report if the UserDao was used as a return value. Is this possible?
- Dominant language
- Java
- Stars
- 3.9k
- Forks
- 350
- Avg merge
- 3d 2m
- Merged PRs (30d)
- 13
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from TNG/ArchUnit
-
PackageMatcher wildcards don't match package names with non-ASCII lettersPossibly taken @StefanPenndorf claimed this 7 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 25/100
Maintainers usually reply within 1 day
-
beFreeOfCycles() misses cycles: TarjanComponentFinder does not return the component with the lowest node indexPossibly taken @StefanPenndorf claimed this 7 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 30/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 52/100
TNG/ArchUnit#1773 · 1 comment ·
Maintainers usually reply within 1 day
-
Constructor parameters added by the compiler (inner classes, enums) make `getParameters()` / `getParameterTypes()` inconsistent and misplace parameter annotationsPossibly taken @SamuelAdigos claimed this 8 days ago. Open
Difficulty 5/5 Over a week Newbie friendliness 48/100
TNG/ArchUnit#1772 · 3 comments ·
Maintainers usually reply within 1 day
-
breaking change
Difficulty 5/5 Over a week Newbie friendliness 18/100
TNG/ArchUnit#1756 · 1 comment ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
NationalSecurityAgency/ghidra#10149 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
yegor256/antlr2ebnf-maven-plugin#155 ·
Maintainers usually reply within 1 day
-
account bug exercise lecture programming user interface
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ls1intum/Artemis#14512 · 1 comment ·
Maintainers usually reply within 1 day
-
kind:bug priority:major
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
swiftlang/swift-java#955 ·
Maintainers usually reply within 1 day