Fix lint error formatting for errors at end of line#6717
Merged
bentsherman merged 3 commits intomasterfrom Jan 13, 2026
Merged
Conversation
When syntax errors occur at positions beyond the actual line length (e.g., at end-of-line for "Unexpected input: '\n'" errors), the substring operations in printCodeBlock() would throw a StringIndexOutOfBoundsException, resulting in unhelpful error messages like "ERROR ~ begin 44, end 45, length 44". This fix adds proper bounds checking for start/end positions and their adjusted values to ensure they stay within the line length. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Phil Ewels <phil.ewels@seqera.io>
✅ Deploy Preview for nextflow-docs-staging canceled.
|
Member
|
The error shown in the PR description is from nf-core/seqinspector: It is the same kind of error reported in #6664 , which this PR fixes. I will add a unit test for that and then merge. |
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
bentsherman
approved these changes
Jan 13, 2026
pditommaso
pushed a commit
that referenced
this pull request
Jan 16, 2026
Co-authored-by: Ben Sherman <bentshermann@gmail.com>
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.
Fixed bug in linting where errors that included EOL characters couldn't be printed and triggered an error.
Before (nf-core/seqinspector):
After:
Solution:
StringIndexOutOfBoundsExceptioninnextflow lintwhen errors occur at end-of-line positionsprintCodeBlock()methodDetails
Problem
When running
nextflow linton files with syntax errors at positions beyond the actual line length (e.g., "Unexpected input: '\n'" errors at end of line), the output would show:instead of properly formatted error descriptions with code context.
Solution
Added bounds checking in
ErrorListener.printCodeBlock()to ensurestart,end,adjStart, andadjEndvalues stay within the line length.Test plan
nextflow lint .intest/seqinspector/directoryconf/modules.configandnf-test.configdisplay properly formatted messages🤖 Generated with Claude Code