Skip to content

Allow to exclude single checks from a configurable rule #70

Description

@nils-christian

Summary

Hi,

We would like to suggest a feature allowing us to exclude certain rules from a configured rule "package".

Type of Issue

It is a :

  • bug
  • request
  • question regarding the documentation

Motivation

We enforce certain architecture rules across various projects. Those are part of a platform used by said projects. Those rules are static fields contained in a single class so that we only have to include a single rule.

configurableRules>
  <configurableRule>
    <rule>our.custom.Rules</rule>
  </configurableRule>
</configurableRules>

This is working for 90% of our use cases. However, we have some projects that are doing things slightly different and need to exclude some of those rules. Let's assume that we have rules A, B and C and only C should not be applied. The projects in question can now configure those checks explicitly:

configurableRules>
  <configurableRule>
    <rule>our.custom.Rules</rule>
    <checks>
      <check>A</check>
      <check>B</check>
    </checks>
  </configurableRule>
</configurableRules>

This has two disadvantages:

  1. We have something like 20 rules, so the projects have to declare 19 of them just to exclude a single one.
  2. New rules, which are added to our.custom.Rules can easily be forgotten by the projects during an update of our platform.

Thus we would like to exclude certain checks from the rule set, like a negation of the check property.

configurableRules>
  <configurableRule>
    <rule>our.custom.Rules</rule>
    <excludedChecks>
      <excludedCheck>C</excludedCheck>
    </excludedChecks>
  </configurableRule>
</configurableRules>

Current Behavior

Either the whole rule set is executed or the given checks.

Expected Behavior

It should be possible to exclude single checks from the rule set.

Thank you and best regards

Nils

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions