Closed agilgur5 closed 2 years ago
I was looking through some old tabs and saw that CodeClimate actually defines a term for this kind of complexity. "Cognitive Complexity" includes complexity due to nesting.
Great to have a term for what I was describing moving forward!
Summary
Small refactor to invert some conditionals/
if
statements for better readabilityDetails
a few
if (cond) { big block } return
could be inverted toif (!cond) return
then the block un-indented insteadshorten the
resolvedFileName
conditional by using optional chainingx?.y
over the olderx && x.y
syntaxadd a
resolved
variable for less repetition of the whole statementadd a comment to the
pathNormalize
line about why it's used in that one place and link to the longer description in the PR as wellshorten comment about
useTsconfigDeclarationDir
so it doesn't take up so much space or look so important as a resultremove the
else
there and just add an early return instead, similar to the inverted conditionals aboveReview Notes
This is unfortunately going to merge conflict with #334 as one of the conditionals is changed there as well, so I'll need to rebase this once that's fixed
Ignoring whitespace changes makes this PR easier to read