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

Add out of the box support for YamlLint and YamlFix #263

Open
guenth39 opened this issue Aug 8, 2024 · 11 comments
Open

Add out of the box support for YamlLint and YamlFix #263

guenth39 opened this issue Aug 8, 2024 · 11 comments
Assignees
Labels
enhancement New feature or request

Comments

@guenth39
Copy link

guenth39 commented Aug 8, 2024

Is your feature request related to a problem? Please describe.
For me, it's quite difficult at the moment to write custom lints for yaml files. To write a lint is possible, but I can't make the fixes work. It would be nice if the package could offer a simple solution for that, like with DartLint and DartFix.

Describe the solution you'd like
Add corresponding YamlLint and YamlFix class.

Describe alternatives you've considered
Add a guide on how to write linter rules for files others than dart.

@guenth39 guenth39 added the enhancement New feature or request label Aug 8, 2024
@rrousselGit
Copy link
Collaborator

It is low priority for me. But sure

@rrousselGit
Copy link
Collaborator

cc @Rexios80

If you're following to work on this, I'm open to guiding you on it :)

@Rexios80
Copy link
Contributor

Do you have any thoughts on this?

Linting yaml files kind of works, but the plugin doesn't get notified about updates to yaml files. I tried adding *.yaml to the interestingFiles field here, but that somehow broke yaml file linting completely.

Ideally we pass in the globs from LintRule.filesToAnalyze, but I was just trying to get a proof of concept working.

@rrousselGit
Copy link
Collaborator

Analyzer_plugin is likely the issue here. I'd suggest raising an issue on the dart sdk for that. There's likely already one

@Rexios80
Copy link
Contributor

Actually it looks like custom_lint isn't working as a path dependency. It doesn't seem to work in the dart_custom_lint project at all either, so it's not just my project. Do you have any ideas how to fix that?

@rrousselGit
Copy link
Collaborator

You need to edit the tools/analyzer_plugin/pubspec.yaml

@rrousselGit
Copy link
Collaborator

You may have to clear your pub cache after editing the pubspec too. Or your change may not get picked up.

Analyzer_plugins are ... let's say ... not exactly easy to use.

@Rexios80
Copy link
Contributor

Is that in the documentation somewhere? I looked but couldn't find it. Maybe we should add this to a CONTRIBUTING.md file?

@rrousselGit
Copy link
Collaborator

There's a TODO in the pubspec, but a CONTRIBUTING.md could be good too.

@Rexios80
Copy link
Contributor

I think I got it kind of working by symlinking my fork of custom_lint into the pub cache, but I still can't get yaml lints to update in real time. I don't have the bandwidth to diagnose this at the moment, so I'm giving up for now.

@rrousselGit
Copy link
Collaborator

As I mentioned, the update issue is likely not from custom_lint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants