Skip to content

Report a run of trailing pipes as one offense - #1346

Merged
clauderic merged 1 commit into
mainfrom
fix-trailing-pipes
Oct 20, 2026
Merged

clauderic merged 1 commit into
mainfrom
fix-trailing-pipes

Conversation

@clauderic

Copy link
Copy Markdown
Member

What are you adding in this PR?

In {{ 'hello' | upcase | | }}, LiquidHTMLSyntaxError reported two offenses whose fixes overlap:

{{ 'hello' | upcase | | }}
                    ^^^     Remove extra `|` character(s): replace "| |" with "| "
                     ^^     Remove the trailing `|` character: delete " |"
  • Each fix on its own still leaves a trailing pipe.
  • Autofix can't apply both, because both rewrite the last |. It throws Overlapping ranges are not allowed.

Pipes that end the markup are now reported only as a trailing pipe, and its fix removes the whole run: {{ 'hello' | upcase }}. A single trailing pipe is reported exactly as before.

What did you learn?

I found this by applying each test's fixes together, as autofix does. This was the only test where they conflicted. The existing test only checked that both offenses had a fix.

Tophatting

  • The InvalidPipeSyntax test expected two offenses. It now expects one, plus the fixed result, and it fails without this change.
  • I also checked {{ 'hello' | | | }}, {{ 'hello' | upcase | | | downcase | | }}, assign, echo, and pipes inside {% liquid %}. Each gets one fix per problem, and every result is valid Liquid.

Before you deploy

  • I included a patch bump changeset

🤖 Generated with Claude Code

In `{{ 'hello' | upcase | | }}`, LiquidHTMLSyntaxError reported a
repeated-pipe offense and a trailing-pipe offense whose fixes both
rewrote the last `|`. Neither fix alone produced valid Liquid, and
autofix couldn't apply them together: it threw "Overlapping ranges are
not allowed".

Pipes that end the markup are now only a trailing pipe, and its fix
removes all of them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@clauderic
clauderic requested a review from a team as a code owner October 20, 2026 01:30
@clauderic clauderic mentioned this pull request Oct 20, 2026
2 tasks done
@clauderic
clauderic merged commit de7ac4b into main Oct 20, 2026
8 checks passed
@clauderic
clauderic deleted the fix-trailing-pipes branch October 20, 2026 12:09
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