Hi, firstly thanks for this gem which is very nice to use.
I've implemented it on a project and add it to the CI. I want to prevent more bad syntax to be added in the views, but I need time to correct legacy errors. Therefore, I need to generate an excluding list, just like the rubocop-todo system.
Actually I've already done a task in my project, and it (almost) works fine. Therefore I was wondering about adding it directly in the gem. Would that be useful for anyone? Should I open a PR?
How does it works?
You start with a .erb-lint.default.yml file containing the config you want to apply. For example:
EnableDefaultLinters: true
linters:
ErbSafety:
enabled: true
exclude:
- "**/app/path/to/foo" # should always be excluded
DeprecatedClasses:
enabled: true
Then you run the task erb_lint:generate_todo. It copies .erb-lint.default.yml into a .erb-lint.yml file (and eventually erase the previous one). All linters run (juste like with the CLI command) and all errors are added in exclusions, so at the end the .erb-lint.yml file looks like:
There is a special system for the rubocop linter. All errors are added in a .erb-lint-rubocop-todo.yml file which is then inherited in the config, so the .erb-lint.yml file looks like:
Hey @BigBigDoudou this seems like it could be really useful, would you be willing to share what you had implemented in your project to auto generate the config?
Hi, firstly thanks for this gem which is very nice to use.
I've implemented it on a project and add it to the CI. I want to prevent more bad syntax to be added in the views, but I need time to correct legacy errors. Therefore, I need to generate an excluding list, just like the rubocop-todo system.
Actually I've already done a task in my project, and it (almost) works fine. Therefore I was wondering about adding it directly in the gem. Would that be useful for anyone? Should I open a PR?
How does it works?
You start with a
.erb-lint.default.yml
file containing the config you want to apply. For example:Then you run the task
erb_lint:generate_todo
. It copies.erb-lint.default.yml
into a.erb-lint.yml
file (and eventually erase the previous one). All linters run (juste like with the CLI command) and all errors are added in exclusions, so at the end the.erb-lint.yml
file looks like:There is a special system for the rubocop linter. All errors are added in a
.erb-lint-rubocop-todo.yml
file which is then inherited in the config, so the.erb-lint.yml
file looks like:Ideally, I would add an option to the CLI command, for example
erblint --auto-gen-config
so it works just like rubocop-todo.