From fee9e6fe5eccb7b8a159bc59ab0239e26a55cbea Mon Sep 17 00:00:00 2001 From: John Backus Date: Sun, 24 Jul 2016 13:41:58 -0700 Subject: [PATCH] Fix RuboCop and Reek violations Introduced by new devtools release --- lib/mutant/ast/nodes.rb | 2 ++ lib/mutant/ast/types.rb | 2 ++ lib/mutant/integration/rspec.rb | 2 ++ lib/mutant/matcher/config.rb | 2 ++ lib/mutant/mutator/node.rb | 2 -- .../reporter/cli/printer/mutation_result.rb | 2 ++ spec/support/corpus.rb | 15 +++------------ spec/unit/mutant/context_spec.rb | 7 ++----- spec/unit/mutant/matcher/methods/instance_spec.rb | 2 -- 9 files changed, 15 insertions(+), 21 deletions(-) diff --git a/lib/mutant/ast/nodes.rb b/lib/mutant/ast/nodes.rb index 3dd72d6b..bb5eef74 100644 --- a/lib/mutant/ast/nodes.rb +++ b/lib/mutant/ast/nodes.rb @@ -1,6 +1,8 @@ module Mutant module AST # Singleton nodes + # + # :reek:TooManyConstants module Nodes extend Sexp diff --git a/lib/mutant/ast/types.rb b/lib/mutant/ast/types.rb index 593b369b..dd3f9682 100644 --- a/lib/mutant/ast/types.rb +++ b/lib/mutant/ast/types.rb @@ -1,6 +1,8 @@ module Mutant module AST # Groups of node types + # + # :reek:TooManyConstants module Types symbolset = ->(strings) { strings.map(&:to_sym).to_set.freeze } diff --git a/lib/mutant/integration/rspec.rb b/lib/mutant/integration/rspec.rb index 62c8c2f8..98b91130 100644 --- a/lib/mutant/integration/rspec.rb +++ b/lib/mutant/integration/rspec.rb @@ -17,6 +17,8 @@ module Mutant # * location # Is NOT enough. It would not be unique. So we add an "example index" # for unique reference. + # + # :reek:TooManyConstants class Rspec < self ALL_EXPRESSION = Expression::Namespace::Recursive.new(scope_name: nil) diff --git a/lib/mutant/matcher/config.rb b/lib/mutant/matcher/config.rb index 5fb4cdc7..19586230 100644 --- a/lib/mutant/matcher/config.rb +++ b/lib/mutant/matcher/config.rb @@ -1,6 +1,8 @@ module Mutant class Matcher # Subject matcher configuration + # + # :reek:TooManyConstants class Config include Adamantium, Anima.new( :ignore_expressions, diff --git a/lib/mutant/mutator/node.rb b/lib/mutant/mutator/node.rb index 5969fbfa..bd300aef 100644 --- a/lib/mutant/mutator/node.rb +++ b/lib/mutant/mutator/node.rb @@ -54,8 +54,6 @@ module Mutant # @param [Fixnum] index # # @return [undefined] - # - # rubocop:disable RedundantBlockCall - its not redundant here def mutate_child(index, &block) block ||= TAUTOLOGY Mutator.mutate(children.fetch(index), self).each do |mutation| diff --git a/lib/mutant/reporter/cli/printer/mutation_result.rb b/lib/mutant/reporter/cli/printer/mutation_result.rb index 9710a6a6..bb9c9092 100644 --- a/lib/mutant/reporter/cli/printer/mutation_result.rb +++ b/lib/mutant/reporter/cli/printer/mutation_result.rb @@ -3,6 +3,8 @@ module Mutant class CLI class Printer # Reporter for mutation results + # + # :reek:TooManyConstants class MutationResult < self delegate :mutation, :test_result diff --git a/spec/support/corpus.rb b/spec/support/corpus.rb index 6bd3ec60..fa91c3a2 100644 --- a/spec/support/corpus.rb +++ b/spec/support/corpus.rb @@ -294,7 +294,6 @@ module MutantSpec end end # ErrorWhitelist - # rubocop:disable ClosingParenthesisIndentation LOADER = Morpher.build do s(:block, s(:guard, s(:primitive, Array)), @@ -317,22 +316,14 @@ module MutantSpec [ ->(hash) { hash.map { |key, values| [key, values.map(&Pathname.method(:new))] }.to_h }, ->(hash) { hash.map { |key, values| [key, values.map(&:to_s)] }.to_h } - ] - ), - s(:load_attribute_hash, s(:param, ErrorWhitelist)) - ) - ) - ), + ]), + s(:load_attribute_hash, s(:param, ErrorWhitelist))))), s(:load_attribute_hash, # NOTE: The domain param has no DSL currently! Morpher::Evaluator::Transformer::Domain::Param.new( Project, %i[repo_uri name expected_errors mutation_coverage mutation_generation] - ) - ) - ) - ) - ) + ))))) end ALL = LOADER.call(YAML.load_file(ROOT.join('spec', 'integrations.yml'))) diff --git a/spec/unit/mutant/context_spec.rb b/spec/unit/mutant/context_spec.rb index 8a7cfc6a..ef0e7301 100644 --- a/spec/unit/mutant/context_spec.rb +++ b/spec/unit/mutant/context_spec.rb @@ -1,4 +1,3 @@ -# rubocop:disable ClosingParenthesisIndentation RSpec.describe Mutant::Context do describe '.wrap' do subject { described_class.wrap(scope, node) } @@ -11,8 +10,7 @@ RSpec.describe Mutant::Context do let(:expected) do s(:module, s(:const, nil, :Mutant), - s(:str, 'test') - ) + s(:str, 'test')) end it { should eql(expected) } @@ -25,8 +23,7 @@ RSpec.describe Mutant::Context do s(:class, s(:const, nil, :Context), nil, - s(:str, 'test') - ) + s(:str, 'test')) end it { should eql(expected) } diff --git a/spec/unit/mutant/matcher/methods/instance_spec.rb b/spec/unit/mutant/matcher/methods/instance_spec.rb index 2d49d3de..f4621b93 100644 --- a/spec/unit/mutant/matcher/methods/instance_spec.rb +++ b/spec/unit/mutant/matcher/methods/instance_spec.rb @@ -16,8 +16,6 @@ RSpec.describe Mutant::Matcher::Methods::Instance, '#call' do private :method_d - public - def method_a end