From e4a1278e87f84bdeccc6ad879dc290a690a34bc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Houen?= Date: Sat, 20 Apr 2024 10:28:47 +0200 Subject: [PATCH 1/2] switch to rubocop-rails-omakase --- .rubocop.yml | 27 ++++----------------------- Gemfile | 2 +- Gemfile.lock | 35 ++++++++++++++++++++++++++++++++++- bin/rubocop | 29 +++++++++++++++++++++++++++++ minitest_rerun_failed.gemspec | 6 +++--- 5 files changed, 71 insertions(+), 28 deletions(-) create mode 100755 bin/rubocop diff --git a/.rubocop.yml b/.rubocop.yml index e5be021..25f5ca5 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,24 +1,5 @@ -AllCops: - TargetRubyVersion: 2.6 - NewCops: enable +# Omakase Ruby styling for Rails +inherit_gem: + rubocop-rails-omakase: rubocop.yml -Style/StringLiterals: - Enabled: true - EnforcedStyle: double_quotes - -Style/StringLiteralsInInterpolation: - Enabled: true - EnforcedStyle: double_quotes - -Layout/LineLength: - Enabled: true - Max: 200 - -Metrics/MethodLength: - Enabled: false - -Metrics/AbcSize: - Max: 19 - -Style/ConditionalAssignment: - Enabled: false +# Your own specialized rules go here diff --git a/Gemfile b/Gemfile index 1232952..72c3258 100644 --- a/Gemfile +++ b/Gemfile @@ -8,6 +8,6 @@ gemspec gem "minitest" gem "minitest-reporters" gem "rake" -gem "rubocop" gem "rubocop-minitest" gem "rubocop-rake" +gem "rubocop-rails-omakase", require: false, group: :development diff --git a/Gemfile.lock b/Gemfile.lock index 5de0664..0d306bc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,18 +8,37 @@ PATH GEM remote: https://rubygems.org/ specs: + activesupport (7.1.3.2) + base64 + bigdecimal + concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + minitest (>= 5.1) + mutex_m + tzinfo (~> 2.0) ansi (1.5.0) ast (2.4.2) + base64 (0.2.0) + bigdecimal (3.1.7) builder (3.2.4) + concurrent-ruby (1.2.3) + connection_pool (2.4.1) + drb (2.2.1) + i18n (1.14.4) + concurrent-ruby (~> 1.0) minitest (5.14.4) minitest-reporters (1.4.3) ansi builder minitest (>= 5.0) ruby-progressbar + mutex_m (0.2.0) parallel (1.20.1) parser (3.0.2.0) ast (~> 2.4.1) + rack (3.0.10) rainbow (3.0.0) rake (13.0.6) regexp_parser (2.1.1) @@ -37,9 +56,23 @@ GEM parser (>= 3.0.1.1) rubocop-minitest (0.15.0) rubocop (>= 0.90, < 2.0) + rubocop-performance (1.19.1) + rubocop (>= 1.7.0, < 2.0) + rubocop-ast (>= 0.4.0) + rubocop-rails (2.15.2) + activesupport (>= 4.2.0) + rack (>= 1.1) + rubocop (>= 1.7.0, < 2.0) + rubocop-rails-omakase (1.0.0) + rubocop + rubocop-minitest + rubocop-performance + rubocop-rails rubocop-rake (0.6.0) rubocop (~> 1.0) ruby-progressbar (1.11.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) unicode-display_width (2.0.0) PLATFORMS @@ -53,8 +86,8 @@ DEPENDENCIES minitest-reporters minitest-rerun-failed! rake - rubocop rubocop-minitest + rubocop-rails-omakase rubocop-rake BUNDLED WITH diff --git a/bin/rubocop b/bin/rubocop new file mode 100755 index 0000000..d0c4882 --- /dev/null +++ b/bin/rubocop @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'rubocop' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rubocop", "rubocop") diff --git a/minitest_rerun_failed.gemspec b/minitest_rerun_failed.gemspec index 269ca4e..2282f2e 100644 --- a/minitest_rerun_failed.gemspec +++ b/minitest_rerun_failed.gemspec @@ -5,8 +5,8 @@ require_relative "lib/minitest_rerun_failed/version" Gem::Specification.new do |spec| spec.name = "minitest-rerun-failed" spec.version = MinitestRerunFailed::VERSION - spec.authors = ["Søren Houen"] - spec.email = ["s@houen.net"] + spec.authors = [ "Søren Houen" ] + spec.email = [ "s@houen.net" ] spec.summary = "Easily rerun failed tests with Minitest" spec.homepage = "https://www.github.com/houen/minitest-rerun-failed" @@ -24,7 +24,7 @@ Gem::Specification.new do |spec| end spec.bindir = "exe" spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) } - spec.require_paths = ["lib"] + spec.require_paths = [ "lib" ] # Uncomment to register a new dependency of your gem spec.add_dependency "minitest", ">= 5.0.0" From a62bf22b2e6bfaa3fb62c3db0351ee03e91faeab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Houen?= Date: Sat, 20 Apr 2024 10:28:51 +0200 Subject: [PATCH 2/2] Obey --- test/real/minitest_rerun_failed_test.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/real/minitest_rerun_failed_test.rb b/test/real/minitest_rerun_failed_test.rb index f8f5e7a..ec96094 100644 --- a/test/real/minitest_rerun_failed_test.rb +++ b/test/real/minitest_rerun_failed_test.rb @@ -75,15 +75,15 @@ def test_it_succeeds end def test_that_it_has_a_version_number - refute_nil ::MinitestRerunFailed::VERSION + assert_not_nil ::MinitestRerunFailed::VERSION end def test_it_writes_failed_tests_to_stdout - refute_empty fail_self_console_output + assert_not_empty fail_self_console_output end def test_it_writes_failed_tests_to_file - refute_empty fail_self_file_output + assert_not_empty fail_self_file_output end def test_it_prints_failed_tests_with_seed