Skip to content

Commit

Permalink
Fix RuboCop errors
Browse files Browse the repository at this point in the history
These errors were introduced when we increased the minimum Ruby version
to 3.x.
  • Loading branch information
sds committed Dec 13, 2023
1 parent 2ad453f commit 0302b22
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/slim_lint/file_finder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def extract_files_from(patterns) # rubocop:disable Metrics/MethodLength
# @param path [String]
# @return [String]
def normalize_path(path)
path.start_with?(".#{File::SEPARATOR}") ? path[2..-1] : path
path.start_with?(".#{File::SEPARATOR}") ? path[2..] : path
end

# Whether the given file should be treated as a Slim file.
Expand Down
8 changes: 3 additions & 5 deletions lib/slim_lint/linter_registry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@ def included(subclass)
# @return [Array<Class>]
def extract_linters_from(linter_names)
linter_names.map do |linter_name|
begin
SlimLint::Linter.const_get(linter_name)
rescue NameError
raise NoSuchLinter, "Linter #{linter_name} does not exist"
end
SlimLint::Linter.const_get(linter_name)
rescue NameError
raise NoSuchLinter, "Linter #{linter_name} does not exist"
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion slim_lint.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Gem::Specification.new do |s|
Dir['lib/**/*.rb'] +
['LICENSE.md']

s.required_ruby_version = '>= 3'
s.required_ruby_version = '>= 3.0'

s.add_runtime_dependency 'rubocop', ['>= 1.0', '< 2.0']
s.add_runtime_dependency 'slim', ['>= 3.0', '< 6.0']
Expand Down
8 changes: 3 additions & 5 deletions spec/slim_lint/engine_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@
end

it 'includes the line number in the exception' do
begin
subject
rescue SlimLint::Exceptions::ParseError => e
e.lineno.should == 1
end
subject
rescue SlimLint::Exceptions::ParseError => e
e.lineno.should == 1
end
end

Expand Down

0 comments on commit 0302b22

Please sign in to comment.