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

Add functionality to disable linters for specific lines #129

Merged
merged 2 commits into from
Jul 15, 2021

Conversation

dkniffin
Copy link
Contributor

@dkniffin dkniffin commented Jul 9, 2021

Fixes #116

@sds sds merged commit 3692530 into sds:master Jul 15, 2021
@sds
Copy link
Owner

sds commented Jul 15, 2021

Thank you for the contribution! This is awesome.

@dkniffin
Copy link
Contributor Author

@sds Thanks for merging it! Would you mind doing a version bump (minor?) for this, so I can start using it? 😁

@sds
Copy link
Owner

sds commented Jul 15, 2021

Hey @dkniffin, my mistake. I didn't realize our automated tests didn't run.

The tests fail for me when running locally. Can you resolve?

  1) SlimLint::Linter#run returns the reported lints
     Failure/Error:
               @document.source_lines.each_with_index.reduce([]) do |lines, pair|
                 line = pair[0]
                 line_number = pair[1] + 1

                 if line =~ %r{/ slim-lint:disable #{linter_name}}
                   currently_disabled = true
                 elsif line =~ %r{/ slim-lint:enable #{linter_name}}
                   currently_disabled = false
                 elsif currently_disabled
                   lines << line_number

       #<Double (anonymous)> received unexpected message :source_lines with (no args)
     # ./lib/slim_lint/linter.rb:73:in `disabled_lines'
     # ./lib/slim_lint/linter.rb:67:in `disabled_for_line?'
     # ./lib/slim_lint/linter.rb:52:in `report_lint'
     # ./spec/slim_lint/linter_spec.rb:9:in `block (4 levels) in <top (required)>'
     # ./lib/slim_lint/sexp_visitor.rb:24:in `call'
     # ./lib/slim_lint/sexp_visitor.rb:24:in `block in traverse'
     # ./lib/slim_lint/sexp_visitor.rb:21:in `each'
     # ./lib/slim_lint/sexp_visitor.rb:21:in `traverse'
     # ./lib/slim_lint/sexp_visitor.rb:42:in `block in traverse_children'
     # ./lib/slim_lint/sexp_visitor.rb:41:in `each'
     # ./lib/slim_lint/sexp_visitor.rb:41:in `traverse_children'
     # ./lib/slim_lint/sexp_visitor.rb:34:in `traverse'
     # ./lib/slim_lint/sexp_visitor.rb:14:in `trigger_pattern_callbacks'
     # ./lib/slim_lint/linter.rb:32:in `run'
     # ./spec/slim_lint/linter_spec.rb:20:in `block (3 levels) in <top (required)>'
     # ./spec/slim_lint/linter_spec.rb:23:in `block (3 levels) in <top (required)>'

Finished in 1.64 seconds (files took 2.15 seconds to load)
387 examples, 1 failure

Failed examples:

rspec ./spec/slim_lint/linter_spec.rb:22 # SlimLint::Linter#run returns the reported lints
⨠ ruby -v
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin19]

Appreciate your help.

dkniffin added a commit to dkniffin/slim-lint that referenced this pull request Jul 20, 2021
@dkniffin
Copy link
Contributor Author

@sds Done: #131

I'll leave it to you to fix the CI build setup. Not sure what's up with that.

sds pushed a commit that referenced this pull request Jul 22, 2021
@sds
Copy link
Owner

sds commented Jul 22, 2021

Released in 0.22.0.

@dkniffin dkniffin deleted the config_comments branch July 22, 2021 17:04
@borama borama mentioned this pull request Apr 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Question: Inline configuration, a la RuboCop?
2 participants