From b2d92f137ae4603943cf3b92a9c83eb7150535c9 Mon Sep 17 00:00:00 2001 From: Shane da Silva Date: Thu, 2 May 2019 16:51:23 -0700 Subject: [PATCH] Drop support for Ruby 2.3 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+. --- .rubocop.yml | 2 +- .travis.yml | 6 ++---- CHANGELOG.md | 4 ++++ README.md | 2 +- lib/scss_lint/linter/chained_classes.rb | 2 +- lib/scss_lint/linter/disable_linter_reason.rb | 4 ++-- lib/scss_lint/linter/hex_validation.rb | 2 +- lib/scss_lint/linter/indentation.rb | 2 +- lib/scss_lint/linter/space_around_operator.rb | 2 +- lib/scss_lint/linter/space_between_parens.rb | 2 +- lib/scss_lint/linter/string_quotes.rb | 2 +- lib/scss_lint/linter/trailing_semicolon.rb | 2 +- lib/scss_lint/linter/trailing_whitespace.rb | 2 +- lib/scss_lint/linter/unnecessary_mantissa.rb | 2 +- lib/scss_lint/linter/url_quotes.rb | 4 ++-- lib/scss_lint/linter/vendor_prefix.rb | 2 +- scss_lint.gemspec | 2 +- 17 files changed, 23 insertions(+), 21 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 601e03a8..7ebac9c6 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -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 diff --git a/.travis.yml b/.travis.yml index 3df6b16a..892702cc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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: diff --git a/CHANGELOG.md b/CHANGELOG.md index 2feb6bb7..43d409b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index 3a6d0d43..cf471d4b 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/lib/scss_lint/linter/chained_classes.rb b/lib/scss_lint/linter/chained_classes.rb index 629bb5f7..36489015 100644 --- a/lib/scss_lint/linter/chained_classes.rb +++ b/lib/scss_lint/linter/chained_classes.rb @@ -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 ' \ diff --git a/lib/scss_lint/linter/disable_linter_reason.rb b/lib/scss_lint/linter/disable_linter_reason.rb index 26b927bb..4b10faf8 100644 --- a/lib/scss_lint/linter/disable_linter_reason.rb +++ b/lib/scss_lint/linter/disable_linter_reason.rb @@ -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 @@ -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 diff --git a/lib/scss_lint/linter/hex_validation.rb b/lib/scss_lint/linter/hex_validation.rb index 65929ad4..8d594b6a 100644 --- a/lib/scss_lint/linter/hex_validation.rb +++ b/lib/scss_lint/linter/hex_validation.rb @@ -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 diff --git a/lib/scss_lint/linter/indentation.rb b/lib/scss_lint/linter/indentation.rb index 27650d9d..d78e5e87 100644 --- a/lib/scss_lint/linter/indentation.rb +++ b/lib/scss_lint/linter/indentation.rb @@ -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 diff --git a/lib/scss_lint/linter/space_around_operator.rb b/lib/scss_lint/linter/space_around_operator.rb index e492aef5..086beb2e 100644 --- a/lib/scss_lint/linter/space_around_operator.rb +++ b/lib/scss_lint/linter/space_around_operator.rb @@ -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 diff --git a/lib/scss_lint/linter/space_between_parens.rb b/lib/scss_lint/linter/space_between_parens.rb index 4e19650d..47209fa9 100644 --- a/lib/scss_lint/linter/space_between_parens.rb +++ b/lib/scss_lint/linter/space_between_parens.rb @@ -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 diff --git a/lib/scss_lint/linter/string_quotes.rb b/lib/scss_lint/linter/string_quotes.rb index 011462c4..20cdf5c6 100644 --- a/lib/scss_lint/linter/string_quotes.rb +++ b/lib/scss_lint/linter/string_quotes.rb @@ -66,7 +66,7 @@ def check_single_quotes(node, string) if string =~ /(?= 2.3' + s.required_ruby_version = '>= 2.4' s.add_dependency 'rake', '>= 0.9', '< 13' s.add_dependency 'sass', '~> 3.5', '>= 3.5.5'