oxsecurity / megalinter

🦙 MegaLinter analyzes 50 languages, 22 formats, 21 tooling formats, excessive copy-pastes, spelling mistakes and security issues in your repository sources with a GitHub Action, other CI tools or locally.
https://megalinter.io
GNU Affero General Public License v3.0
1.81k stars 215 forks source link

New linter for toml files: `taplo` #2732

Open josecelano opened 1 year ago

josecelano commented 1 year ago

Is your feature request related to a problem? Please describe.

It's not a problem. I just would like to add a new linter for toml files.

Describe the solution you'd like

I would like to add a new linter:

taplo fmt --check Cargo.toml

Describe alternatives you've considered

I do not know any other toml file formatter.

Additional context

I think Toml files are very common in Rust. I want to format toml files in this project: https://github.com/torrust/torrust-index-backend/pull/116. I was considering adding taplo directly in a workflow but I would prefer to use MegaLinter because I can easily add more linter in the future.

nvuillam commented 1 year ago

hi @josecelano :)

taplo linter seems maintained, there is clearly a need to lint TOML files, so it seems to be a good candidate ! :)

https://github.com/tamasfe/taplo

My only question, on their README it says :

The project is very young, so bugs and incomplete features are expected, so any help is welcome!

The correctness of the TOML parsing and decoding is not yet entirely guaranteed (as there is no official 1.0.0 compliance test suite yet).

As a taplo user, do you confirm that it is stable and evolved enough to be embedded in default MegaLinter, or maybe it is safer to just implement it as a MegaLinter plugin before it is stabilized ?

josecelano commented 1 year ago

hi @josecelano :)

taplo linter seems maintained, there is clearly a need to lint TOML files, so it seems to be a good candidate ! :)

https://github.com/tamasfe/taplo

My only question, on their README it says :

The project is very young, so bugs and incomplete features are expected, so any help is welcome!

The correctness of the TOML parsing and decoding is not yet entirely guaranteed (as there is no official 1.0.0 compliance test suite yet).

As a taplo user, do you confirm that it is stable and evolved enough to be embedded in default MegaLinter, or maybe it is safer to just implement it as a MegaLinter plugin before it is stabilized ?

Hi @nvuillam I'm not using it yet. I want to start using a toml formatted.

I did not know about plugins. I think a plugin would be ok. In fact, I do not know if there are other toml formatters that could be more mature or stable. I do not see many:

https://github.com/toml-lang/toml/issues/532

nvuillam commented 1 year ago

@josecelano I propose you to start with a plugin, then if we see it's great we move it as natively embedded linter ? :)

github-actions[bot] commented 12 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

If you think this issue should stay open, please remove the O: stale 🤖 label or comment on the issue.

github-actions[bot] commented 11 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

If you think this issue should stay open, please remove the O: stale 🤖 label or comment on the issue.

vonbraunbates commented 2 weeks ago

What's happened to supporting a(ny) TOML linter in Megalinter? According to the Megalinter docs, we have some linters which only accept TOML config files (e.g Black, Ruff, Gitleaks...) so it would be somewhat counter-intuitive to be unable to lint our own linter settings.

echoix commented 2 weeks ago

I or any of the maintainers here would be glad to review a PR for this. Is the status of taplo a bit better now?

vonbraunbates commented 2 weeks ago

Not a TOML expert (I'd never heard of it until I had to configure some linters), but I've done a quick round-up of parsers which support the TOML 1.0.0 standard and are recently maintained:

I suppose you should pick whichever integrates best with Megalinter, assuming any have reached a suitable stage of maturity. 🤷‍♀️ The ones I've ruled out are:

nvuillam commented 2 weeks ago

@vonbraunbates many thanks for your benchmark :)

I'll write an issue on taplo repo to ask them if they can remove their warning message, as they now have 1.2K stars now :D

echoix commented 1 week ago

Taplo sadly doesn't seem like the best choice following this: https://github.com/tamasfe/taplo/issues/626#issuecomment-2184178594