TNG / ArchUnit

A Java architecture test library, to specify and assert architecture rules in plain Java
http://archunit.org
Apache License 2.0
3.23k stars 298 forks source link

Add package/component size architecture metrics #1134

Open tfij opened 1 year ago

tfij commented 1 year ago

Regarding https://www.archunit.org/userguide/html/000_Index.html#_software_architecture_metrics it will be great to have package/component size metric. Size can be calculated based on lines of code (loc) or a number of instructions(noi), e.g.

bgalek commented 1 year ago

This could be a useful feature!

codecholeric commented 1 year ago

Yes, I'd be open to add this 🙂 If somebody wants to jump in and create a PR I'm open to support. Otherwise, I put it in my queue 🙈

codecholeric commented 1 year ago

Even though the concept of "loc" doesn't exist yet, so there needs to be some pre-analysis how to map this, or if we can actually track the loc somehow... Or noi... Because ArchUnit doesn't import every bit (but maybe good enough what's there 🤷 )

tfij commented 7 months ago

So far I've implemented it as a separate lib - https://github.com/tfij/module-size-calculator My blog post related to this lib - https://chi.pl/2024/03/07/Modularization-and-Architecture-Testing.html

I'm unsure if we can use the same approach in the archunit.