Skip to content

Commit

Permalink
drop support for EOL'd Ruby, require 2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
searls committed Jan 24, 2022
1 parent c0e6afa commit a0a6ba9
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest ]
ruby-version: [2.5, 2.6, 2.7, '3.0', 3.1]
ruby-version: [2.6, 2.7, '3.0', 3.1]

runs-on: ${{ matrix.os }}

Expand Down
2 changes: 1 addition & 1 deletion .standard.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ruby_version: 2.2.0
ruby_version: 2.6
ignore:
- tmp/**/*
- test/fixture/**/*
2 changes: 1 addition & 1 deletion lib/standard/creates_config_store/assigns_rubocop_yaml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Standard::CreatesConfigStore
class AssignsRubocopYaml
def call(config_store, standard_config)
config_store.options_config = rubocop_yaml_path(standard_config[:ruby_version])
config_store.instance_variable_get("@options_config")
config_store.instance_variable_get(:@options_config)
end

private
Expand Down
2 changes: 1 addition & 1 deletion standard.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
spec.version = Standard::VERSION
spec.authors = ["Justin Searls"]
spec.email = ["searls@gmail.com"]
spec.required_ruby_version = ">= 2.5.0"
spec.required_ruby_version = ">= 2.6.0"

spec.summary = "Ruby Style Guide, with linter & automatic code fixer"
spec.homepage = "https://github.com/testdouble/standard"
Expand Down
4 changes: 2 additions & 2 deletions test/standard/builds_config_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_decked_out_standard_yaml

expected_config = RuboCop::ConfigStore.new.tap do |config_store|
config_store.options_config = path("config/ruby-1.8.yml")
options_config = config_store.instance_variable_get("@options_config")
options_config = config_store.instance_variable_get(:@options_config)
options_config["AllCops"]["Exclude"] |= [path("test/fixture/config/y/monkey/**/*")]
options_config["Fake/Lol"] = {"Exclude" => [path("test/fixture/config/y/neat/cool.rb")]}
options_config["Fake/Kek"] = {"Exclude" => [path("test/fixture/config/y/neat/cool.rb")]}
Expand Down Expand Up @@ -131,7 +131,7 @@ def test_todo_with_offenses_merged
def config_store(config_root = nil, rubocop_yml = highest_compatible_yml_version, ruby_version = RUBY_VERSION)
RuboCop::ConfigStore.new.tap do |config_store|
config_store.options_config = path(rubocop_yml)
options_config = config_store.instance_variable_get("@options_config")
options_config = config_store.instance_variable_get(:@options_config)
options_config["AllCops"]["TargetRubyVersion"] = ruby_version.to_f
options_config["AllCops"]["Exclude"] |= standard_default_ignores(config_root)
end.for("").to_h
Expand Down
12 changes: 6 additions & 6 deletions test/standard_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ def test_configured_all_cops
base = "config/base.yml"

# see if everything is configured
allowed = Standard::BuildsConfig.new.call([]).
rubocop_config_store.
instance_variable_get(:@options_config).
instance_variable_get(:@hash).
keys
allowed = Standard::BuildsConfig.new.call([])
.rubocop_config_store
.instance_variable_get(:@options_config)
.instance_variable_get(:@hash)
.keys
configured = YAML.load_file(base).keys
missing = (allowed - configured).grep(/\//) # ignore groups like "Layout"
extra = (configured - allowed).grep(/\AA-Z/) # ignore "require"
Expand All @@ -27,7 +27,7 @@ def test_configured_all_cops
separator = "\n\n"
sections = File.read(base).strip.split(separator)
sections += missing.map { |key| "#{key}:\n Enabled: false" }
sections = sections.first(1) + sections[1..-1].sort # keep require in the front
sections = sections.first(1) + sections[1..].sort # keep require in the front
File.write(base, sections.join(separator) + "\n")
flunk "#{base} has been rewritten to add missing cops, review and commit it"
end
Expand Down

0 comments on commit a0a6ba9

Please sign in to comment.