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

Provide a way to store all current violations of a rule and successively only report new ones #181

Merged
merged 18 commits into from
Jul 4, 2019

Commits on Jul 4, 2019

  1. Make CollectsLines deprecated. The API seems pretty useless, naturall…

    …y pretty much every implementation will simply add the lines of the violations to the supplied CollectsLines, and every client that is interested in the raw message lines has to write a dummy wrapper around a collection to access the lines.
    
    Thus a simple method getDescriptionLines() seems way more reasonable here.
    
    Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
    codecholeric committed Jul 4, 2019
    Configuration menu
    Copy the full SHA
    a3c447d View commit details
    Browse the repository at this point in the history
  2. Initial draft of an "FreezingArchRule" capable to wrap a given ArchRu…

    …le to provide support for legacy applications where this rule will initially be violated many times.
    
    Provides two hooks for extension, first a ViolationStore to determine how the given result will be stored. This should enable to pass a simple file based store, but also implement a custom store that persists to a database or a REST endpoint.
    Second a ViolationLineMatcher to configure how "rough" stored lines of violations should be compared to actual lines of violations on consecutive evaluation of the given rule. This way it is possible to ignore line numbers or details of given messages to make the comparison more robust against refactorings.
    
    Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
    codecholeric committed Jul 4, 2019
    Configuration menu
    Copy the full SHA
    4cd639f View commit details
    Browse the repository at this point in the history
  3. Extended ArchConfiguration to make it possible to add further propert…

    …ies for example for FreezingArchRule as a first client of custom properties.
    
    Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
    codecholeric committed Jul 4, 2019
    Configuration menu
    Copy the full SHA
    350257e View commit details
    Browse the repository at this point in the history
  4. Added DefaultViolationStoreFactory which returns a simple file based …

    …ViolationStore.
    
    Also made ViolationStore to use configurable through archunit.properties.
    
    Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
    codecholeric committed Jul 4, 2019
    Configuration menu
    Copy the full SHA
    278e8b7 View commit details
    Browse the repository at this point in the history
  5. Made ViolationLineMatcher configurable via archunit.properties.

    Improved visibility by moving everything (default)factory specific to package private classes.
    
    Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
    codecholeric committed Jul 4, 2019
    Configuration menu
    Copy the full SHA
    7da683c View commit details
    Browse the repository at this point in the history
  6. TextFileBasedViolationStore should create configured folder if it doe…

    …s not exist, instead of throwing an exception.
    
    Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
    codecholeric committed Jul 4, 2019
    Configuration menu
    Copy the full SHA
    2baef23 View commit details
    Browse the repository at this point in the history
  7. Improved handling of known violations. So far if a condition event ad…

    …ded multiple lines (like AndConditionEvent) and a new line appeared, all lines would be reported as violation. Now only the new line will be reported.
    
    Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
    codecholeric committed Jul 4, 2019
    Configuration menu
    Copy the full SHA
    fed0a45 View commit details
    Browse the repository at this point in the history
  8. Fixed violation handling for filtered events. Also added some logging.

    Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
    codecholeric committed Jul 4, 2019
    Configuration menu
    Copy the full SHA
    103e1d3 View commit details
    Browse the repository at this point in the history
  9. Added examples and integration test

    Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
    codecholeric committed Jul 4, 2019
    Configuration menu
    Copy the full SHA
    0479763 View commit details
    Browse the repository at this point in the history
  10. Improve FreezingArchRule to only use LineMatcher once. Also fixed beh…

    …avior where FreezingArchRule would not fail if the count of an already recorded violation with respect to the given matcher was raised.
    
    Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
    codecholeric committed Jul 4, 2019
    Configuration menu
    Copy the full SHA
    46b296b View commit details
    Browse the repository at this point in the history
  11. Improve performance: Using a regex within the default line matcher ha…

    …s a massive performance impact (tested on hibernate core where evaluation time was reduced by 50% with this algorithm)
    
    Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
    codecholeric committed Jul 4, 2019
    Configuration menu
    Copy the full SHA
    bf8274a View commit details
    Browse the repository at this point in the history
  12. Added documentation

    Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
    codecholeric committed Jul 4, 2019
    Configuration menu
    Copy the full SHA
    7747711 View commit details
    Browse the repository at this point in the history
  13. some review comments on FreezingArchRule PR#181

    Signed-off-by: Manfred Hanke <Manfred.Hanke@tngtech.com>
    hankem authored and codecholeric committed Jul 4, 2019
    Configuration menu
    Copy the full SHA
    e1e2c4b View commit details
    Browse the repository at this point in the history
  14. some review comments on FreezingArchRule PR#181 (documentation)

    Signed-off-by: Manfred Hanke <Manfred.Hanke@tngtech.com>
    hankem authored and codecholeric committed Jul 4, 2019
    Configuration menu
    Copy the full SHA
    c8c98c6 View commit details
    Browse the repository at this point in the history
  15. Further improve docs by documenting how to configure ViolationStore a…

    …nd ViolationLineMatcher within archunit.properties. Also introduced custom exception for failed initialization of configured ViolationLineMatcher instead of (falsely) throwing a StoreInitializationFailedException.
    
    Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
    codecholeric committed Jul 4, 2019
    Configuration menu
    Copy the full SHA
    afc10e6 View commit details
    Browse the repository at this point in the history
  16. log number of violations

    Signed-off-by: Manfred Hanke <Manfred.Hanke@tngtech.com>
    hankem authored and codecholeric committed Jul 4, 2019
    Configuration menu
    Copy the full SHA
    41b25d9 View commit details
    Browse the repository at this point in the history
  17. allow for rule-violations stored in files whose name is not a UUID

    Signed-off-by: Manfred Hanke <Manfred.Hanke@tngtech.com>
    hankem authored and codecholeric committed Jul 4, 2019
    Configuration menu
    Copy the full SHA
    5feb2fa View commit details
    Browse the repository at this point in the history
  18. Log of existing rule should not be level error, since this will happe…

    …n during the normal flow if an existing stored violation is adjusted.
    
    Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
    codecholeric committed Jul 4, 2019
    Configuration menu
    Copy the full SHA
    8b0b6a9 View commit details
    Browse the repository at this point in the history