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

feat: add --check_format=json|pretty #3051

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lewis6991
Copy link
Contributor

@lewis6991 lewis6991 commented Jan 23, 2025

Adds a new CLI option --check_format which accepts the values: 'json'
(current behaviour), and a new 'pretty' value which prints a colorized
human readable report to stdout, similar to common compilers and
linters.

Results are printed with color unless NO_COLOR is defined in the users
environment, as per https://no-color.org.

If --check_out_path is provided, then the results are always saved to
file regardless of the --check_format value.

I've made pretty the default format, however to mitigate against any breakage I've made it also write the json files with --check_out_path is provided, so this will be like enabling both formats at once.

Other changes

  • Outlined some functions in check_worker.lua.
  • Made --quiet work properly with --num_threads

@lewis6991
Copy link
Contributor Author

lewis6991 commented Jan 23, 2025

Example:

image

@mikesmithgh
Copy link

I'm not sure if it makes sense in the scope of this. But it would be nice to return a nonzero exit code if results are found for CI builds to fail.

If it is helpful, I recently did something similar for a Neovim plugin https://github.com/mikesmithgh/kitty-scrollback.nvim/blob/main/scripts/internal/__lua_language_server_check.lua

@lewis6991
Copy link
Contributor Author

First commit after the last release has already added this.

@mikesmithgh
Copy link

awesome 9f25c27 yep I see it 🙌. Thanks!

Copy link
Contributor

@tomlau10 tomlau10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great work 👍
and I just tested it on windows and found some small issues

script/cli/check_worker.lua Outdated Show resolved Hide resolved
script/cli/check_worker.lua Outdated Show resolved Hide resolved
script/cli/check_worker.lua Outdated Show resolved Hide resolved
script/cli/check_worker.lua Outdated Show resolved Hide resolved
@lewis6991 lewis6991 force-pushed the feat/clipretty branch 8 times, most recently from 727715d to 14f8ee5 Compare January 24, 2025 13:55
Adds a new CLI option --check_format which accepts the values: 'json'
(current behaviour), and a new 'pretty' value which prints a colorized
human readable report to stdout, similar to common compilers and
linters.

Results are printed with color unless NO_COLOR is defined in the users
environment, as per https://no-color.org.

If --check_out_path is provided, then the results are always saved to
file regardless of the --check_format value.
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.

3 participants