Search code examples
javaarchunit

ArchUnit allow limited number of violations for ratcheting


I am currently thinking about using archunit for a project. The project has grown over many years and now I would face a lot of violations if I would proceed.

Is there a way to make a rue not fail if the number of violations is below a certain threshold?

Something like

private static final ArchRule limit_something = classes().should([...]).failThreshold(10);

This would prevent new code from doing unwanted things and allow me to fix this without a big bang change.

Edit: I do not want to have extra setup for a Freeze-Store.


Solution

  • You can freeze the existing violations and have only new violations reported.

    By default FreezingArchRule will use a simple ViolationStore based on plain text files. This is sufficient to add these files to any version control system to continuously track the progress.

    For more details, please have a look at the user guide.