scss-lint
scss-lint copied to clipboard
Exclude files instead of disabling linter when generating config
Hi,
I wrote this small script to generate a config where the existing offending files are excluded for each linter instead of disabling the whole linter for the project.
Maybe the config reporter should do something like it?
output = %x[scss-lint]
todo_config = {
"linters" => {}
}
output.scan(/^(.+):(\d+):(\d+) \[(.)\] (.+?): (.+)$/) do |match|
file_path, line, column, offence_type, linter_name, description = match
todo_config.fetch("linters")[linter_name] ||= {"exclude" => []}
unless todo_config.fetch("linters").fetch(linter_name).fetch("exclude").include?(file_path)
todo_config.fetch("linters").fetch(linter_name).fetch("exclude") << file_path
end
end
puts todo_config.to_yaml
Would welcome a working pull request with tests!