-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Offer taikai rules through arch-unit-maven-plugin #42
Comments
Hi! Thanks for your ticket and your suggestion. Yes, I would like to be able to offer something like this. I'm not quite sure yet in which direction this support should go - Maven plugin or something else. Would leave the ticket open until then. Thank you very much |
I can share my thoughts on how I currently handle shared rules across multiple repositories (projects). Disclaimer: I use Gradle along with the societe-generale/arch-unit-gradle-plugin. I've created a rule: public class SharedRuleTest implements ArchRuleTest {
@Override
public void execute(String packagePath, ScopePathProvider scopePathProvider, Collection<String> collection) {
Taikai.builder()
.classes(importAllClassesInPackage(scopePathProvider.getMainClassesPath(), packagePath))
.java(java -> java
.fieldsShouldNotBePublic()
.utilityClassesShouldBeFinalAndHavePrivateConstructor()
)
.logging(logging -> logging
.loggersShouldFollowConventions(LoggerFactory.class, "logger", EnumSet.of(PRIVATE, STATIC, FINAL))
)
.spring(spring -> spring
.noAutowiredFields()
.configurations(ConfigurationsConfigurer::namesShouldEndWithConfiguration)
.controllers()
.services()
.repositories()
)
.build()
.check();
Taikai.builder()
.classes(importAllClassesInPackage(scopePathProvider.getTestClassesPath(), packagePath))
.test(test -> test
.junit5(junit5 -> junit5
.classesShouldBePackagePrivate(".*Test")
.methodsShouldBePackagePrivate()
)
)
.build()
.check();
}
} and use it in the gradle conventions plugins like: plugins {
id 'com.societegenerale.commons.arch-unit-gradle-plugin'
}
archUnit {
preConfiguredRules = [
'com.thulium.SharedRuleTest',
]
} |
Hi there,
I am following the activity in the project, which seems great by the way!
One thing I would like to know if it is been considered already, is providing Taikai with/within arch-unit-maven-plugin: https://github.com/societe-generale/arch-unit-maven-plugin
Because if I have many modules and would like to run against all of them, would be better to run trough the plugin instead of replicating the same rules all over the place.
Do you consider it a feasible idea or do you have another approach in mind?
The text was updated successfully, but these errors were encountered: