8000 panic: runtime error: index out of range [-1] · Issue #950 · errata-ai/vale · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
panic: runtime error: index out of range [-1] #950
Closed
@hestonhoffman

Description

@hestonhoffman

Check for existing issues

  • Completed

Environment

OS: MacOS locally and Linux (GH action image) in CI
Install method: Brew on MacOS, Using the Python module on Linux
Vale version: 3.9.3

Describe the bug / provide steps to reproduce it

On 3.9.3, when I run Vale on a file, I'll occasionally get the following error and stack trace:

vale content/en/continuous_integration/pipelines/gitlab.md
panic: runtime error: index out of range [-1]

goroutine 11 [running]:
github.com/errata-ai/vale/v3/internal/core.ToSentence({0x103182c80?, 0x0, 0x14002c8ce66?}, {0x1011c7d62, 0x2})
	github.com/errata-ai/vale/v3/internal/core/util.go:80 +0x2cc
github.com/errata-ai/vale/v3/internal/check.Substitution.Run({{{{0x14000669a20, 0x7}, {0x0, 0x0, 0x0}}, {0x0, 0x0}, {0x140006699b0, 0xc}, {0x140006699f0, ...}, ...}, ...}, ...)
	github.com/errata-ai/vale/v3/internal/check/substitution.go:135 +0x640
github.com/errata-ai/vale/v3/internal/lint.(*Linter).lintBlock(0x1400004ddc8, 0x14002e10c00, {{0x1400286d500, 0x6359}, 0x16, {0x14002c8c0e7, 0x7}, {0x14002c8c0e7, 0x7}, {0x140001d5d90, ...}}, ...)
	github.com/errata-ai/vale/v3/internal/lint/lint.go:276 +0x1cc
github.com/errata-ai/vale/v3/internal/lint.(*Linter).lintProse(0x1400004ddc8, 0x14002e10c00, {{0x1400286d500, 0x6359}, 0x16, {0x1011c8242, 0x3}, {0x1011c8242, 0x3}, {0x140001d5d90, ...}}, ...)
	github.com/errata-ai/vale/v3/internal/lint/lint.go:248 +0x158
github.com/errata-ai/vale/v3/internal/lint.(*Linter).lintScope(0x1400004ddc8, 0x14002e10c00, 0x1400225a120, {0x140001d5d90, 0xa8})
	github.com/errata-ai/vale/v3/internal/lint/ast.go:161 +0x1f0
github.com/errata-ai/vale/v3/internal/lint.(*Linter).lintHTMLTokens(0x1400004ddc8, 0x14002e10c00, {0x14002806000, 0x72a0, 0x8000}, 0x0)
	github.com/errata-ai/vale/v3/internal/lint/ast.go:117 +0x5a4
github.com/errata-ai/vale/v3/internal/lint.Linter.lintMarkdown({{0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, 0x14002a2b240, 0x14001d1c420, 0x10314f4a0, 0x0, ...}, ...)
	github.com/errata-ai/vale/v3/internal/lint/md.go:80 +0x1b8
github.com/errata-ai/vale/v3/internal/lint.(*Linter).lintFile(0x14001fca190, {0x16f552c17?, 0x140000ae460?})
	github.com/errata-ai/vale/v3/internal/lint/lint.go:198 +0x270
github.com/errata-ai/vale/v3/internal/lint.(*Linter).lintFiles.func1.1.1({0x16f552c17?, 0x14002fe30c0?})
	github.com/errata-ai/vale/v3/internal/lint/lint.go:142 +0x4c
created by github.com/errata-ai/vale/v3/internal/lint.(*Linter).lintFiles.func1.1 in goroutine 10
	github.com/errata-ai/vale/v3/internal/lint/lint.go:140 +0x1ac

It seems to be having trouble reading these rules. I tested it with a couple of different words from that file and some of them seem to trigger the issue. For example, adding the words 'quickly' or 'obviously' cause the panic.

Running Vale on 3.9.1 does not produce the issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0