Warm tip: This article is reproduced from serverfault.com, please click

How to lint .yml.erb files

发布于 2020-11-30 05:19:23

I'm trying to lint .yaml.erb files. RuboCop seems unable to lint .erb files altogether, and although there is an erb-lint gem, it appears to only support erb that renders to html, javascript, and text files. There's a linter for yaml as well called yamllint. Is there a way to stitch these tools together or a way to configure them to handle this edge case? How do people normally handle linting files with multiple compilation steps like this?

Questioner
williamcodes
Viewed
0
Marc-André Lafortune 2020-12-01 01:57:57

I can't think of any reason you shouldn't be able to lint the Ruby parts of your erb file with erb-lint, but linting the YAML "template" is in general impossible. You could generate the actual YAML file by interpreting it and linting that though.