diff --git a/.rubocop.yml b/.rubocop.yml index c82ce1d8d..17439fba3 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,7 +1,7 @@ AllCops: + DisplayCopNames: true Exclude: - - 'vendor/**/*' - - 'tmp/**/*' - 'test_app/**/*' - - 'bin/mutant' + - 'tmp/**/*' + - 'vendor/**/*' TargetRubyVersion: 2.2 diff --git a/bin/mutant b/bin/mutant index 63516c24c..7472a46cb 100755 --- a/bin/mutant +++ b/bin/mutant @@ -21,7 +21,7 @@ namespace = .curry .call(Kernel), root_require: 'mutant', - includes: %w[ + includes: %w[ mutant unparser morpher diff --git a/config/rubocop.yml b/config/rubocop.yml index a4eb1cef5..8e1a43dad 100644 --- a/config/rubocop.yml +++ b/config/rubocop.yml @@ -177,3 +177,6 @@ AlignHash: # Prefer `public_send` and `__send__` over `send` Send: Enabled: true + +Lint/UnifiedInteger: + Enabled: false diff --git a/lib/mutant/color.rb b/lib/mutant/color.rb index d2c65642e..703eeeedc 100644 --- a/lib/mutant/color.rb +++ b/lib/mutant/color.rb @@ -29,8 +29,7 @@ def format(text) # Initialize null color # # @return [undefined] - def initialize - end + def initialize; end end.new diff --git a/lib/mutant/mutator/node/literal/nil.rb b/lib/mutant/mutator/node/literal/nil.rb index e508cfd9f..f6d6ad8cd 100644 --- a/lib/mutant/mutator/node/literal/nil.rb +++ b/lib/mutant/mutator/node/literal/nil.rb @@ -12,8 +12,7 @@ class Nil < self # Emit mutations # # @return [undefined] - def dispatch - end + def dispatch; end end # Nil end # Literal diff --git a/meta/case.rb b/meta/case.rb index 5ff2ab860..4c767d4e6 100644 --- a/meta/case.rb +++ b/meta/case.rb @@ -29,6 +29,7 @@ RUBY end +# rubocop:disable Metrics/BlockLength Mutant::Meta::Example.add :case do source <<-RUBY case condition diff --git a/mutant.gemspec b/mutant.gemspec index 1022ae02a..5a069f635 100644 --- a/mutant.gemspec +++ b/mutant.gemspec @@ -1,5 +1,6 @@ require File.expand_path('../lib/mutant/version', __FILE__) +# rubocop:disable Metrics/BlockLength Gem::Specification.new do |gem| gem.name = 'mutant' gem.version = Mutant::VERSION.dup diff --git a/spec/support/xspec.rb b/spec/support/xspec.rb index 6467a1ad5..2638dcca5 100644 --- a/spec/support/xspec.rb +++ b/spec/support/xspec.rb @@ -77,9 +77,9 @@ def self.assert_not_empty(event_list) private_class_method :assert_not_empty def self.assert_total(event_list) - if event_list[0..-2].map(&:first).any?(&TERMINATE_EVENTS.method(:include?)) - fail "Reaction not total: #{event_list}" - end + return unless event_list[0..-2].map(&:first).any?(&TERMINATE_EVENTS.method(:include?)) + + fail "Reaction not total: #{event_list}" end private_class_method :assert_total end # MessageReaction diff --git a/spec/unit/mutant/env/bootstrap_spec.rb b/spec/unit/mutant/env/bootstrap_spec.rb index 10cb404d8..2606fe087 100644 --- a/spec/unit/mutant/env/bootstrap_spec.rb +++ b/spec/unit/mutant/env/bootstrap_spec.rb @@ -93,8 +93,7 @@ def self.name # Fix Class#name so other specs do not see this one class << invalid_class undef :name - def name - end + def name; end end end @@ -151,8 +150,7 @@ def self.name # Fix Class#name so other specs do not see this one class << invalid_class undef :name - def name - end + def name; end end end diff --git a/spec/unit/mutant/matcher/methods/instance_spec.rb b/spec/unit/mutant/matcher/methods/instance_spec.rb index f4621b93f..4b93b6c31 100644 --- a/spec/unit/mutant/matcher/methods/instance_spec.rb +++ b/spec/unit/mutant/matcher/methods/instance_spec.rb @@ -4,11 +4,9 @@ let(:class_under_test) do parent = Module.new do - def method_d - end + def method_d; end - def method_e - end + def method_e; end end Class.new do @@ -16,18 +14,15 @@ def method_e private :method_d - def method_a - end + def method_a; end protected - def method_b - end + def method_b; end private - def method_c - end + def method_c; end end end diff --git a/spec/unit/mutant/matcher/methods/singleton_spec.rb b/spec/unit/mutant/matcher/methods/singleton_spec.rb index 7f8970df7..ac5e2682d 100644 --- a/spec/unit/mutant/matcher/methods/singleton_spec.rb +++ b/spec/unit/mutant/matcher/methods/singleton_spec.rb @@ -4,25 +4,20 @@ let(:class_under_test) do parent = Module.new do - def method_d - end + def method_d; end - def method_e - end + def method_e; end end Class.new do extend parent - def self.method_a - end + def self.method_a; end - def self.method_b - end + def self.method_b; end class << self; protected :method_b; end - def self.method_c - end + def self.method_c; end private_class_method :method_c end diff --git a/spec/unit/mutant/repository/diff_spec.rb b/spec/unit/mutant/repository/diff_spec.rb index eef3760ff..a7957d170 100644 --- a/spec/unit/mutant/repository/diff_spec.rb +++ b/spec/unit/mutant/repository/diff_spec.rb @@ -27,6 +27,7 @@ subject { object.touches?(path, line_range) } shared_context 'test if git tracks the file' do + # rubocop:disable Lint/UnneededSplatExpansion before do expect(config.kernel).to receive(:system) .ordered diff --git a/spec/unit/mutant/subject/method/instance_spec.rb b/spec/unit/mutant/subject/method/instance_spec.rb index 5ee5fb112..23fb1ef89 100644 --- a/spec/unit/mutant/subject/method/instance_spec.rb +++ b/spec/unit/mutant/subject/method/instance_spec.rb @@ -20,8 +20,7 @@ def initialize @bar = :boo end - def foo - end + def foo; end def self.name 'Test' @@ -84,8 +83,7 @@ def self.name let(:scope) do Class.new do include Memoizable - def foo - end + def foo; end memoize :foo end end