diff --git a/.rubocop.yml b/.rubocop.yml index 7a593149..c82ce1d8 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,11 +1,7 @@ AllCops: - Include: - - 'Gemfile' Exclude: - - 'Gemfile.devtools' - 'vendor/**/*' - 'tmp/**/*' - 'test_app/**/*' - - 'benchmarks/**/*' - 'bin/mutant' TargetRubyVersion: 2.2 diff --git a/Rakefile b/Rakefile index 7c8b3edb..6a30d31c 100644 --- a/Rakefile +++ b/Rakefile @@ -16,23 +16,10 @@ namespace :metrics do --use rspec --zombie ] - arguments.concat(%W[--jobs 4]) if ENV.key?('CIRCLE_CI') + arguments.concat(%w[--jobs 4]) if ENV.key?('CIRCLE_CI') arguments.concat(%w[-- Mutant*]) - success = Kernel.system(*arguments) or fail 'Mutant task is not successful' - end -end - -desc 'Generate mutation operator listing' -task :list do - require 'mutant' - # TODO: Add a nice public interface - registry = Mutant::Mutator::Registry.send(:registry) - registry.keys.select do |key| - key.is_a?(Symbol) - end.sort.each do |type| - mutator = registry.fetch(type) - puts '%-18s: %s' % [type, mutator.name.sub(/\AMutant::Mutator::Node::/, '')] + Kernel.system(*arguments) or fail 'Mutant task is not successful' end end diff --git a/config/rubocop.yml b/config/rubocop.yml index 64d93f50..a4eb1cef 100644 --- a/config/rubocop.yml +++ b/config/rubocop.yml @@ -29,9 +29,17 @@ LineLength: Documentation: Enabled: false -# Do not always use &&/|| instead of and/or. +# Permit +# +# boolean_check? or fail +# +# Reject +# +# if foo or bar +# ... +# end AndOr: - Enabled: false + EnforcedStyle: conditionals # Do not favor modifier if/unless usage when you have a single-line body IfUnlessModifier: @@ -90,11 +98,6 @@ SymbolArray: EndAlignment: AlignWith: variable -# Do not always align parameters when it is easier to read -AlignParameters: - Exclude: - - spec/**/*_spec.rb - # Prefer #kind_of? over #is_a? ClassCheck: EnforcedStyle: kind_of? @@ -152,10 +155,25 @@ RedundantFreeze: IndentArray: Enabled: false -# My style is not supported +# Prefer +# +# some_receiver +# .foo +# .bar +# .baz +# +# Over +# +# some_receiver.foo +# .bar +# .baz MultilineMethodCallIndentation: - Enabled: false + EnforcedStyle: indented # Align keys and values in a multiline hash -Style/AlignHash: +AlignHash: EnforcedColonStyle: table + +# Prefer `public_send` and `__send__` over `send` +Send: + Enabled: true diff --git a/mutant.gemspec b/mutant.gemspec index 7cfcf911..418421f8 100644 --- a/mutant.gemspec +++ b/mutant.gemspec @@ -10,9 +10,9 @@ Gem::Specification.new do |gem| gem.homepage = 'https://github.com/mbj/mutant' gem.license = 'MIT' - gem.require_paths = %w[lib] + gem.require_paths = %w[lib] - mutant_integration_files = `git ls-files -- lib/mutant/integration/*.rb`.split("\n") + mutant_integration_files = `git ls-files -- lib/mutant/integration/*.rb`.split("\n") gem.files = `git ls-files`.split("\n") - mutant_integration_files gem.test_files = `git ls-files -- spec/{unit,integration}`.split("\n") diff --git a/spec/support/xspec.rb b/spec/support/xspec.rb index 84884e72..24f75643 100644 --- a/spec/support/xspec.rb +++ b/spec/support/xspec.rb @@ -9,7 +9,7 @@ module XSpec def call(observation) event_list.map do |event, object| - send(event, observation, object) + __send__(event, observation, object) end.last end diff --git a/spec/unit/mutant/parallel/master_spec.rb b/spec/unit/mutant/parallel/master_spec.rb index c42f70db..899d55bb 100644 --- a/spec/unit/mutant/parallel/master_spec.rb +++ b/spec/unit/mutant/parallel/master_spec.rb @@ -72,7 +72,7 @@ RSpec.describe Mutant::Parallel::Master do # Needed because of rubies undefined-ivar-read-is-nil stuff describe 'object initialization' do - let(:object) { described_class.send(:new, config, actor_env.mailbox(:master)) } + let(:object) { described_class.__send__(:new, config, actor_env.mailbox(:master)) } it 'initializes falsy ivars' do expect(object.instance_variable_get(:@stop)).to be(false)