feat(#174660): add new code conventions rules#1
Open
kirill-pyatunin wants to merge 1 commit intoclutcher:mainfrom
Open
feat(#174660): add new code conventions rules#1kirill-pyatunin wants to merge 1 commit intoclutcher:mainfrom
kirill-pyatunin wants to merge 1 commit intoclutcher:mainfrom
Conversation
kirill-pyatunin
commented
Apr 23, 2026
Comment on lines
+149
to
+150
| moduleBasePackage + properties.getDomainModelPackageMatcher(), | ||
| "java..", |
kirill-pyatunin
commented
Apr 23, 2026
| return noClasses() | ||
| .that().resideInAPackage(moduleBasePackage + properties.getDomainPackageMatcher()) | ||
| .should().dependOnClassesThat( | ||
| resideInAPackage("..app.domain..") |
kirill-pyatunin
commented
Apr 23, 2026
| .that().resideInAPackage(moduleBasePackage + properties.getDomainPackageMatcher()) | ||
| .should().dependOnClassesThat( | ||
| resideInAPackage("..app.domain..") | ||
| .and(resideOutsideOfPackage(moduleBasePackage + "..")) |
kirill-pyatunin
commented
Apr 23, 2026
|
|
||
| String getApplicationRoot(); | ||
|
|
||
| default String getDomainModelPackageMatcher() { |
Author
There was a problem hiding this comment.
check. it should already exists in configs
kirill-pyatunin
commented
Apr 23, 2026
| .allowEmptyShould(true); | ||
| } | ||
|
|
||
| public static ArchRule ruleForCrossModuleDomainIsolation(String moduleBasePackage, HexagonalArchitectureSettings properties) { |
kirill-pyatunin
commented
Apr 23, 2026
| .allowEmptyShould(true); | ||
| } | ||
|
|
||
| public static ArchRule ruleForDomainModelNotExposedInDrivingAdapters(String moduleBasePackage, HexagonalArchitectureSettings properties) { |
Author
There was a problem hiding this comment.
Check rule *Test that domain.model is not used to be returned from in rest controller - only for controllers
Author
There was a problem hiding this comment.
*Mapper class
mappers package?
kirill-pyatunin
commented
Apr 23, 2026
| .allowEmptyShould(true); | ||
| } | ||
|
|
||
| static DescribedPredicate<JavaClass> areNotAnnotatedWithAnyOf(String[] annotationNames) { |
kirill-pyatunin
commented
Apr 23, 2026
| moduleBasePackage + properties.getDomainModelPackageMatcher(), | ||
| "java..", | ||
| "lombok..", | ||
| "org.springframework.stereotype..", |
Author
There was a problem hiding this comment.
-
- too wide. component and service
kirill-pyatunin
commented
Apr 23, 2026
| }; | ||
| } | ||
|
|
||
| public static ArchRule ruleForNoAutowiredInDomain(String moduleBasePackage, HexagonalArchitectureSettings properties) { |
kirill-pyatunin
commented
Apr 23, 2026
| .allowEmptyShould(true); | ||
| } | ||
|
|
||
| public static ArchRule ruleForNoAutowiredFieldsInDomain(String moduleBasePackage, HexagonalArchitectureSettings properties) { |
kirill-pyatunin
commented
Apr 23, 2026
| .allowEmptyShould(true); | ||
| } | ||
|
|
||
| public static ArchRule ruleForDomainModelOnlyRecordsOrPojos(String moduleBasePackage, HexagonalArchitectureSettings properties) { |
Author
There was a problem hiding this comment.
should check records or pojos
kirill-pyatunin
commented
Apr 23, 2026
| .allowEmptyShould(true); | ||
| } | ||
|
|
||
| public static ArchRule ruleForSpringAdapterNaming(String moduleBasePackage, HexagonalArchitectureSettings properties) { |
kirill-pyatunin
commented
Apr 23, 2026
| } | ||
|
|
||
|
|
||
| // --- Custom ArchConditions --- |
kirill-pyatunin
commented
Apr 23, 2026
| import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.fields; | ||
| import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses; | ||
|
|
||
| public class CodeConventionsRulesLibrary { |
Author
There was a problem hiding this comment.
create interface.
Create property to allow on/off or redefine rules, add rule
Author
There was a problem hiding this comment.
id rule = true / false, true by default (exmpl)
kirill-pyatunin
commented
Apr 23, 2026
| @@ -0,0 +1,24 @@ | |||
| dev: | |||
kirill-pyatunin
commented
Apr 23, 2026
| extra["springBootVersion"] = "3.5.3" | ||
| extra["springModulithVersion"] = "2.0.3" | ||
| extra["springBootVersion"] = "4.0.2" | ||
| extra["archUnitVersion"] = "1.4.1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.