scss-lint icon indicating copy to clipboard operation
scss-lint copied to clipboard

Exclude files instead of disabling linter when generating config

Open ghost opened this issue 6 years ago • 1 comments

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

ghost avatar Aug 18 '19 11:08 ghost

Would welcome a working pull request with tests!

sds avatar Aug 18 '19 16:08 sds