Skip to content

Commit a707c23

Browse files
Drenmibbatsov
authored andcommitted
Drop support for MRI 2.1
1 parent 3c120fc commit a707c23

23 files changed

+87
-318
lines changed

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ AllCops:
1010
- 'vendor/**/*'
1111
- 'spec/fixtures/**/*'
1212
- 'tmp/**/*'
13-
TargetRubyVersion: 2.1
13+
TargetRubyVersion: 2.2
1414

1515
Naming/PredicateName:
1616
# Method define macros for dynamically generated method.

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ dist: trusty
55
rvm:
66
- jruby-9.2.0.0
77
- jruby-head
8-
- 2.1.10
98
- 2.2.10
109
- 2.3.7
1110
- 2.4.4

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
* [#6006](https://github.com/bbatsov/rubocop/pull/6006): Remove `rake repl` task. ([@koic][])
1818

1919
## 0.57.2 (2018-06-12)
20+
### Changes
21+
22+
* Drop support for MRI 2.1. ([@drenmi][])
2023

2124
### Bug fixes
2225

Gemfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ gemspec
66

77
gem 'bump', require: false
88
gem 'pry'
9-
# pry-byebug requires MRI 2.2.0 or higher.
10-
gem 'pry-byebug' if RUBY_ENGINE == 'ruby' && RUBY_VERSION >= '2.2.0'
9+
gem 'pry-byebug' if RUBY_ENGINE == 'ruby'
1110
gem 'rake', '~> 12.0'
1211
gem 'rspec', '~> 3.7'
1312
gem 'rubocop-rspec', '~> 1.26.0'

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ You can read a ton more about RuboCop in its [official manual](http://docs.ruboc
7272

7373
RuboCop supports the following Ruby implementations:
7474

75-
* MRI 2.1+
75+
* MRI 2.2+
7676
* JRuby 9.0+
7777

7878
The Rails cops support the following versions:

config/default.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ AllCops:
130130
# followed by the Gemfile.lock or gems.locked file. (Although the Ruby version
131131
# is specified in the Gemfile or gems.rb file, RuboCop reads the final value
132132
# from the lock file.) If the Ruby version is still unresolved, RuboCop will
133-
# use the oldest officially supported Ruby version (currently Ruby 2.1).
133+
# use the oldest officially supported Ruby version (currently Ruby 2.2).
134134
TargetRubyVersion: ~
135135
# What version of Rails is the inspected code using? If a value is specified
136136
# for TargetRailsVersion then it is used. Acceptable values are specificed

lib/rubocop/config.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ class Config
1616

1717
COMMON_PARAMS = %w[Exclude Include Severity
1818
AutoCorrect StyleGuide Details].freeze
19-
# 2.1 is the oldest officially supported Ruby version.
20-
DEFAULT_RUBY_VERSION = 2.1
21-
KNOWN_RUBIES = [2.1, 2.2, 2.3, 2.4, 2.5].freeze
22-
OBSOLETE_RUBIES = { 1.9 => '0.50', 2.0 => '0.50' }.freeze
19+
# 2.2 is the oldest officially supported Ruby version.
20+
DEFAULT_RUBY_VERSION = 2.2
21+
KNOWN_RUBIES = [2.2, 2.3, 2.4, 2.5].freeze
22+
OBSOLETE_RUBIES = { 1.9 => '0.50', 2.0 => '0.50', 2.1 => '0.58' }.freeze
2323
RUBY_VERSION_FILENAME = '.ruby-version'.freeze
2424
DEFAULT_RAILS_VERSION = 5.0
2525
OBSOLETE_COPS = {

lib/rubocop/config_loader.rb

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,11 @@ def read_file(absolute_path)
176176
end
177177

178178
def yaml_safe_load(yaml_code, filename)
179-
if YAML.respond_to?(:safe_load) # Ruby 2.1+
180-
if defined?(SafeYAML) && SafeYAML.respond_to?(:load)
181-
SafeYAML.load(yaml_code, filename,
182-
whitelisted_tags: %w[!ruby/regexp])
183-
else
184-
YAML.safe_load(yaml_code, [Regexp, Symbol], [], false, filename)
185-
end
179+
if defined?(SafeYAML) && SafeYAML.respond_to?(:load)
180+
SafeYAML.load(yaml_code, filename,
181+
whitelisted_tags: %w[!ruby/regexp])
186182
else
187-
YAML.load(yaml_code, filename) # rubocop:disable Security/YAMLLoad
183+
YAML.safe_load(yaml_code, [Regexp, Symbol], [], false, filename)
188184
end
189185
end
190186
end

lib/rubocop/processed_source.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,9 @@ def tokenize(parser)
163163
[ast, comments, tokens]
164164
end
165165

166-
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength
166+
# rubocop:disable Metrics/MethodLength
167167
def parser_class(ruby_version)
168168
case ruby_version
169-
when 2.1
170-
require 'parser/ruby21'
171-
Parser::Ruby21
172169
when 2.2
173170
require 'parser/ruby22'
174171
Parser::Ruby22
@@ -188,7 +185,7 @@ def parser_class(ruby_version)
188185
raise ArgumentError, "Unknown Ruby version: #{ruby_version.inspect}"
189186
end
190187
end
191-
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/MethodLength
188+
# rubocop:enable Metrics/MethodLength
192189

193190
def create_parser(ruby_version)
194191
builder = RuboCop::AST::Builder.new

lib/rubocop/rspec/shared_contexts.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@
5959
end
6060
end
6161

62-
shared_context 'ruby 2.1', :ruby21 do
63-
let(:ruby_version) { 2.1 }
64-
end
65-
6662
shared_context 'ruby 2.2', :ruby22 do
6763
let(:ruby_version) { 2.2 }
6864
end

0 commit comments

Comments
 (0)