Skip to content

Commit

Permalink
Drop support for Ruby 2.3
Browse files Browse the repository at this point in the history
Ruby 2.3 reached EOL on March 31, 2019:
https://www.ruby-lang.org/en/news/2019/03/31/support-of-ruby-2-3-has-ended/

While here, run a RuboCop auto-correct as we're now requiring Ruby 2.4+.
  • Loading branch information
sds committed May 2, 2019
1 parent 82b083d commit b2d92f1
Show file tree
Hide file tree
Showing 17 changed files with 23 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
AllCops:
DisplayCopNames: true
TargetRubyVersion: 2.3 # Oldest version of Ruby we support
TargetRubyVersion: 2.4 # Oldest version of Ruby we support

AccessModifierIndentation:
EnforcedStyle: outdent
Expand Down
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ env:
- "JRUBY_OPTS=--dev"

rvm:
- 2.3.8
- 2.4.5
- 2.4.6
- 2.5.5
- 2.6.2
- jruby-9.1.17.0
- 2.6.3
- jruby-9.2.6.0

before_install:
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# SCSS-Lint Changelog

## master (unreleased)

* Drop support for Ruby 2.3 or older

## 0.57.1

* Relax Sass gem dependency to allow 3.6.x
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ support on the issue tracker.

## Requirements

* Ruby 2.3+
* Ruby 2.4+
* Sass 3.5.5+
* Files you wish to lint must be written in SCSS (not Sass) syntax

Expand Down
2 changes: 1 addition & 1 deletion lib/scss_lint/linter/chained_classes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Linter::ChainedClasses < Linter
def visit_sequence(sequence)
line_offset = 0
sequence.members.each do |member|
line_offset += 1 if member =~ /\n/
line_offset += 1 if member =~ /\n/ # rubocop:disable Performance/RegexpMatch
next unless chained_class?(member)
add_lint(member.line + line_offset,
'Prefer using a distinct class over chained classes ' \
Expand Down
4 changes: 2 additions & 2 deletions lib/scss_lint/linter/disable_linter_reason.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def visit_comment(node)
# No lint if the first line of the comment is not a command (because then
# either this comment has no commands, or the first line serves as a the
# reason for a command on a later line).
if comment_lines(node).first.match(COMMAND_REGEX)
if comment_lines(node).first.match?(COMMAND_REGEX)
visit_command_comment(node)
else
@previous_comment = node
Expand All @@ -21,7 +21,7 @@ def visit_command_comment(node)
end

# Not a "disable linter reason" if the last line of the previous comment is a command.
if comment_lines(@previous_comment).last.match(COMMAND_REGEX)
if comment_lines(@previous_comment).last.match?(COMMAND_REGEX)
report_lint(node)
return
end
Expand Down
2 changes: 1 addition & 1 deletion lib/scss_lint/linter/hex_validation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def visit_script_string(node)
HEX_REGEX = /(#(\h{3}|\h{6}|\h{8}))(?!\h)/

def check_hex(hex, node)
return if HEX_REGEX.match(hex)
return if HEX_REGEX.match?(hex)
add_lint(node, "Colors must have either three or six digits: `#{hex}`")
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/scss_lint/linter/indentation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def visit_atroot(node, &block)

def visit_import(node)
previous_node(node)
return unless engine.lines[node.line - 1] =~ /@import/
return unless engine.lines[node.line - 1].match?(/@import/)
check_indentation(node)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/scss_lint/linter/space_around_operator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def visit_script_operation(node)
# (only selectors?), the source ranges are offset by two (probably not
# accounting for the `#{`. Slide everything to the left by 2, and maybe
# things will look sane this time.
unless operation_sources.operator_source =~ Sass::Script::Lexer::REGULAR_EXPRESSIONS[:op]
unless operation_sources.operator_source.match?(Sass::Script::Lexer::REGULAR_EXPRESSIONS[:op])
operation_sources.adjust_for_interpolation
operation_sources.adjust_sources
end
Expand Down
2 changes: 1 addition & 1 deletion lib/scss_lint/linter/space_between_parens.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def feel_for_enclosing_parens(node) # rubocop:disable Metrics/AbcSize, Metrics/C
# those parens may be part of a parent function call. We don't care about
# such parens. This depends on whether the preceding character is part of
# a function name.
return original_source if character_at(range.start_pos, left_offset - 1) =~ /[A-Za-z0-9_]/
return original_source if character_at(range.start_pos, left_offset - 1).match?(/[A-Za-z0-9_]/)

range.start_pos.offset += left_offset
range.end_pos.offset += right_offset
Expand Down
2 changes: 1 addition & 1 deletion lib/scss_lint/linter/string_quotes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def check_single_quotes(node, string)
if string =~ /(?<! \\) \\'/x && string !~ /"/
add_lint(node, 'Use double-quoted strings when writing single ' \
'quotes to avoid having to escape the single quotes')
elsif string =~ /(?<! \\) \\"/x
elsif string.match?(/(?<! \\) \\"/x)
add_lint(node, "Don't escape double quotes in single-quoted strings")
end
elsif string !~ /"/
Expand Down
2 changes: 1 addition & 1 deletion lib/scss_lint/linter/trailing_semicolon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def visit_mixin(node)

def visit_import(node)
# Ignore all but the last import for comma-separated @imports
return if source_from_range(node.source_range) =~ /,\s*$/
return if source_from_range(node.source_range).match?(/,\s*$/)
check_semicolon(node)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/scss_lint/linter/trailing_whitespace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Linter::TrailingWhitespace < Linter

def visit_root(_node)
engine.lines.each_with_index do |line, index|
next unless line =~ /[ \t]+$/
next unless line.match?(/[ \t]+$/)

add_lint(index + 1, 'Line contains trailing whitespace')
end
Expand Down
2 changes: 1 addition & 1 deletion lib/scss_lint/linter/unnecessary_mantissa.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Linter::UnnecessaryMantissa < Linter

def visit_script_string(node)
return unless node.type == :identifier
return if node.value =~ /^'|"/
return if node.value.match?(/^'|"/)
return if url_literal?(node)

node.value.scan(REAL_NUMBER_REGEX) do |number, integer, mantissa, units|
Expand Down
4 changes: 2 additions & 2 deletions lib/scss_lint/linter/url_quotes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ def visit_prop(node)
private

def check(node, string)
return unless string =~ /^\s*url\(\s*[^"']/
return if string =~ /^\s*url\(\s*data:/ # Ignore data URIs
return unless string.match?(/^\s*url\(\s*[^"']/)
return if string.match?(/^\s*url\(\s*data:/) # Ignore data URIs

add_lint(node, 'URLs should be enclosed in quotes')
end
Expand Down
2 changes: 1 addition & 1 deletion lib/scss_lint/linter/vendor_prefix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def check_node(node)
private

def check_identifier(node, identifier)
return unless identifier =~ /^[_-]/
return unless identifier.match?(/^[_-]/)

# Strip vendor prefix to check against identifiers.
# (Also strip closing parentheticals from values like linear-gradient.)
Expand Down
2 changes: 1 addition & 1 deletion scss_lint.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |s|

s.test_files = Dir['spec/**/*']

s.required_ruby_version = '>= 2.3'
s.required_ruby_version = '>= 2.4'

s.add_dependency 'rake', '>= 0.9', '< 13'
s.add_dependency 'sass', '~> 3.5', '>= 3.5.5'
Expand Down

0 comments on commit b2d92f1

Please sign in to comment.