Git Product home page Git Product logo

Comments (6)

codecholeric avatar codecholeric commented on June 17, 2024 1

I know the ignore_patterns.txt is pretty crude, e.g. often it would be better to be able to customize this per rule. However, I have no clear vision yet, what would be necessary, and in which form it could be provided. Maybe I need to collect some more use cases.
In your case though, couldn't you solve your concrete problem by specifying more of the message? For example sth. like

class .*(IgnoredClassOne|IgnoredClassTwo) (calls|accesses) .*

to ignore all violations originating from certain classes you want to ignore?
I think a more structured format might be good, to specify origins or targets, but some rules also don't have these concepts (like class has wrong name).
That is why so far I haven't added a more sophisticated way to ignore violations.

In my project we often ignore this programmatically, like

@Test
public void foo() {
    ArchRule rule = ignoreKnownViolations(classes().that())...should()...
}

private GivenClassesThat ignoreKnownViolations(GivenClassesThat classesThat) {
    for (String fqn : classesToIgnore) {
        classesThat = classesThat.dontHaveFullyQualifiedName(fqn).and();
    }
    return classesThat;
}

Of course in these cases you probably need to overwrite the generated rule text 😉

from archunit.

codecholeric avatar codecholeric commented on June 17, 2024 1

I agree with your points, there is definitely room for improvement here. However, as you say, it's more than this issue was originally about, so I've opened a new one: #66
Do you find your points correctly reflected there?
If yes, I'd close this issue and move discussion / implementation over to the new one.

from archunit.

codecholeric avatar codecholeric commented on June 17, 2024

Was this sufficient for your use case, or do you have any suggestion, how the ignore patterns should be improved?

from archunit.

codecholeric avatar codecholeric commented on June 17, 2024

If there's no suggestion, how the ignore patterns could be improved, I'll close this issue for now, until something more concrete will come up.

from archunit.

DennisRippinger avatar DennisRippinger commented on June 17, 2024

Thanks @codecholeric for your long and helpful answer. It might be more than this issue was originally about:

Ignoring is difficult because the message could be freely defined, this is of course hard to maintain. But I must admit that my problem was not directly the Regex itself, but that it was not really visible for me that the Regex was the problem root. Archunit gave no feedback that it ignored the Error. I thought something in my expression was wrong; only after debugging I discovered the true mechanism of the regex. A simple idea could be to print out a log message that this error violation was omitted. One can say that the current status is as it is intendent, but maybe this could be lead to something else.

The whole idea of ignoring issues comes from the point that old/large code parts cannot be refactored in a story or sprint. But nevertheless, it might be interesting to be aware of such violations in a form of a report. This could be in the end an HTML file, similar to what JGiven offers. Archunit has the concept of Priorites. The report could list all violations but fail the test only if it is defined as a test of given priority.

from archunit.

DennisRippinger avatar DennisRippinger commented on June 17, 2024

Thanks for the follow up. I close the Issue.

from archunit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.