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

Added a quiet reporter that directs all reporting data to stderr #357

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nickpoorman
Copy link

@nickpoorman nickpoorman commented Jun 26, 2024

Neovim conform and other editors such as Zed work better when able to pipe a file directly to stdin and get the formatted output via stdout.

The current reporters inject report data to the formatted file written to stdout. This PR adds a quiet reporter similar to rubocop's quiet format and writes all report output to stderr.

Addresses comments: #225 (comment), #225 (comment)

The report output is still available via stderr but can also now be disabled with the ruby -W0 flag to suppress the warnings:

❯ cat index.html.erb | ruby -W0 erblint --format quiet --autocorrect --stdin index.html.erb

This can be run now as follows in a conform.nvim configuration:

formatters = {
  erb_lint = {
    env = {
      RUBYOPT = "-W0" -- suppress reporting output
    },
    command = "bundle",
    args = { "exec", "erblint", "--format", "quiet", "--autocorrect", "--stdin", "$FILENAME" },
  },
}

@nickpoorman
Copy link
Author

I have signed the CLA!

@thewatts
Copy link

thewatts commented Aug 2, 2024

Found this while trying to integrate erb_lint with my neovim setup.

Can confirm - this addition would be very much appreciated 😇

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