Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The range 0...N is outside the bounds of the source (IndexError) #514

Open
Sija opened this issue Nov 25, 2024 · 0 comments
Open

The range 0...N is outside the bounds of the source (IndexError) #514

Sija opened this issue Nov 25, 2024 · 0 comments

Comments

@Sija
Copy link
Member

Sija commented Nov 25, 2024

Running below command (piping is just a convenience here, same goes for regular files):

echo -n "# foo" | bin/ameba --fix -

Results in IndexError:

The range 0...6 is outside the bounds of the source (IndexError)
  from src/ameba/source/rewriter.cr:131:7 in 'check_range_validity'
  from src/ameba/source/rewriter.cr:124:7 in 'combine:replacement'
  from src/ameba/source/rewriter.cr:75:7 in 'replace'
  from src/ameba/source/corrector.cr:18:7 in 'replace'
  from src/ameba/rule/lint/formatting.cr:53:9 in '->'
  from src/ameba/issue.cr:43:20 in 'correct'
  from src/ameba/source.cr:29:21 in 'correct?'
  from src/ameba/runner.cr:133:38 in 'run_source'
  from src/ameba/runner.cr:93:11 in '->'
  from /opt/homebrew/Cellar/crystal/1.14.0/share/crystal/src/fiber.cr:143:11 in 'run'
  from /opt/homebrew/Cellar/crystal/1.14.0/share/crystal/src/fiber.cr:95:34 in '->'

Tested with 51cb88e


Happens only when Lint/Formatting and Layout/TrailingBlankLines issues are present at the same time.
Possibly related to #489

/cc @FnControlOption

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant