Skip to content

Exclude files instead of disabling linter when generating config #979

@ghost

Description

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions