Repository navigation
Linter: Improve unextractable tags in erb-no-duplicate-branch-elements - #2033
Merged
Merged
Conversation
marcoroth
marked this pull request as ready for review
August 5, 2026 23:30
marcoroth
enabled auto-merge (squash)
August 5, 2026 23:30
Contributor
|
Does this also resolve #1878? |
Owner
Author
|
@natematykiewicz looks like it does. On current main they are not reported anymore: Playground |
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.
This pull request updates
erb-no-duplicate-branch-elementsto stop reporting shared tags that cannot actually be extracted, and makes the linter CLI stop advertising those offenses as autocorrectable.which produced two hints plus
Fixable 2 offenses | 2 autocorrectable using --fix, while--fixleft the file untouched.When the content of a shared tag differs between branches, the only way to extract it is to wrap the whole conditional in that tag.
The rule reported the hint without checking that this rewrite was available. In the template above the
<p>has a siblinglink_tothat has to stay inside the conditional, so wrapping would swallow the links too. The only remaining "fix" is to split the conditional into several, which duplicates the condition instead of the markup.Resolves #1570