Skip to content

fix(codespell): keep diagnostics when --count is used - #354

Merged
mochaaP merged 1 commit into
nvimtools:mainfrom
barthollomew:fix/codespell-count-flag
Nov 23, 2026
Merged

mochaaP merged 1 commit into
nvimtools:mainfrom
barthollomew:fix/codespell-count-flag

Conversation

@barthollomew

@barthollomew barthollomew commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes #149

When codespell finds spelling mistakes it prints them to stdout and exits with code 65. If --count is enabled in extra_args or in a config file it also prints the error count to stderr.

Right now the builtin sets from_stderr = true and does not allow exit code 65. With --count enabled none-ls reads the count from stderr and drops the spelling warnings from stdout.

This change:

  • Sets from_stderr = false and ignore_stderr = true so none-ls reads stdout
  • Adds check_exit_code for codes 0 and 65
  • Adds unit tests in test/spec/builtins/diagnostics/codespell_spec.lua for output parsing and --count

Tested locally with make FILE=test/spec/builtins/diagnostics/codespell_spec.lua test-file (9/9 passed) plus stylua --check lua/ test/ and selene lua/.

Checklist

  • If I'm adding a new builtin (linter, formatter, code action, etc.), I
    understand it should be contributed to
    nvimtools/none-ls-extras.nvim
    instead
  • I've written tests for these changes

Codespell writes diagnostics to stdout and exits with code 65 when misspellings are found. Passing `--count` via `extra_args` or project config writes the error count to stderr.

Setting `from_stderr = true` caused `generator_factory` to overwrite stdout diagnostics with that stderr count. Set `from_stderr = false` with `ignore_stderr = true` and allow exit codes 0 and 65.

Fixes nvimtools#149
@coderabbitai

coderabbitai Bot commented Nov 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: aab234c7-8583-49dc-b50f-8ed09f8442c8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@barthollomew barthollomew changed the title fix(codespell): ignore stderr and allow exit code 65 fix(codespell): keep diagnostics when --count is used Nov 20, 2026
@mochaaP
mochaaP merged commit df7be04 into nvimtools:main Nov 23, 2026
4 checks passed
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.

Codespell does not return diagnostic with --countflag

2 participants