feat: add fix for the inline-if-can-be-used rule - #1900
Merged
Conversation
This was referenced Aug 25, 2026
Open
bhirsz
force-pushed
the
feat/add-fix-for-inline-if-can-be-used
branch
from
August 25, 2026 06:22
fb839b6 to
4debd32
Compare
Base automatically changed from
feat/remove-replace-run-keyword-if-formatter
to
main
August 25, 2026 06:37
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
bhirsz
force-pushed
the
feat/add-fix-for-inline-if-can-be-used
branch
from
August 25, 2026 06:37
4debd32 to
590c6d5
Compare
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.
Adds an automatic fix for the
inline-if-can-be-used(MISC09) rule. Short single-branchIFblocks are rewritten into aninline IFvia--fix.The
InlineIfformatter logic was extracted into a reusableInlineIfConverterclass informatter/utils/inline_if.pyand is now shared by both the formatter and the new rule fix.The
InlineIfformatter is kept — it does more than the rule (bidirectional conversion, handles ELSE/ELSE IF and assignments, converts too-long inline IFs back to blocks). This matches the plan in #1631 (fix for MISC09 only; MISC11 stays with the formatter).Part of #1631.
Stacked on #1899.
fix_availability = SOMETIMES(returns None when the inline IF would exceed the limit).test_fixacceptance test +expected_fixed/; InlineIf formatter tests still pass.