ArchUnit icon indicating copy to clipboard operation
ArchUnit copied to clipboard

Feature Request: Support for analysis of local variables

Open MahatmaFatalError opened this issue 3 years ago • 8 comments

During https://stackoverflow.com/questions/70507647/how-to-assert-hashmap-keys-to-be-comparable-with-archunit/70509141 we needed a way to analyze local variables.

Hence, I propose to extend JavaCodeUnit https://www.archunit.org/userguide/html/000_Index.html#_domain to also support local variable definition, declaration and initialization.

MahatmaFatalError avatar Jan 08 '22 11:01 MahatmaFatalError

Technically this should be doable :slightly_smiling_face: But notice that there once already was #227 which pretty much suggested the same I think? However, I didn't get around to it back then and nobody else was willing to tackle it either, so I eventually closed it :disappointed: I would be still open to it (would be necessary to analyse performance impact though and possibly make it an opt-in feature if the drain is too big, since the use case is quite specific). But, as back then I personally don't know when I can really tackle this. So any support would be highly appreciated!

codecholeric avatar Jan 13 '22 17:01 codecholeric

For more persons to find their way to this thread ... https://stackoverflow.com/questions/74461422/archunit-test-sensitive-variable-naming ... ;-)

dbraun1991 avatar Nov 16 '22 13:11 dbraun1991