Skip to content
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

Support for freezing rules #72

Open
1 of 3 tasks
tduchateau-pro opened this issue Sep 7, 2023 · 1 comment
Open
1 of 3 tasks

Support for freezing rules #72

tduchateau-pro opened this issue Sep 7, 2023 · 1 comment

Comments

@tduchateau-pro
Copy link

Summary

A new configuration point for ConfigurableRules could be very useful to specify whether a rule is frozen or not.
See https://www.archunit.org/userguide/html/000_Index.html#_freezing_arch_rules for reference documentation.

I'm particularly interested in this feature in the Gradle plugin, but this feature could totally benefit the Maven plugin as well, which is why I've created this request here.

Type of Issue

It is a :

  • bug
  • request
  • question regarding the documentation

Motivation

When it comes to implementing ArchUnit in existing projects, the Freezing rules feature is very useful for implementing an iterative approach.

As it is, I haven't found any workaround other than declaring each rule twice, once "normally", and once wrapping it with FreezingArchRule.freeze(rule). By doing this, it is then possible to decide in the plugin configuration whether to use the "normal" rule or the frozen rule. In the meantime, if anyone sees a better workaround, don't hesitate to share :-)

A new configuration point in ConfigurableRules seems to me more appropriate for deciding whether a rule is frozen or not. WDYT?

Current Behavior

archUnit {
   configurableRules=[
      configurableRule(
         "com.societegenerale.commons.plugin.rules.NoAutowiredFieldTest", 
         applyOn("com.package","main")
      ),
   ]
}

Expected Behavior

archUnit {
   configurableRules=[
      configurableRule(
         "com.societegenerale.commons.plugin.rules.NoAutowiredFieldTest", 
         applyOn("com.package","main"),
         true <== true for frozen, false otherwise, defaults to false
      ),
   ]
}

Your Environment

  • Version used:

    • com.societegenerale.commons:arch-unit-gradle-plugin:2.9.5
    • com.societegenerale.commons:arch-unit-build-plugin-core:2.9.5
  • OS and version: MacOS Ventura (13.5.1)

@vincent-fuchs
Copy link
Collaborator

have you seen https://github.com/societe-generale/arch-unit-maven-plugin#using-archunitproperties-file , which points to societe-generale/arch-unit-maven-plugin#37 (comment) ?

I haven't looked at this recently, and I won't have time any time soon, but maybe that helps you ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants