mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-21 02:37:43 -05:00
Our complexity lint rules previously considered this function to have both too many statements and too many lines. Factoring out more of the "single-attr ref" logic into the parseSingleAttrRef function eliminated one statement per case that was using it. Factoring out the handling of module call references -- the most complex case this function handles -- into a separate parseModuleCallRef reduced it considerably more. Removing the empty lines between the "case" statements was necessary after that just to get below the line count limit, which seems like a rather dubious situation for a lint rule to complain about but it doesn't seem to hurt readability, so fair enough. The rework of parseSingleAttrRef made it slightly less convenient to use as part of parseModuleCallRef, but not onerously so and thus this prioritizes making the common case simpler at the expense of a small amount of extra work in the parseModuleCallRef function. Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
16 KiB
16 KiB