Skip to content

feat(lint): add stderr and ignore_exit_code options#248

Closed
barrettruth wants to merge 1 commit intonvimdev:mainfrom
barrettruth:feat/linter-stderr-exit-code
Closed

feat(lint): add stderr and ignore_exit_code options#248
barrettruth wants to merge 1 commit intonvimdev:mainfrom
barrettruth:feat/linter-stderr-exit-code

Conversation

@barrettruth
Copy link
Contributor

@barrettruth barrettruth commented Feb 4, 2026

some linters output to stderr and exit non-zero on lint findings. for example, cpplint writes diagnostics to stderr and exits non-zero when it finds style issues - even though the code compiles fine.

currently, guard.nvim treats this as a failure so i considered adding two options.

  • stderr: capture stderr instead of stdout
  • ignore_exit_code: don't treat non-zero exit as error
ft('cpp'):lint({
    cmd = 'cpplint',
    fname = true,
    stderr = true,
    ignore_exit_code = true,
    parse = ...,
})

also, i'm about to make a pr to guard-collection for cpplint that depends on this soon (and a bunch of other prs for other formatters/linters, since im swapping from none-ls to guard...).

Some linters (e.g., cpplint) output to stderr and exit non-zero when
lint issues are found, which guard treats as a failure. This adds two
options to handle such tools:

- `stderr`: capture stderr instead of stdout
- `ignore_exit_code`: don't treat non-zero exit as error

Example usage:
```lua
ft('cpp'):lint({
    cmd = 'cpplint',
    fname = true,
    stderr = true,
    ignore_exit_code = true,
    parse = ...,
})
```
@barrettruth barrettruth changed the title feat(lint): add stderr and ignore_exit_code options feat(lint): add stderr and ignore_exit_code options Feb 4, 2026
@xiaoshihou514
Copy link
Member

Hey, thank you for the pr. However, I won't be merging this, see https://github.com/nvimdev/guard.nvim/blob/main/ADVANCED.md

@barrettruth
Copy link
Contributor Author

Ah. I didn't see that there was a guide. The coroutine logic does seem a bit tricky for the end user. Anyways, thanks!

@barrettruth barrettruth closed this Feb 4, 2026
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