Skip to content

Exclude files instead of disabling linter when generating config #979

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions