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

Binary to generate qlty.toml validation schema using Taplo #1454

Merged
merged 1 commit into from
Jan 23, 2025

Conversation

lsegal
Copy link
Member

@lsegal lsegal commented Jan 23, 2025

This sounds counter-intuitive, but extensions and tools like Taplo (Even Better TOML) support validating TOML files with JSON schemas. This PR aims to provide the infrastructure to generate a JSON schema for use in these tools.

A schema file can be generated with

cargo run --bin qlty-config-generate-schema > schema.json

This PR does not generate the schema or use it anywhere yet.

This sounds counter-intuitive, but extensions and tools like [Taplo](https://taplo.tamasfe.dev/) ([Even Better TOML](https://marketplace.visualstudio.com/items?itemName=tamasfe.even-better-toml)) support validating TOML files with JSON schemas. This PR aims to provide the infrastructure to generate a JSON schema for use in these tools.

A schema file can be generated with

```sh
cargo run --bin qlty-config-generate-schema > schema.json
```

This PR does not generate the schema or use it anywhere yet.
@lsegal lsegal requested a review from a team January 23, 2025 17:49
@lsegal lsegal self-assigned this Jan 23, 2025
Copy link
Contributor

qltysh bot commented Jan 23, 2025

The code coverage on the diff in this pull request is 0.0%

Drilldown
Path File Coverage Δ
qlty-check/src/executor/driver.rs * -0.9
qlty-check/src/tool/command_builder.rs * 2.6
qlty-check/src/tool/download.rs * 0.7
qlty-check/src/tool/ruby/sys/linux.rs * -1.6
qlty-check/src/tool/ruby/sys/macos.rs * 3.1
qlty-config/src/bin/generate_schema.rs 0.0
qlty-config/src/config.rs -1.1
qlty-config/src/library.rs * 0.5

(*) Indirect Changes: These files had changes to their code coverage, but were not modified in this pull request. Learn More

@brynary
Copy link
Member

brynary commented Jan 23, 2025

This is awesome! This will be a huge help for users to get their TOML changes correct.

@lsegal lsegal merged commit 1046f5e into main Jan 23, 2025
11 checks passed
@lsegal lsegal deleted the ls/qlty-toml-json-schema branch January 23, 2025 17:57
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