Merge pull request #550 from mbj/enhancement/update-rubocop-settings

Update rubocop configuration
This commit is contained in:
Markus Schirp 2016-03-21 01:11:45 +00:00
commit 237d032f63
6 changed files with 34 additions and 33 deletions

View file

@ -1,11 +1,7 @@
AllCops:
Include:
- 'Gemfile'
Exclude:
- 'Gemfile.devtools'
- 'vendor/**/*'
- 'tmp/**/*'
- 'test_app/**/*'
- 'benchmarks/**/*'
- 'bin/mutant'
TargetRubyVersion: 2.2

View file

@ -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

View file

@ -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

View file

@ -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")

View file

@ -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

View file

@ -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)