[dx] Move if-set rules into code-quality and coding-style sets, deprecate opinionated rules - #8409
Closed
TomasVotruba wants to merge 8 commits into
Closed
[dx] Move if-set rules into code-quality and coding-style sets, deprecate opinionated rules#8409TomasVotruba wants to merge 8 commits into
TomasVotruba wants to merge 8 commits into
Conversation
The rule lives in the CodingStyle namespace; place it in CodingStyleLevel among the safe formatting rules, remove it from the if set. Claude-Session: https://claude.ai/code/session_012HQ19gVsT8wVkekuVqVXGx
…ctor from if set to code-quality set Both rules live in the CodeQuality namespace; place them in CodeQualityLevel next to SingularSwitchToIfRector, remove from the if set. Claude-Session: https://claude.ai/code/session_012HQ19gVsT8wVkekuVqVXGx
…ctor, ShortenElseIfRector from if set to code-quality set All three live in the CodeQuality namespace; place them in CodeQualityLevel among the compare rules, remove from the if set. Claude-Session: https://claude.ai/code/session_012HQ19gVsT8wVkekuVqVXGx
The result depends on context and can worsen readability; extracting a method is a better fix when needed. Mark with DeprecatedInterface and @deprecated. Claude-Session: https://claude.ai/code/session_012HQ19gVsT8wVkekuVqVXGx
Array and object bool compares have dedicated rules; the remaining behavior is an opinionated approach that depends on context. Mark with DeprecatedInterface and @deprecated. Claude-Session: https://claude.ai/code/session_012HQ19gVsT8wVkekuVqVXGx
…licitBoolCompareRector Replace the rule bodies with a deprecation message via ShouldNotHappenException, remove their tests, and unregister them from the if set so they are no longer executed. Also drop the now-obsolete issue tests that combined these rules. Claude-Session: https://claude.ai/code/session_012HQ19gVsT8wVkekuVqVXGx
…recate CombineIfRector Move CompleteMissingIfElseBracketRector into CodingStyleLevel next to AlternativeIfToBracketRector. Deprecate CombineIfRector: merging nested ifs can create much less readable code and depends on context - gut the body to throw, remove its tests, unregister it. The if set is now empty. Claude-Session: https://claude.ai/code/session_012HQ19gVsT8wVkekuVqVXGx
The if set is now empty; its rules were moved to code-quality and coding-style sets or deprecated. Claude-Session: https://claude.ai/code/session_012HQ19gVsT8wVkekuVqVXGx
Member
Author
|
Split into focused PRs:
|
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.
Consolidate rules that live in the
CodeQualityandCodingStylenamespaces but were registered in theifset into their proper level sets:AlternativeIfToBracketRector->CodingStyleLevelInlineIfToExplicitIfRector,TernaryFalseExpressionToIfRector,ArrayExplicitBoolCompareRector,ObjectExplicitBoolCompareRector,ShortenElseIfRector->CodeQualityLevelAlso deprecate two opinionated rules whose result depends on context:
SimplifyIfElseToTernaryRector- can worsen readability; extracting a method is a better fix when needed.ExplicitBoolCompareRector- array and object bool compares have dedicated rules; the rest is an opinionated approach.