Repository navigation
fix(js): count catch clauses, not throws, as exception decision points - #201
Merged
Merged
Conversation
#171) Bump core to v0.2.8, which no longer counts exception edges as decision points. Each catch clause now adds one to complexity and to exception_handlers, and a throw adds nothing, matching C++ and pyscn.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #171.
Every JavaScript
throwadded one tocomplexityand was reported inexception_handlers. #200 removed the core rule that caused this, and this PR bumps core to v0.2.8. The JavaScript analyzer now counts catch clauses from the AST. Each catch clause adds one tocomplexityand toexception_handlers, and athrowadds nothing. This matches how C++ and pyscn count exception handlers.For the issue's repro,
threeThrowsgoes from 6 to 3 andtryCatchgoes from 3 to 2 with one handler. Onimbue-ai/latchkey@d2ee791,prepareCurlInvocationgoes from 22 to 16, and the medium-risk count goes from 36 to 22.