Git Product home page Git Product logo

Comments (5)

codecholeric avatar codecholeric commented on September 25, 2024

I'm sorry, but I don't think, that this can be achieved easily at the moment.
I have considered it in the past, but I wasn't sure, if this was a reasonable rule at class level, because there seem to be valid cases or frameworks forcing this onto you, e.g. JPA (@OneToMany, @ManyToMany, ...). On the other hand, modules/slices can have cyclic dependencies without any dependency cycle on class level.
It should be possible to generalize and reuse the existing code, since most infrastructure is quite generic, and it principally operates on Dependency, which JavaClass can provide as well.
Just don't know, how well the code would perform, since there are a lot more dependency paths to follow, if all classes are considered. Might be necessary to limit the maximum length to follow...
Maybe I could include this in the next version (of course I'm always open for PRs as well 😉 )
Do you have a simple "production" example, that shows unwanted class cycles? (Could be added to archunit-example then)

from archunit.

hascode avatar hascode commented on September 25, 2024

I love this library and I would really like to contribute (for now my only contributions are some articles/tutorials about ArchUnit)!

You're right that processing all class references might be expensive, perhaps a first approach would be to process all classes that should be checked, evaluate their direct references and scan for an existing back-reference to the origin class.

I think I have to get to know the library better, perhaps I'm able to create some PoC.

My vision for ArchUnit in general would be to support a nice syntax to assure common quality metrics/indicators like Loc/Cyclomatic Complexity/Halstead/Chidamber&Kamerer etc.(perhaps implementing one of them is an easier task for me to start and a case for another issue) :)

from archunit.

codecholeric avatar codecholeric commented on September 25, 2024

I read your blogpost, which was AFAIK the very first article about ArchUnit out there (and surprising to me at that early stage 😉), so thanks a lot for that, I really appreciate it 😃
As for PRs, no stress, just don't be mad, if it takes me a while to get around to it... It might be a good addition though, in the end it's still possible, to only apply it to selected packages / classes, excluding some special cases, where it's necessary or justified. After all, cycles are always hard to comprehend for the human brain...
Including more metrics would surely be an interesting thing, so far I haven't pushed in that direction, because there are tools like Findbugs and PMD that can do those things already. So on the one hand it's reinventing the wheel, on the other hand, it might be a nicer, clearer API...

from archunit.

hascode avatar hascode commented on September 25, 2024

There is even another article ;)

I'll try to get a grip to the internals of ArchUnit, maybe I'm able to produce something useful :)

from archunit.

codecholeric avatar codecholeric commented on September 25, 2024

Do you think you'll have the time to implement this? Because unfortunately I know that I won't have time in the near future, so if there is no one jumping in to implement this, I would close the issue for now and reopen it, once I have the time to implement it (or someone else has).
The first step here would be to check how feasible this would be in bigger projects anyway, or if the necessary time explodes (which I could well imagine).

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.