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 grouping rules #70

Open
1 of 3 tasks
mkjensen opened this issue Mar 16, 2023 · 2 comments
Open
1 of 3 tasks

Support for grouping rules #70

mkjensen opened this issue Mar 16, 2023 · 2 comments

Comments

@mkjensen
Copy link

Summary

Please consider supporting that a configurable rule can be a grouping of rules.

Type of Issue

It is a :

  • bug
  • request
  • question regarding the documentation

Motivation

Basically, given

class AllRulesTest {

    @ArchTest
    static final ArchTests SOME_RULES = ArchTests.in(SomeRules.class);

    @ArchTest
    static final ArchTests OTHER_RULES = ArchTests.in(OtherRules.class);
}

it would be nice that the Maven plugin would pick up all the rules via

(...)
<rules>
  <configurableRules>
      <configurableRule>
          <rule>package.AllRulesTest</rule>
      </configurableRule>
  </configurableRules>
</rules>
(...)

instead of having to do

(...)
<rules>
  <configurableRules>
      <configurableRule>
          <rule>package.SomeRules</rule>
      </configurableRule>
      <configurableRule>
          <rule>package.OtherRules</rule>
      </configurableRule>
  </configurableRules>
</rules>
(...)

Current Behavior

Grouping is ignored (rules referred to by ArchTests are not taken into consideration).

Currently it looks like grouping is not supported in InvokableRules.

Expected Behavior

Grouping works via the plugin just as if run as a test directly.

Steps to Reproduce (for bugs)

If the above is not clear, I can provide a sample.

Your Environment

ArchUnit 1.0.1
arch-unit-maven-plugin 3.0.0

@vincent-fuchs
Copy link
Collaborator

the configurableRules are supposed to be configured in the build config (maven or gradle). grouping would defeat the purpose, wouldn't it ? Maybe it could work with preconfiguredRules , but I am not convinced we would gain much.

@mkjensen
Copy link
Author

You are right that one can continue to add rules to the plugin configuration.

The idea with this request is that the plugin configuration could be static and you could extend the referenced grouping class(es) instead.

The thinking is that keeping the plugin configuration static and leaving details to Java classes would be easier to maintain, but maybe this is subjective.

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