Skip to content

Fix empty if-chain same-line else removal#577

Closed
tristanmanchester wants to merge 1 commit into
peteromallet:mainfrom
tristanmanchester:fix/empty-if-chain-same-line-else
Closed

Fix empty if-chain same-line else removal#577
tristanmanchester wants to merge 1 commit into
peteromallet:mainfrom
tristanmanchester:fix/empty-if-chain-same-line-else

Conversation

@tristanmanchester
Copy link
Copy Markdown

Summary

  • keep scanning } else { continuations in _find_if_chain_end() so brace depth stays balanced across the full if/else chain
  • replace the premature break paths with continue, allowing the scanner to process the { that opens the else block
  • add a regression proving the empty-if-chain fixer removes the whole same-line else chain instead of leaving orphaned braces behind

Testing

  • uv run --with pytest python -m pytest desloppify/tests/lang/typescript/test_ts_empty_if_chain_fixer_direct.py desloppify/tests/lang/typescript/test_typescript_detectors_fixers_and_wrappers_split_direct.py

@peteromallet
Copy link
Copy Markdown
Owner

Thanks @tristanmanchester for the fix. Final decision: accepted and applied.

I applied the same-line else-chain fix as reviewed. The focused TypeScript fixer test passed, and the full project plus TypeScript language tests passed. Local commit: 596b1ed7.

Closing this PR as applied.

@peteromallet
Copy link
Copy Markdown
Owner

Closing after accepted review decision; applied locally as 596b1ed7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants