ArchUnit icon indicating copy to clipboard operation
ArchUnit copied to clipboard

Add package/component size architecture metrics

Open tfij opened this issue 2 years ago • 4 comments

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.

  • component size (CS): num(loc) or num(noi) for each component
  • project size (PS): num(all_loc) or num(all_loi)
  • relative component size (RCS): num(loc) / num(all_loc) or num(loi) / num(all_loi) for each component

tfij avatar Jul 06 '23 18:07 tfij

This could be a useful feature!

bgalek avatar Sep 15 '23 18:09 bgalek

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 avatar Nov 01 '23 18:11 codecholeric

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 🤷 )

codecholeric avatar Nov 01 '23 18:11 codecholeric

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.

tfij avatar Mar 25 '24 16:03 tfij