Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude files instead of disabling linter when generating config #979

Open
ghost opened this issue Aug 18, 2019 · 1 comment
Open

Exclude files instead of disabling linter when generating config #979

ghost opened this issue Aug 18, 2019 · 1 comment

Comments

@ghost
Copy link

ghost commented Aug 18, 2019

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
@sds
Copy link
Owner

sds commented Aug 18, 2019

Would welcome a working pull request with tests!

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

No branches or pull requests

1 participant