diff --git a/lib/mutant.rb b/lib/mutant.rb index 0c8a2969..8348d9f9 100644 --- a/lib/mutant.rb +++ b/lib/mutant.rb @@ -33,7 +33,6 @@ module Mutant # @return [Boolean] # # @api private - # def self.ci? ENV.key?('CI') end diff --git a/lib/mutant/actor.rb b/lib/mutant/actor.rb index 80a28b66..f1a71c45 100644 --- a/lib/mutant/actor.rb +++ b/lib/mutant/actor.rb @@ -10,12 +10,11 @@ module Mutant Undefined = Class.new do INSPECT = 'Mutant::Actor::Undefined'.freeze - # Return object inspection + # Object inspection # # @return [String] # # @api private - # def inspect INSPECT end @@ -25,7 +24,7 @@ module Mutant class Message include Concord::Public.new(:type, :payload) - # Return new message + # New message # # @param [Symbol] type # @param [Object] payload @@ -33,7 +32,6 @@ module Mutant # @return [Message] # # @api private - # def self.new(_type, _payload = Undefined) super end @@ -51,7 +49,6 @@ module Mutant # @return [Object] # # @api private - # def call(type) other.call(Message.new(type, mailbox.sender)) message = mailbox.receiver.call diff --git a/lib/mutant/actor/env.rb b/lib/mutant/actor/env.rb index 7a0cbdea..404915f6 100644 --- a/lib/mutant/actor/env.rb +++ b/lib/mutant/actor/env.rb @@ -9,7 +9,6 @@ module Mutant # @return [Actor::Sender] # # @api private - # def spawn mailbox = new_mailbox @@ -20,12 +19,11 @@ module Mutant mailbox.sender end - # Return new unbound mailbox + # New unbound mailbox # # @return [Mailbox] # # @api private - # def new_mailbox Mailbox.new end diff --git a/lib/mutant/actor/mailbox.rb b/lib/mutant/actor/mailbox.rb index 4430e587..99add62a 100644 --- a/lib/mutant/actor/mailbox.rb +++ b/lib/mutant/actor/mailbox.rb @@ -4,12 +4,11 @@ module Mutant class Mailbox include Adamantium::Flat, Concord::Public.new(:receiver, :sender) - # Return new mailbox + # New mailbox # # @return [Mailbox] # # @api private - # def self.new mutex = Mutex.new condition_variable = ConditionVariable.new @@ -21,14 +20,13 @@ module Mutant ) end - # Return binding for RPC to other actors + # Binding for RPC to other actors # # @param [Actor::Sender] other # # @return [Binding] # # @api private - # def bind(other) Binding.new(self, other) end diff --git a/lib/mutant/actor/receiver.rb b/lib/mutant/actor/receiver.rb index 39aa6f01..e3034abc 100644 --- a/lib/mutant/actor/receiver.rb +++ b/lib/mutant/actor/receiver.rb @@ -9,7 +9,6 @@ module Mutant # @return [Object] # # @api private - # def call 2.times do message = try_blocking_receive @@ -29,7 +28,6 @@ module Mutant # if there is a message # # @api private - # def try_blocking_receive mutex.synchronize do if messages.empty? diff --git a/lib/mutant/actor/sender.rb b/lib/mutant/actor/sender.rb index c42f29e5..19b54676 100644 --- a/lib/mutant/actor/sender.rb +++ b/lib/mutant/actor/sender.rb @@ -12,7 +12,6 @@ module Mutant # @return [self] # # @api private - # def call(message) mutex.synchronize do messages << message diff --git a/lib/mutant/ast.rb b/lib/mutant/ast.rb index 37b12b1b..78c56f33 100644 --- a/lib/mutant/ast.rb +++ b/lib/mutant/ast.rb @@ -16,7 +16,6 @@ module Mutant # otherwise # # @api private - # def self.find_last_path(node, &predicate) fail ArgumentError, 'block expected' unless block_given? path = [] @@ -39,7 +38,6 @@ module Mutant # @return [undefined] # # @api private - # def self.walk(node, stack, &block) block.call(node, stack) node.children.grep(Parser::AST::Node) do |child| diff --git a/lib/mutant/ast/meta.rb b/lib/mutant/ast/meta.rb index af2955a9..f7701c7b 100644 --- a/lib/mutant/ast/meta.rb +++ b/lib/mutant/ast/meta.rb @@ -19,12 +19,11 @@ module Mutant INDEX_ASSIGNMENT_SELECTOR = :[]= ATTRIBUTE_ASSIGNMENT_SELECTOR_SUFFIX = '='.freeze - # Return arguments + # Arguments of mutated node # # @return [Enumerable] # # @api private - # alias_method :arguments, :remaining_children # Test if AST node is a valid assignment target @@ -32,7 +31,6 @@ module Mutant # @return [Boolean] # # @api private - # def assignment? index_assignment? || attribute_assignment? end @@ -42,7 +40,6 @@ module Mutant # @return [Boolean] # # @api private - # def attribute_assignment? !Types::METHOD_OPERATORS.include?(selector) && selector.to_s.end_with?(ATTRIBUTE_ASSIGNMENT_SELECTOR_SUFFIX) @@ -53,7 +50,6 @@ module Mutant # @return [Boolean] # # @api private - # def index_assignment? selector.equal?(INDEX_ASSIGNMENT_SELECTOR) end @@ -63,7 +59,6 @@ module Mutant # @return [Boolean] # # @api private - # def binary_method_operator? Types::BINARY_METHOD_OPERATORS.include?(selector) end diff --git a/lib/mutant/ast/named_children.rb b/lib/mutant/ast/named_children.rb index 238ba2b9..dd6c75fa 100644 --- a/lib/mutant/ast/named_children.rb +++ b/lib/mutant/ast/named_children.rb @@ -11,7 +11,6 @@ module Mutant # @return [undefined] # # @api private - # def self.included(host) host.class_eval do include InstanceMethods @@ -24,12 +23,11 @@ module Mutant private - # Return children + # Mutated nodes children # # @return [Array exception @@ -33,19 +32,17 @@ module Mutant # @return [undefined] # # @api private - # def initialize(arguments) @config = Config::DEFAULT parse(arguments) end - # Return config + # Config parsed from CLI # # @return [Config] # # @api private - # attr_reader :config private @@ -61,7 +58,6 @@ module Mutant # @return [undefined] # # @api private - # def parse(arguments) opts = OptionParser.new do |builder| builder.banner = 'usage: mutant [options] MATCH_EXPRESSION ...' @@ -82,7 +78,6 @@ module Mutant # @return [undefined] # # @api private - # def parse_match_expressions(expressions) fail Error, 'No expressions given' if expressions.empty? @@ -97,10 +92,9 @@ module Mutant # # @return [undefined] # - # @api private - # # rubocop:disable MethodLength # + # @api private def add_environment_options(opts) opts.separator('Environment:') opts.on('--zombie', 'Run mutant zombified') do @@ -124,7 +118,6 @@ module Mutant # @return [undefined] # # @api private - # def setup_integration(name) update(integration: Integration.setup(name)) rescue LoadError @@ -138,7 +131,6 @@ module Mutant # @return [undefined] # # @api private - # def add_mutation_options(opts) opts.separator(nil) opts.separator('Options:') @@ -159,7 +151,6 @@ module Mutant # @return [undefined] # # @api private - # def add_filter_options(opts) opts.on('--ignore-subject PATTERN', 'Ignore subjects that match PATTERN') do |pattern| add_matcher(:subject_ignores, config.expression_parser.(pattern)) @@ -173,7 +164,6 @@ module Mutant # @return [undefined] # # @api private - # def add_debug_options(opts) opts.on('--fail-fast', 'Fail fast') do update(fail_fast: true) @@ -198,7 +188,6 @@ module Mutant # @return [undefined] # # @api private - # def update(attributes) @config = @config.update(attributes) end @@ -214,7 +203,6 @@ module Mutant # @return [undefined] # # @api private - # def add(attribute, value) update(attribute => config.public_send(attribute).dup << value) end @@ -230,7 +218,6 @@ module Mutant # @return [undefined] # # @api private - # def add_matcher(attribute, value) update(matcher: config.matcher.add(attribute, value)) end diff --git a/lib/mutant/color.rb b/lib/mutant/color.rb index 3df471f0..8d1c1636 100644 --- a/lib/mutant/color.rb +++ b/lib/mutant/color.rb @@ -10,7 +10,6 @@ module Mutant # @return [String] # # @api private - # def format(text) "\e[#{@code}m#{text}\e[0m" end @@ -25,7 +24,6 @@ module Mutant # the argument string # # @api private - # def format(text) text end @@ -37,7 +35,6 @@ module Mutant # @return [undefined] # # @api private - # def initialize end diff --git a/lib/mutant/config.rb b/lib/mutant/config.rb index 1628100f..7acf858d 100644 --- a/lib/mutant/config.rb +++ b/lib/mutant/config.rb @@ -1,5 +1,8 @@ module Mutant - # The configuration of a mutator run + # Standalone configuration of a mutant execution. + # + # Does not reference any "external" volatile state. The configuration applied + # to current environment is being represented by the Mutant::Env object. class Config include Adamantium::Flat, Anima::Update, Anima.new( :debug, diff --git a/lib/mutant/context.rb b/lib/mutant/context.rb index aa088a77..66d8f23f 100644 --- a/lib/mutant/context.rb +++ b/lib/mutant/context.rb @@ -3,22 +3,20 @@ module Mutant class Context include Adamantium::Flat, AbstractType, Concord::Public.new(:source_path) - # Return root ast node + # Root ast node # # @param [Parser::AST::Node] node # # @return [Parser::AST::Node] # # @api private - # abstract_method :root - # Return identification + # Identification string # # @return [String] # # @api private - # abstract_method :identification end # Context diff --git a/lib/mutant/context/scope.rb b/lib/mutant/context/scope.rb index 2d70f559..0468f3cf 100644 --- a/lib/mutant/context/scope.rb +++ b/lib/mutant/context/scope.rb @@ -7,24 +7,22 @@ module Mutant NAMESPACE_DELIMITER = '::'.freeze - # Return AST wrapping mutated node + # Return root node for mutation # # @return [Parser::AST::Node] # # @api private - # def root(node) nesting.reverse.reduce(node) do |current, scope| self.class.wrap(scope, current) end end - # Return identification + # Identification string # # @return [String] # # @api private - # def identification scope.name end @@ -41,7 +39,6 @@ module Mutant # if scope is of kind module # # @api private - # def self.wrap(scope, node) name = s(:const, nil, scope.name.split(NAMESPACE_DELIMITER).last.to_sym) case scope @@ -54,12 +51,11 @@ module Mutant end end - # Return nesting + # Nesting of scope # # @return [Enumerable] # # @api private - # def nesting const = ::Object name_nesting.each_with_object([]) do |name, nesting| @@ -69,22 +65,20 @@ module Mutant end memoize :nesting - # Return unqualified name of scope + # Unqualified name of scope # # @return [String] # # @api private - # def unqualified_name name_nesting.last end - # Return match expressions + # Match expressions for scope # # @return [Enumerable] # # @api private - # def match_expressions name_nesting.each_index.reverse_each.map do |index| Expression::Namespace::Recursive.new( @@ -94,22 +88,20 @@ module Mutant end memoize :match_expressions - # Return scope wrapped by context + # Scope wrapped by context # # @return [::Module|::Class] # # @api private - # attr_reader :scope private - # Return nesting of names of scope + # Nesting of names in scope # # @return [Array] # # @api private - # def name_nesting scope.name.split(NAMESPACE_DELIMITER) end diff --git a/lib/mutant/delegator.rb b/lib/mutant/delegator.rb index 40bd6e94..6d1918cc 100644 --- a/lib/mutant/delegator.rb +++ b/lib/mutant/delegator.rb @@ -11,7 +11,6 @@ module Mutant # @return [undefined] # # @api private - # def delegate(*names) names.each(&method(:define_delegator)) end @@ -23,7 +22,6 @@ module Mutant # @return [undefined] # # @api private - # def define_delegator(name) fail "method #{name} already defined" if instance_methods.include?(name) define_method(name) do @@ -41,7 +39,6 @@ module Mutant # @return [undefined] # # @api private - # def self.included(host) super diff --git a/lib/mutant/diff.rb b/lib/mutant/diff.rb index 72d6b1c6..07daa388 100644 --- a/lib/mutant/diff.rb +++ b/lib/mutant/diff.rb @@ -7,7 +7,7 @@ module Mutant DELETION = '-'.freeze NEWLINE = "\n".freeze - # Return source diff + # Unified source diff between old and new # # @return [String] # if there is exactly one diff @@ -16,7 +16,6 @@ module Mutant # otherwise # # @api private - # def diff return if diffs.empty? @@ -26,7 +25,7 @@ module Mutant end memoize :diff - # Return colorized source diff + # Colorized unified source diff between old and new # # @return [String] # if there is a diff @@ -35,14 +34,13 @@ module Mutant # otherwise # # @api private - # def colorized_diff return unless diff diff.lines.map(&self.class.method(:colorize_line)).join end memoize :colorized_diff - # Return new object + # Build new object from source strings # # @param [String] old # @param [String] new @@ -50,7 +48,6 @@ module Mutant # @return [Diff] # # @api private - # def self.build(old, new) new(lines(old), lines(new)) end @@ -62,7 +59,6 @@ module Mutant # @return [Array] # # @api private - # def self.lines(source) source.lines.map(&:chomp) end @@ -70,34 +66,31 @@ module Mutant private - # Return diffs + # Diffs between old and new # # @return [Array] # # @api private - # def diffs ::Diff::LCS.diff(old, new) end - # Return hunks + # Raw diff-lcs hunks # # @return [Array] # # @api private - # def hunks diffs.map do |diff| ::Diff::LCS::Hunk.new(old, new, diff, max_length, 0) end end - # Return minimized hunks + # Minimized hunks # # @return [Array] # # @api private - # def minimized_hunks head, *tail = hunks @@ -111,24 +104,22 @@ module Mutant end end - # Return max length + # Max length of source line in new and old # # @return [Fixnum] # # @api private - # def max_length [old, new].map(&:length).max end - # Return colorized diff line + # Colorized a unified diff line # # @param [String] line # # @return [String] # # @api private - # def self.colorize_line(line) case line[0] when ADDITION diff --git a/lib/mutant/env.rb b/lib/mutant/env.rb index efda8b76..276481aa 100644 --- a/lib/mutant/env.rb +++ b/lib/mutant/env.rb @@ -23,7 +23,6 @@ module Mutant # @return [self] # # @api private - # def warn(message) config.reporter.warn(message) self @@ -36,7 +35,6 @@ module Mutant # @return [Result::Mutation] # # @api private - # def kill(mutation) test_result = run_mutation_tests(mutation) Result::Mutation.new( @@ -54,10 +52,9 @@ module Mutant # # @return [Result::Test] # - # @api private - # # rubocop:disable MethodLength # + # @api private def run_mutation_tests(mutation) start = Time.now tests = selector.call(mutation.subject) diff --git a/lib/mutant/env/bootstrap.rb b/lib/mutant/env/bootstrap.rb index fdd23bc2..d7b6ce27 100644 --- a/lib/mutant/env/bootstrap.rb +++ b/lib/mutant/env/bootstrap.rb @@ -8,20 +8,18 @@ module Mutant "Fix your lib to follow normal ruby semantics!\n" \ '{Module,Class}#name should return resolvable constant name as String or nil'.freeze - # Return scopes that are eligible for mnatching + # Scopes that are eligible for matching # # @return [Enumerable] # # @api private - # attr_reader :matchable_scopes - # Return new bootstrap env + # New bootstrap env # # @return [Env] # # @api private - # def self.new(_config, _cache = Cache.new) super end @@ -31,7 +29,6 @@ module Mutant # @return [Object] # # @api private - # def initialize(*) super infect @@ -45,18 +42,16 @@ module Mutant # @return [self] # # @api private - # def warn(message) config.reporter.warn(message) self end - # Return environment after bootstraping + # Environment after bootstraping # # @return [Env] # # @api private - # # rubocop:disable MethodLength # def env @@ -75,7 +70,7 @@ module Mutant private - # Return scope name + # Scope name from scopeing object # # @param [Class, Module] scope # @@ -86,7 +81,6 @@ module Mutant # otherwise # # @api private - # def scope_name(scope) scope.name rescue => exception @@ -99,19 +93,17 @@ module Mutant # @return [undefined] # # @api private - # def infect config.includes.each(&$LOAD_PATH.method(:<<)) config.requires.each(&method(:require)) @integration = config.integration.new(config).setup end - # Return matched subjects + # Matched subjects # # @return [Enumerable] # # @api private - # def matched_subjects Matcher::Compiler.call(self, config.matcher).to_a end @@ -121,7 +113,6 @@ module Mutant # @return [undefined] # # @api private - # def initialize_matchable_scopes scopes = ObjectSpace.each_object(Module).each_with_object([]) do |scope, aggregate| expression = expression(scope) @@ -142,7 +133,6 @@ module Mutant # otherwise # # @api private - # def expression(scope) name = scope_name(scope) or return diff --git a/lib/mutant/expression.rb b/lib/mutant/expression.rb index 92b8fd35..e2b95a28 100644 --- a/lib/mutant/expression.rb +++ b/lib/mutant/expression.rb @@ -10,22 +10,20 @@ module Mutant private_constant(*constants(false)) - # Return syntax representing this expression + # Syntax of expression # # @return [String] # # @api private - # abstract_method :syntax - # Return match length for expression + # Match length with other expression # # @param [Expression] other # # @return [Fixnum] # # @api private - # def match_length(other) if eql?(other) syntax.length @@ -41,7 +39,6 @@ module Mutant # @return [Boolean] # # @api private - # def prefix?(other) !match_length(other).zero? end diff --git a/lib/mutant/expression/method.rb b/lib/mutant/expression/method.rb index c4cef2d6..30953f7b 100644 --- a/lib/mutant/expression/method.rb +++ b/lib/mutant/expression/method.rb @@ -20,25 +20,23 @@ module Mutant REGEXP = /\A#{SCOPE_NAME_PATTERN}#{SCOPE_SYMBOL_PATTERN}#{METHOD_NAME_PATTERN}\z/.freeze - # Return syntax + # Syntax of expression # # @return [String] # # @api private - # def syntax [scope_name, scope_symbol, method_name].join end memoize :syntax - # Return method matcher + # Matcher for expression # # @param [Env] env # # @return [Matcher] # # @api private - # def matcher(env) methods_matcher = MATCHERS.fetch(scope_symbol).new(env, scope) @@ -47,12 +45,11 @@ module Mutant private - # Return scope + # Scope object # # @return [Class, Method] # # @api private - # def scope Object.const_get(scope_name) end diff --git a/lib/mutant/expression/methods.rb b/lib/mutant/expression/methods.rb index a2642ddf..44813e4f 100644 --- a/lib/mutant/expression/methods.rb +++ b/lib/mutant/expression/methods.rb @@ -14,37 +14,34 @@ module Mutant REGEXP = /\A#{SCOPE_NAME_PATTERN}#{SCOPE_SYMBOL_PATTERN}\z/.freeze - # Return syntax + # Syntax of expression # # @return [String] # # @api private - # def syntax [scope_name, scope_symbol].join end memoize :syntax - # Return method matcher + # Matcher on expression # # @param [Env] env # # @return [Matcher::Method] # # @api private - # def matcher(env) MATCHERS.fetch(scope_symbol).new(env, scope) end - # Return length of match + # Length of match with other expression # # @param [Expression] expression # # @return [Fixnum] # # @api private - # def match_length(expression) if expression.syntax.start_with?(syntax) syntax.length @@ -55,12 +52,11 @@ module Mutant private - # Return scope + # Scope object # # @return [Class, Method] # # @api private - # def scope Object.const_get(scope_name) end diff --git a/lib/mutant/expression/namespace.rb b/lib/mutant/expression/namespace.rb index ab750b6b..bfae67d5 100644 --- a/lib/mutant/expression/namespace.rb +++ b/lib/mutant/expression/namespace.rb @@ -23,37 +23,34 @@ module Mutant ) end - # Return the syntax for this expression + # Syntax for expression # # @return [String] # # @api private - # def syntax "#{scope_name}*" end memoize :syntax - # Return matcher + # Matcher for expression # # @param [Env::Bootstrap] env # # @return [Matcher] # # @api private - # def matcher(env) Matcher::Namespace.new(env, self) end - # Return length of match + # Length of match with other expression # # @param [Expression] expression # # @return [Fixnum] # # @api private - # def match_length(expression) if @recursion_pattern =~ expression.syntax scope_name.length @@ -72,19 +69,18 @@ module Mutant REGEXP = /\A#{SCOPE_NAME_PATTERN}\z/.freeze - # Return matcher + # Matcher matcher on expression # # @param [Env::Bootstrap] env # # @return [Matcher] # # @api private - # def matcher(env) Matcher::Scope.new(env, Object.const_get(scope_name), self) end - # Return the syntax for this expression + # Syntax for expression # # @return [String] # diff --git a/lib/mutant/expression/parser.rb b/lib/mutant/expression/parser.rb index 75e8c29a..16b8b191 100644 --- a/lib/mutant/expression/parser.rb +++ b/lib/mutant/expression/parser.rb @@ -24,7 +24,6 @@ module Mutant # otherwise # # @api private - # def call(input) try_parse(input) or fail InvalidExpressionError, "Expression: #{input.inspect} is not valid" end @@ -40,7 +39,6 @@ module Mutant # otherwise # # @api private - # def try_parse(input) expressions = expressions(input) case expressions.length @@ -53,7 +51,7 @@ module Mutant private - # Return expressions for input + # Expressions parsed from input # # @param [String] input # @@ -61,7 +59,6 @@ module Mutant # if expressions can be parsed from input # # @api private - # def expressions(input) types.each_with_object([]) do |type, aggregate| expression = type.try_parse(input) diff --git a/lib/mutant/integration.rb b/lib/mutant/integration.rb index ff2e7e03..c4e11759 100644 --- a/lib/mutant/integration.rb +++ b/lib/mutant/integration.rb @@ -13,7 +13,6 @@ module Mutant # @return [Integration] # # @api private - # def self.setup(name) require "mutant/integration/#{name}" lookup(name) @@ -27,7 +26,6 @@ module Mutant # if found # # @api private - # def self.lookup(name) REGISTRY.fetch(name) end @@ -39,7 +37,6 @@ module Mutant # @return [undefined] # # @api private - # def self.register(name) REGISTRY[name] = self end @@ -50,37 +47,33 @@ module Mutant # @return [self] # # @api private - # def setup self end - # Return test result for tests + # Run a collection of tests # # @param [Enumerable] tests # # @return [Result::Test] # # @api private - # abstract_method :call - # Return all available tests by integration + # Available tests for integration # # @return [Enumerable] # # @api private - # abstract_method :all_tests private - # Return expression parser + # Expression parser # # @return [Expression::Parser] # # @api private - # def expression_parser config.expression_parser end @@ -90,24 +83,22 @@ module Mutant register('null') - # Return all tests + # Available tests for integration # # @return [Enumerable] # # @api private - # def all_tests EMPTY_ARRAY end - # Return report for test + # Run a collection of tests # # @param [Enumerable] tests # # @return [Result::Test] # # @api private - # def call(tests) Result::Test.new( tests: tests, diff --git a/lib/mutant/integration/rspec.rb b/lib/mutant/integration/rspec.rb index ffad42e4..61219889 100644 --- a/lib/mutant/integration/rspec.rb +++ b/lib/mutant/integration/rspec.rb @@ -34,7 +34,6 @@ module Mutant # @return [undefined] # # @api private - # def initialize(*) super @output = StringIO.new @@ -47,23 +46,21 @@ module Mutant # @return [self] # # @api private - # def setup @runner.setup($stderr, @output) self end memoize :setup - # Return report for test + # Run a collection of tests # # @param [Enumerable] tests # # @return [Result::Test] # - # @api private - # # rubocop:disable MethodLength # + # @api private def call(tests) examples = tests.map(&all_tests_index.method(:fetch)) filter_examples(&examples.method(:include?)) @@ -78,12 +75,11 @@ module Mutant ) end - # Return all available tests + # Available tests # # @return [Enumerable] # # @api private - # def all_tests all_tests_index.keys end @@ -91,12 +87,11 @@ module Mutant private - # Return all tests index + # Index of available tests # # @return [Hash exception @@ -35,10 +34,9 @@ module Mutant # @raise [Error] # if block terminates abnormal # - # @api private - # # rubocop:disable MethodLength # + # @api private def self.call(&block) reader, writer = IO.pipe.map(&:binmode) diff --git a/lib/mutant/loader.rb b/lib/mutant/loader.rb index 4744ffd9..eb104b07 100644 --- a/lib/mutant/loader.rb +++ b/lib/mutant/loader.rb @@ -10,12 +10,11 @@ module Mutant # # @return [undefined] # - # @api private - # # One off the very few valid uses of eval # # rubocop:disable Lint/Eval # + # @api private def call eval( source, @@ -28,12 +27,11 @@ module Mutant private - # Return source + # Source generated from AST # # @return [String] # # @api private - # def source Unparser.unparse(root) end diff --git a/lib/mutant/matcher.rb b/lib/mutant/matcher.rb index a5111bff..d555c22c 100644 --- a/lib/mutant/matcher.rb +++ b/lib/mutant/matcher.rb @@ -11,21 +11,19 @@ module Mutant # @return [undefined] # # @api private - # def self.build(*arguments) new(*arguments) end # Enumerate subjects # - # @api private - # # @return [self] # if block given # # @return [Enumerable] # otherwise # + # @api private abstract_method :each end # Matcher diff --git a/lib/mutant/matcher/chain.rb b/lib/mutant/matcher/chain.rb index ee6f5fb8..702b07b8 100644 --- a/lib/mutant/matcher/chain.rb +++ b/lib/mutant/matcher/chain.rb @@ -13,7 +13,6 @@ module Mutant # otherwise # # @api private - # def each(&block) return to_enum unless block_given? diff --git a/lib/mutant/matcher/compiler.rb b/lib/mutant/matcher/compiler.rb index 8c7e8fa5..b601c2ec 100644 --- a/lib/mutant/matcher/compiler.rb +++ b/lib/mutant/matcher/compiler.rb @@ -5,12 +5,11 @@ module Mutant class Compiler include Concord.new(:env, :config), AST::Sexp, Procto.call(:result) - # Return generated matcher + # Generated matcher # - # @return [Mutant::Matcher] + # @return [Matcher] # # @api private - # def result Filter.new( Chain.build(config.match_expressions.map(&method(:matcher))), @@ -27,7 +26,6 @@ module Mutant # @return [Boolean] # # @api private - # def call(subject) expression.prefix?(subject.expression) end @@ -36,14 +34,13 @@ module Mutant private - # Return predicate + # Predicate constraining matches # # @return [#call] # - # @api private - # # rubocop:disable MethodLength # + # @api private def predicate if subject_selector && subject_rejector Morpher::Evaluator::Predicate::Boolean::And.new([ @@ -59,7 +56,7 @@ module Mutant end end - # Return subject selector + # the subject selector predicate # # @return [#call] # if selector is present @@ -68,7 +65,6 @@ module Mutant # otherwise # # @api private - # def subject_selector selectors = config.subject_selects.map do |attribute, value| Morpher.compile(s(:eql, s(:attribute, attribute), s(:static, value))) @@ -77,7 +73,7 @@ module Mutant Morpher::Evaluator::Predicate::Boolean::Or.new(selectors) if selectors.any? end - # Return subject rejector + # Subject rejector predicate # # @return [#call] # if there is a subject rejector @@ -86,21 +82,19 @@ module Mutant # otherwise # # @api private - # def subject_rejector rejectors = config.subject_ignores.map(&SubjectPrefix.method(:new)) Morpher::Evaluator::Predicate::Boolean::Or.new(rejectors) if rejectors.any? end - # Return a matcher from expression + # Matcher for expression on env # # @param [Mutant::Expression] expression # # @return [Matcher] # # @api private - # def matcher(expression) expression.matcher(env) end diff --git a/lib/mutant/matcher/config.rb b/lib/mutant/matcher/config.rb index 93e90ca8..ae4a901b 100644 --- a/lib/mutant/matcher/config.rb +++ b/lib/mutant/matcher/config.rb @@ -10,7 +10,7 @@ module Mutant DEFAULT = new(Hash[anima.attribute_names.map { |name| [name, []] }]) - # Return configuration with added value + # Add value to configurable collection # # @param [Symbol] attribute # @param [Object] value @@ -18,7 +18,6 @@ module Mutant # @return [Config] # # @api private - # def add(attribute, value) update(attribute => public_send(attribute).dup << value) end diff --git a/lib/mutant/matcher/filter.rb b/lib/mutant/matcher/filter.rb index 885c89fb..61f59027 100644 --- a/lib/mutant/matcher/filter.rb +++ b/lib/mutant/matcher/filter.rb @@ -4,14 +4,13 @@ module Mutant class Filter < self include Concord.new(:matcher, :predicate) - # Return new matcher + # New matcher # - # @return [Matcher] matcher + # @param [Matcher] matcher # # @return [Matcher] # # @api private - # def self.build(matcher, &predicate) new(matcher, predicate) end @@ -25,7 +24,6 @@ module Mutant # otherwise # # @api private - # def each(&block) return to_enum unless block_given? matcher.select(&predicate.method(:call)).each(&block) diff --git a/lib/mutant/matcher/method.rb b/lib/mutant/matcher/method.rb index e02f1e40..d34b6f15 100644 --- a/lib/mutant/matcher/method.rb +++ b/lib/mutant/matcher/method.rb @@ -18,7 +18,6 @@ module Mutant # otherwise # # @api private - # def each return to_enum unless block_given? @@ -36,7 +35,6 @@ module Mutant # @return [Boolean] # # @api private - # def skip? location = source_location if location.nil? || BLACKLIST.match(location.first) @@ -50,67 +48,61 @@ module Mutant end end - # Return method name + # Target method name # # @return [String] # # @api private - # def method_name target_method.name end - # Return context + # Target context # # @return [Context::Scope] # # @api private - # def context Context::Scope.new(scope, source_path) end - # Return full ast + # Root source node # # @return [Parser::AST::Node] # # @api private - # def ast env.cache.parse(source_path) end - # Return path to source + # Path to source # # @return [String] # # @api private - # def source_path source_location.first end - # Return source file line + # Source file line # - # @return [Integer] + # @return [Fixnum] # # @api private - # def source_line source_location.last end - # Return source location + # Full source location # - # @return [Array] + # @return [Array{String,Fixnum}] # # @api private - # def source_location target_method.source_location end - # Return subject + # Matched subject # # @return [Subject] # if there is a matched node @@ -119,7 +111,6 @@ module Mutant # otherwise # # @api private - # def subject node = matched_node_path.last return unless node @@ -127,12 +118,11 @@ module Mutant end memoize :subject - # Return matched node path + # Matched node path # # @return [Array] # # @api private - # def matched_node_path AST.find_last_path(ast, &method(:match?)) end diff --git a/lib/mutant/matcher/method/instance.rb b/lib/mutant/matcher/method/instance.rb index 04f48788..433a8b91 100644 --- a/lib/mutant/matcher/method/instance.rb +++ b/lib/mutant/matcher/method/instance.rb @@ -14,7 +14,6 @@ module Mutant # @return [Matcher::Method::Instance] # # @api private - # def self.build(env, scope, target_method) name = target_method.name if scope.ancestors.include?(::Memoizable) && scope.memoized?(name) @@ -34,7 +33,6 @@ module Mutant # @return [Boolean] # # @api private - # def match?(node) location = node.location || return expression = location.expression || return @@ -50,12 +48,11 @@ module Mutant private - # Return source location + # Source location # - # @return [Array] + # @return [Array{String,Fixnum}] # # @api private - # def source_location scope.unmemoized_instance_method(method_name).source_location end diff --git a/lib/mutant/matcher/method/singleton.rb b/lib/mutant/matcher/method/singleton.rb index d593c9d7..b0c4dfe7 100644 --- a/lib/mutant/matcher/method/singleton.rb +++ b/lib/mutant/matcher/method/singleton.rb @@ -16,7 +16,6 @@ module Mutant # @return [Boolean] # # @api private - # def match?(node) line?(node) && name?(node) && receiver?(node) end @@ -28,7 +27,6 @@ module Mutant # @return [Boolean] # # @api private - # def line?(node) expression = node.location.expression return false unless expression @@ -42,7 +40,6 @@ module Mutant # @return [Boolean] # # @api private - # def name?(node) node.children[NAME_INDEX].equal?(method_name) end @@ -54,7 +51,6 @@ module Mutant # @return [Boolean] # # @api private - # def receiver?(node) receiver = node.children[RECEIVER_INDEX] case receiver.type @@ -75,7 +71,6 @@ module Mutant # @return [Boolean] # # @api private - # def receiver_name?(node) name = node.children[NAME_INDEX] name.to_s.eql?(context.unqualified_name) diff --git a/lib/mutant/matcher/methods.rb b/lib/mutant/matcher/methods.rb index ea84135c..6a83fea3 100644 --- a/lib/mutant/matcher/methods.rb +++ b/lib/mutant/matcher/methods.rb @@ -13,7 +13,6 @@ module Mutant # otherwise # # @api private - # def each(&block) return to_enum unless block_given? @@ -24,22 +23,20 @@ module Mutant private - # Return method matcher class + # method matcher class # # @return [Class:Matcher::Method] # # @api private - # def matcher self.class::MATCHER end - # Return methods + # Available methods scope # # @return [Enumerable] # # @api private - # def methods candidate_names.each_with_object([]) do |name, methods| method = access(name) @@ -48,12 +45,11 @@ module Mutant end memoize :methods - # Return subjects + # Subjects detected on scope # # @return [Array] # # @api private - # def subjects methods.map do |method| matcher.build(env, scope, method) @@ -61,12 +57,11 @@ module Mutant end memoize :subjects - # Return candidate names + # Candidate method names on target scope # # @return [Enumerable] # # @api private - # def candidate_names ( candidate_scope.public_instance_methods(false) + @@ -75,12 +70,11 @@ module Mutant ).sort end - # Return candidate scope + # Candidate scope # # @return [Class, Module] # # @api private - # abstract_method :candidate_scope # Matcher for singleton methods @@ -89,24 +83,22 @@ module Mutant private - # Return method for name + # Method object on scope # # @param [Symbol] method_name # # @return [Method] # # @api private - # def access(method_name) scope.method(method_name) end - # Return candidate scope + # Candidate scope # # @return [Class] # # @api private - # def candidate_scope scope.singleton_class end @@ -120,24 +112,22 @@ module Mutant private - # Return method for name + # Method object on scope # # @param [Symbol] method_name # # @return [UnboundMethod] # # @api private - # def access(method_name) scope.instance_method(method_name) end - # Return candidate scope + # Candidate scope # # @return [Class, Module] # # @api private - # def candidate_scope scope end diff --git a/lib/mutant/matcher/namespace.rb b/lib/mutant/matcher/namespace.rb index 825d7b2c..ca10019e 100644 --- a/lib/mutant/matcher/namespace.rb +++ b/lib/mutant/matcher/namespace.rb @@ -14,7 +14,6 @@ module Mutant # otherwise # # @api private - # def each(&block) return to_enum unless block_given? @@ -34,7 +33,6 @@ module Mutant # @return [Boolean] # # @api private - # def match?(scope) expression.prefix?(scope.expression) end diff --git a/lib/mutant/matcher/null.rb b/lib/mutant/matcher/null.rb index a4cc3fd1..fe7a9864 100644 --- a/lib/mutant/matcher/null.rb +++ b/lib/mutant/matcher/null.rb @@ -13,7 +13,6 @@ module Mutant # otherwise # # @api private - # def each return to_enum unless block_given? self diff --git a/lib/mutant/matcher/scope.rb b/lib/mutant/matcher/scope.rb index 49a8752c..9d9414d9 100644 --- a/lib/mutant/matcher/scope.rb +++ b/lib/mutant/matcher/scope.rb @@ -18,7 +18,6 @@ module Mutant # otherwise # # @api private - # def each(&block) return to_enum unless block_given? diff --git a/lib/mutant/meta.rb b/lib/mutant/meta.rb index dd882487..eeda9a25 100644 --- a/lib/mutant/meta.rb +++ b/lib/mutant/meta.rb @@ -14,7 +14,6 @@ module Mutant # @return [undefined] # # @api private - # def self.add(&block) file = caller.first.split(':in', 2).first ALL << DSL.run(file, block) diff --git a/lib/mutant/meta/example.rb b/lib/mutant/meta/example.rb index 8eedcda1..b0b399f0 100644 --- a/lib/mutant/meta/example.rb +++ b/lib/mutant/meta/example.rb @@ -3,33 +3,30 @@ module Mutant class Example include Adamantium, Concord::Public.new(:file, :node, :mutations) - # Return a verification instance + # Verification instance for example # # @return [Verification] # # @api private - # def verification Verification.new(self, generated) end - # Return source + # Normalized source # # @return [String] # # @api private - # def source Unparser.unparse(node) end memoize :source - # Return generated mutations + # Generated mutations on example source # # @return [Enumerable] # # @api private - # def generated Mutator.each(node).map do |node| Mutation::Evil.new(self, node) @@ -46,17 +43,15 @@ module Mutant # @return [Boolean] # # @api private - # def success? unparser.success? && missing.empty? && unexpected.empty? && no_diffs.empty? end - # Return error report + # Error report # # @return [String] # # @api private - # def error_report unless unparser.success? return unparser.report @@ -66,34 +61,31 @@ module Mutant private - # Return unexpected mutations + # Unexpected mutations # # @return [Array] # # @api private - # def unexpected mutations.map(&:node) - example.mutations end memoize :unexpected - # Return mutations with no diff to original + # Mutations with no diff to original # # @return [Enumerable] # # @api private - # def no_diffs mutations.select { |mutation| mutation.source.eql?(example.source) } end memoize :no_diffs - # Return mutation report + # Mutation report # # @return [String] # # @api private - # def mutation_report original_node = example.node [ @@ -107,12 +99,11 @@ module Mutant ].join("\n======\n") end - # Return missing report + # Missing mutation report # # @return [Array, nil] # # @api private - # def missing_report [ 'Missing mutations:', @@ -120,12 +111,11 @@ module Mutant ] if missing.any? end - # Return no diff report + # No diff mutation report # # @return [Array, nil] # # @api private - # def no_diff_report [ 'No source diffs to original:', @@ -135,12 +125,11 @@ module Mutant ] if no_diffs.any? end - # Return unexpected report + # Unexpected mutation report # # @return [Array, nil] # # @api private - # def unexpected_report [ 'Unexpected mutations:', @@ -153,7 +142,6 @@ module Mutant # @return [String] # # @api private - # def format_mutation(node) [ node.inspect, @@ -161,23 +149,21 @@ module Mutant ].join("\n") end - # Return missing mutations + # Missing mutations # # @return [Array] # # @api private - # def missing example.mutations - mutations.map(&:node) end memoize :missing - # Return unparser verifier + # Unparser verifier # # @return [Unparser::CLI::Source] # # @api private - # def unparser Unparser::CLI::Source::Node.new(Unparser::Preprocessor.run(example.node)) end diff --git a/lib/mutant/meta/example/dsl.rb b/lib/mutant/meta/example/dsl.rb index ca8cc339..be4ab48b 100644 --- a/lib/mutant/meta/example/dsl.rb +++ b/lib/mutant/meta/example/dsl.rb @@ -11,7 +11,6 @@ module Mutant # @return [Example] # # @api private - # def self.run(file, block) instance = new(file) instance.instance_eval(&block) @@ -23,14 +22,13 @@ module Mutant # @return [undefined] # # @api private - # def initialize(file) @file = file @source = nil @expected = [] end - # Return example + # Example captured by DSL # # @return [Example] # @@ -38,7 +36,6 @@ module Mutant # in case example cannot be build # # @api private - # def example fail 'source not defined' unless @source Example.new(@file, @source, @expected) @@ -53,7 +50,6 @@ module Mutant # @return [self] # # @api private - # def source(input) fail 'source already defined' if @source @source = node(input) @@ -68,7 +64,6 @@ module Mutant # @return [self] # # @api private - # def mutation(input) node = node(input) if @expected.include?(node) @@ -84,7 +79,6 @@ module Mutant # @return [undefined] # # @api private - # def singleton_mutations mutation('nil') mutation('self') @@ -100,7 +94,6 @@ module Mutant # in case input cannot be coerced # # @api private - # def node(input) case input when String diff --git a/lib/mutant/mutation.rb b/lib/mutant/mutation.rb index e3eeb0b9..80d372e2 100644 --- a/lib/mutant/mutation.rb +++ b/lib/mutant/mutation.rb @@ -7,45 +7,41 @@ module Mutant CODE_DELIMITER = "\0".freeze CODE_RANGE = (0..4).freeze - # Return identification + # Identification string # # @return [String] # # @api private - # def identification "#{self.class::SYMBOL}:#{subject.identification}:#{code}" end memoize :identification - # Return mutation code + # Mutation code # # @return [String] # # @api private - # def code sha1[CODE_RANGE] end memoize :code - # Return source + # Normalized mutation source # # @return [String] # # @api private - # def source Unparser.unparse(node) end memoize :source - # Return original source + # Normalized original source # # @return [String] # # @api private - # def original_source subject.source end @@ -57,7 +53,6 @@ module Mutant # @return [Boolean] # # @api private - # def self.success?(test_result) self::TEST_PASS_SUCCESS.equal?(test_result.passed) end @@ -71,7 +66,6 @@ module Mutant # @return [self] # # @api private - # def insert subject.public? subject.prepare @@ -81,23 +75,21 @@ module Mutant private - # Return sha1 sum of source and subject identification + # SHA1 sum of source and subject identification # # @return [String] # # @api private - # def sha1 Digest::SHA1.hexdigest(subject.identification + CODE_DELIMITER + source) end memoize :sha1 - # Return mutated root node + # Mutated root node # # @return [Parser::AST::Node] # # @api private - # def root subject.context.root(node) end diff --git a/lib/mutant/mutator.rb b/lib/mutant/mutator.rb index a2608315..90cb9604 100644 --- a/lib/mutant/mutator.rb +++ b/lib/mutant/mutator.rb @@ -13,7 +13,6 @@ module Mutant # @return [self] # # @api private - # def self.each(input, parent = nil, &block) return to_enum(__method__, input, parent) unless block_given? REGISTRY.lookup(input).new(input, parent, block) @@ -26,7 +25,6 @@ module Mutant # @return [undefined] # # @api private - # def self.handle(*types) types.each do |type| REGISTRY.register(type, self) @@ -34,20 +32,18 @@ module Mutant end private_class_method :handle - # Return input + # Mutation input # # @return [Object] # # @api private - # attr_reader :input - # Return input + # Parent context of input # # @return [Object] # # @api private - # attr_reader :parent private @@ -61,7 +57,6 @@ module Mutant # @return [undefined] # # @api private - # def initialize(input, parent, block) @input, @parent, @block = input, parent, block @seen = Set.new @@ -76,7 +71,6 @@ module Mutant # @return [Boolean] # # @api private - # def new?(object) !@seen.include?(object) end @@ -88,7 +82,6 @@ module Mutant # @return [undefined] # # @api private - # def guard(object) @seen << object end @@ -98,7 +91,6 @@ module Mutant # @return [undefined] # # @api private - # abstract_method :dispatch # Emit generated mutation if object is not equivalent to input @@ -108,7 +100,6 @@ module Mutant # @return [undefined] # # @api private - # def emit(object) return unless new?(object) @@ -124,7 +115,6 @@ module Mutant # @return [self] # # @api private - # def emit!(node) @block.call(node) self @@ -135,7 +125,6 @@ module Mutant # @return [undefined] # # @api private - # def run(mutator) mutator.new(input, self, method(:emit)) end @@ -145,7 +134,6 @@ module Mutant # @return [Object] # # @api private - # def dup_input input.dup end diff --git a/lib/mutant/mutator/node.rb b/lib/mutant/mutator/node.rb index 6f6cc543..3bcd42e1 100644 --- a/lib/mutant/mutator/node.rb +++ b/lib/mutant/mutator/node.rb @@ -19,7 +19,6 @@ module Mutant # @return [undefined] # # @api private - # def self.define_named_child(name, index) super @@ -35,28 +34,25 @@ module Mutant private - # Return mutated node + # Node to mutate # # @return [Parser::AST::Node] # # @api private - # alias_method :node, :input - # Return duplicated node + # Duplicate of original # # @return [Parser::AST::Node] # # @api private - # alias_method :dup_node, :dup_input - # Return children + # Original nodes children # # @return [Array] # # @api private - # def children node.children end @@ -68,7 +64,6 @@ module Mutant # @return [undefined] # # @api private - # def mutate_child(index, mutator = Mutator, &block) block ||= TAUTOLOGY child = children.at(index) @@ -85,7 +80,6 @@ module Mutant # @return [undefined] # # @api private - # def delete_child(index) dup_children = children.dup dup_children.delete_at(index) @@ -100,7 +94,6 @@ module Mutant # @return [undefined] # # @api private - # def emit_child_update(index, node) new_children = children.dup new_children[index] = node @@ -114,7 +107,6 @@ module Mutant # @return [undefined] # # @api private - # def emit_type(*children) emit(Parser::AST::Node.new(node.type, children)) end @@ -124,7 +116,6 @@ module Mutant # @return [undefined] # # @api private - # def emit_singletons emit_nil emit_self @@ -135,7 +126,6 @@ module Mutant # @return [undefined] # # @api private - # def emit_self emit(N_SELF) end @@ -145,7 +135,6 @@ module Mutant # @return [undefined] # # @api private - # def emit_nil emit(N_NIL) unless asgn_left? end @@ -157,14 +146,13 @@ module Mutant # @return [undefined] # # @api private - # def emit_values(values) values.each do |value| emit_type(value) end end - # Return parent node + # Parent node # # @return [Parser::AST::Node] node # if parent with node is present @@ -173,12 +161,11 @@ module Mutant # otherwise # # @api private - # def parent_node parent.node if parent end - # Return parent type + # Parent type # # @return [Symbol] type # if parent with type is present @@ -187,7 +174,6 @@ module Mutant # otherwise # # @api private - # def parent_type parent_node.type if parent_node end @@ -197,19 +183,17 @@ module Mutant # @return [Boolean] # # @api private - # def asgn_left? AST::Types::OP_ASSIGN.include?(parent_type) && parent.node.children.first.equal?(node) end - # Return children indices + # Children indices # # @param [Range] range # # @return [Enumerable] # # @api private - # def children_indices(range) range_end = range.end last_index = range_end >= 0 ? range_end : children.length + range_end diff --git a/lib/mutant/mutator/node/and_asgn.rb b/lib/mutant/mutator/node/and_asgn.rb index ac827364..9f6f3877 100644 --- a/lib/mutant/mutator/node/and_asgn.rb +++ b/lib/mutant/mutator/node/and_asgn.rb @@ -16,7 +16,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_singletons emit_left_mutations do |node| diff --git a/lib/mutant/mutator/node/argument.rb b/lib/mutant/mutator/node/argument.rb index 66c7ae6c..da4cbd9f 100644 --- a/lib/mutant/mutator/node/argument.rb +++ b/lib/mutant/mutator/node/argument.rb @@ -17,7 +17,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_name_mutation end @@ -27,7 +26,6 @@ module Mutant # @return [undefined] # # @api private - # def emit_name_mutation return if skip? Mutator::Util::Symbol.each(name, self) do |name| @@ -40,7 +38,6 @@ module Mutant # @return [Boolean] # # @api private - # def skip? name.to_s.start_with?(UNDERSCORE) end @@ -59,7 +56,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_name_mutation emit_required_mutation @@ -71,7 +67,6 @@ module Mutant # @return [undefined] # # @api private - # def emit_required_mutation emit(s(:arg, name)) end diff --git a/lib/mutant/mutator/node/arguments.rb b/lib/mutant/mutator/node/arguments.rb index bef9f322..7f9af537 100644 --- a/lib/mutant/mutator/node/arguments.rb +++ b/lib/mutant/mutator/node/arguments.rb @@ -13,7 +13,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_argument_presence emit_argument_mutations @@ -25,7 +24,6 @@ module Mutant # @return [undefined] # # @api private - # def emit_argument_presence emit_type Mutator::Util::Array::Presence.each(children, self) do |children| @@ -38,7 +36,6 @@ module Mutant # @return [undefined] # # @api private - # def emit_argument_mutations children.each_with_index do |child, index| Mutator.each(child) do |mutant| @@ -55,7 +52,6 @@ module Mutant # @return [Boolean] # # @api private - # def invalid_argument_replacement?(mutant, index) original = children.fetch(index) @@ -69,7 +65,6 @@ module Mutant # @return [undefined] # # @api private - # def emit_mlhs_expansion mlhs_childs_with_index.each do |child, index| dup_children = children.dup @@ -79,12 +74,11 @@ module Mutant end end - # Return mlhs childs + # Multiple left hand side childs # # @return [Enumerable] # # @api private - # def mlhs_childs_with_index children.each_with_index.select do |child, _index| n_mlhs?(child) diff --git a/lib/mutant/mutator/node/begin.rb b/lib/mutant/mutator/node/begin.rb index 40f0da71..9ca7e2c5 100644 --- a/lib/mutant/mutator/node/begin.rb +++ b/lib/mutant/mutator/node/begin.rb @@ -14,7 +14,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch Util::Array.each(children, self, &method(:emit_child_subset)) children.each_with_index do |child, index| @@ -30,7 +29,6 @@ module Mutant # @return [undefined] # # @api private - # def emit_child_subset(children) return if children.length < 2 emit_type(*children) diff --git a/lib/mutant/mutator/node/binary.rb b/lib/mutant/mutator/node/binary.rb index 6b20228d..98a64844 100644 --- a/lib/mutant/mutator/node/binary.rb +++ b/lib/mutant/mutator/node/binary.rb @@ -20,7 +20,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_singletons emit(left) @@ -36,7 +35,6 @@ module Mutant # @return [undefined] # # @api private - # def mutate_operator emit(s(INVERSE.fetch(node.type), left, right)) end @@ -46,7 +44,6 @@ module Mutant # @return [undefined] # # @api private - # def mutate_operands emit(s(node.type, n_not(left), right)) emit(n_not(node)) diff --git a/lib/mutant/mutator/node/block.rb b/lib/mutant/mutator/node/block.rb index 40ea18b9..286489d0 100644 --- a/lib/mutant/mutator/node/block.rb +++ b/lib/mutant/mutator/node/block.rb @@ -15,7 +15,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_singletons emit(send) @@ -30,7 +29,6 @@ module Mutant # @return [undefined] # # @api private - # def mutate_body emit_body(nil) emit_body(N_RAISE) diff --git a/lib/mutant/mutator/node/break.rb b/lib/mutant/mutator/node/break.rb index 69255b86..b7254fbe 100644 --- a/lib/mutant/mutator/node/break.rb +++ b/lib/mutant/mutator/node/break.rb @@ -14,7 +14,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch super emit_singletons diff --git a/lib/mutant/mutator/node/case.rb b/lib/mutant/mutator/node/case.rb index 80996e91..4b535326 100644 --- a/lib/mutant/mutator/node/case.rb +++ b/lib/mutant/mutator/node/case.rb @@ -16,7 +16,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_singletons emit_condition_mutations if condition @@ -29,7 +28,6 @@ module Mutant # @return [undefined] # # @api private - # def emit_when_mutations indices = children.each_index.drop(1).take(children.length - 2) one = indices.one? @@ -44,7 +42,6 @@ module Mutant # @return [undefined] # # @api private - # def emit_else_mutations else_branch = children.last else_index = children.length - 1 diff --git a/lib/mutant/mutator/node/conditional_loop.rb b/lib/mutant/mutator/node/conditional_loop.rb index 9c717af4..7c6cd093 100644 --- a/lib/mutant/mutator/node/conditional_loop.rb +++ b/lib/mutant/mutator/node/conditional_loop.rb @@ -16,7 +16,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_singletons emit_condition_mutations diff --git a/lib/mutant/mutator/node/const.rb b/lib/mutant/mutator/node/const.rb index 476483b9..23194fd1 100644 --- a/lib/mutant/mutator/node/const.rb +++ b/lib/mutant/mutator/node/const.rb @@ -14,7 +14,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_singletons unless parent_node && n_const?(parent_node) emit_type(nil, *children.drop(1)) diff --git a/lib/mutant/mutator/node/define.rb b/lib/mutant/mutator/node/define.rb index 26985a16..e1ba2dae 100644 --- a/lib/mutant/mutator/node/define.rb +++ b/lib/mutant/mutator/node/define.rb @@ -11,7 +11,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_arguments_mutations emit_body(N_RAISE) diff --git a/lib/mutant/mutator/node/defined.rb b/lib/mutant/mutator/node/defined.rb index 0bdc2c42..463e1373 100644 --- a/lib/mutant/mutator/node/defined.rb +++ b/lib/mutant/mutator/node/defined.rb @@ -15,7 +15,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_expression_mutations do |node| !n_self?(node) diff --git a/lib/mutant/mutator/node/dstr.rb b/lib/mutant/mutator/node/dstr.rb index f31482e6..e97b2014 100644 --- a/lib/mutant/mutator/node/dstr.rb +++ b/lib/mutant/mutator/node/dstr.rb @@ -14,7 +14,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch super emit_singletons diff --git a/lib/mutant/mutator/node/dsym.rb b/lib/mutant/mutator/node/dsym.rb index d8bd54cd..85d80cc4 100644 --- a/lib/mutant/mutator/node/dsym.rb +++ b/lib/mutant/mutator/node/dsym.rb @@ -14,7 +14,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch super emit_singletons diff --git a/lib/mutant/mutator/node/generic.rb b/lib/mutant/mutator/node/generic.rb index 5f8de327..1be2c910 100644 --- a/lib/mutant/mutator/node/generic.rb +++ b/lib/mutant/mutator/node/generic.rb @@ -23,7 +23,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch children.each_with_index do |child, index| mutate_child(index) if child.instance_of?(Parser::AST::Node) diff --git a/lib/mutant/mutator/node/if.rb b/lib/mutant/mutator/node/if.rb index 7130e877..a7528c8b 100644 --- a/lib/mutant/mutator/node/if.rb +++ b/lib/mutant/mutator/node/if.rb @@ -15,7 +15,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_singletons mutate_condition @@ -28,7 +27,6 @@ module Mutant # @return [undefined] # # @api private - # def mutate_condition emit_condition_mutations do |node| !n_self?(node) @@ -43,7 +41,6 @@ module Mutant # @return [undefined] # # @api private - # def mutate_if_branch emit_type(condition, else_branch, nil) if else_branch return unless if_branch @@ -57,7 +54,6 @@ module Mutant # @return [undefined] # # @api private - # def mutate_else_branch return unless else_branch emit(else_branch) diff --git a/lib/mutant/mutator/node/kwbegin.rb b/lib/mutant/mutator/node/kwbegin.rb index 87cdbde0..78ea3c55 100644 --- a/lib/mutant/mutator/node/kwbegin.rb +++ b/lib/mutant/mutator/node/kwbegin.rb @@ -14,7 +14,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch super emit_singletons diff --git a/lib/mutant/mutator/node/literal/array.rb b/lib/mutant/mutator/node/literal/array.rb index 0ccc7da8..4bb63869 100644 --- a/lib/mutant/mutator/node/literal/array.rb +++ b/lib/mutant/mutator/node/literal/array.rb @@ -14,7 +14,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_singletons emit_type @@ -28,7 +27,6 @@ module Mutant # @return [undefined] # # @api private - # def mutate_body children.each_index do |index| dup_children = children.dup diff --git a/lib/mutant/mutator/node/literal/boolean.rb b/lib/mutant/mutator/node/literal/boolean.rb index 4400f3d4..2dad21ea 100644 --- a/lib/mutant/mutator/node/literal/boolean.rb +++ b/lib/mutant/mutator/node/literal/boolean.rb @@ -19,7 +19,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_nil emit(s(MAP.fetch(node.type))) diff --git a/lib/mutant/mutator/node/literal/fixnum.rb b/lib/mutant/mutator/node/literal/fixnum.rb index 387bc1b5..aec9de5d 100644 --- a/lib/mutant/mutator/node/literal/fixnum.rb +++ b/lib/mutant/mutator/node/literal/fixnum.rb @@ -14,28 +14,25 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_singletons emit_values(values) end - # Return values to mutate against + # Values to mutate to # # @return [Array] # # @api private - # def values [0, 1, -value, value + 1, value - 1] end - # Return value + # Literal original value # # @return [Object] # # @api private - # def value children.first end diff --git a/lib/mutant/mutator/node/literal/float.rb b/lib/mutant/mutator/node/literal/float.rb index 1ebc34ac..361d7c99 100644 --- a/lib/mutant/mutator/node/literal/float.rb +++ b/lib/mutant/mutator/node/literal/float.rb @@ -14,7 +14,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_singletons emit_values(values) @@ -32,17 +31,15 @@ module Mutant # @return [undefined] # # @api private - # def emit_special_cases SPECIAL.each(&method(:emit)) end - # Return values to test against + # Values to mutate to # # @return [Array] # # @api private - # def values original = children.first # Work around a bug in RBX/MRI or JRUBY: diff --git a/lib/mutant/mutator/node/literal/hash.rb b/lib/mutant/mutator/node/literal/hash.rb index 51c71cfa..6e397a73 100644 --- a/lib/mutant/mutator/node/literal/hash.rb +++ b/lib/mutant/mutator/node/literal/hash.rb @@ -14,7 +14,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_singletons emit_type @@ -26,7 +25,6 @@ module Mutant # @return [undefined] # # @api private - # def mutate_body children.each_index do |index| mutate_child(index) @@ -50,7 +48,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_key_mutations emit_value_mutations diff --git a/lib/mutant/mutator/node/literal/nil.rb b/lib/mutant/mutator/node/literal/nil.rb index a47ddb46..78fa6c03 100644 --- a/lib/mutant/mutator/node/literal/nil.rb +++ b/lib/mutant/mutator/node/literal/nil.rb @@ -14,7 +14,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch end diff --git a/lib/mutant/mutator/node/literal/range.rb b/lib/mutant/mutator/node/literal/range.rb index 245d3a60..039362b2 100644 --- a/lib/mutant/mutator/node/literal/range.rb +++ b/lib/mutant/mutator/node/literal/range.rb @@ -22,7 +22,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_singletons emit_inverse @@ -30,12 +29,11 @@ module Mutant emit_upper_bound_mutations end - # Return inverse node + # Inverse node # # @return [Parser::AST::Node] # # @api private - # def emit_inverse emit(s(MAP.fetch(node.type), *children)) end @@ -45,7 +43,6 @@ module Mutant # @return [undefined] # # @api private - # def emit_upper_bound_mutations emit__end_mutations emit_type(N_NAN, _end) @@ -56,7 +53,6 @@ module Mutant # @return [undefined] # # @api private - # def emit_lower_bound_mutations emit_start_mutations emit_type(start, N_INFINITY) diff --git a/lib/mutant/mutator/node/literal/regex.rb b/lib/mutant/mutator/node/literal/regex.rb index 09073c69..42c4a0e0 100644 --- a/lib/mutant/mutator/node/literal/regex.rb +++ b/lib/mutant/mutator/node/literal/regex.rb @@ -12,12 +12,11 @@ module Mutant private - # Return options + # Original regexp options # # @return [Parser::AST::Node] # # @api private - # def options children.last end @@ -27,7 +26,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_singletons unless parent_node && n_match_current_line?(parent_node) children.each_with_index do |child, index| diff --git a/lib/mutant/mutator/node/literal/string.rb b/lib/mutant/mutator/node/literal/string.rb index d710fe41..acb5b854 100644 --- a/lib/mutant/mutator/node/literal/string.rb +++ b/lib/mutant/mutator/node/literal/string.rb @@ -14,7 +14,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_singletons end diff --git a/lib/mutant/mutator/node/literal/symbol.rb b/lib/mutant/mutator/node/literal/symbol.rb index e139b562..a925443e 100644 --- a/lib/mutant/mutator/node/literal/symbol.rb +++ b/lib/mutant/mutator/node/literal/symbol.rb @@ -18,7 +18,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_singletons Mutator::Util::Symbol.each(value, self) do |value| diff --git a/lib/mutant/mutator/node/masgn.rb b/lib/mutant/mutator/node/masgn.rb index c74f14fe..72d94c22 100644 --- a/lib/mutant/mutator/node/masgn.rb +++ b/lib/mutant/mutator/node/masgn.rb @@ -16,7 +16,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_singletons end diff --git a/lib/mutant/mutator/node/match_current_line.rb b/lib/mutant/mutator/node/match_current_line.rb index 6e4a7a8f..f9e9ee4c 100644 --- a/lib/mutant/mutator/node/match_current_line.rb +++ b/lib/mutant/mutator/node/match_current_line.rb @@ -15,7 +15,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_singletons emit_regexp_mutations diff --git a/lib/mutant/mutator/node/mlhs.rb b/lib/mutant/mutator/node/mlhs.rb index 08339a44..204cd38c 100644 --- a/lib/mutant/mutator/node/mlhs.rb +++ b/lib/mutant/mutator/node/mlhs.rb @@ -13,7 +13,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch children.each_index do |index| mutate_child(index) diff --git a/lib/mutant/mutator/node/named_value/access.rb b/lib/mutant/mutator/node/named_value/access.rb index 74af1f75..c4f96b99 100644 --- a/lib/mutant/mutator/node/named_value/access.rb +++ b/lib/mutant/mutator/node/named_value/access.rb @@ -15,7 +15,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_singletons end diff --git a/lib/mutant/mutator/node/named_value/constant_assignment.rb b/lib/mutant/mutator/node/named_value/constant_assignment.rb index 00a63ea7..e4ab57ff 100644 --- a/lib/mutant/mutator/node/named_value/constant_assignment.rb +++ b/lib/mutant/mutator/node/named_value/constant_assignment.rb @@ -17,7 +17,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch mutate_name emit_value_mutations if value @@ -28,7 +27,6 @@ module Mutant # @return [undefined] # # @api private - # def mutate_name Mutator::Util::Symbol.each(name, self) do |name| emit_name(name.upcase) diff --git a/lib/mutant/mutator/node/named_value/variable_assignment.rb b/lib/mutant/mutator/node/named_value/variable_assignment.rb index 406bad04..b3d00426 100644 --- a/lib/mutant/mutator/node/named_value/variable_assignment.rb +++ b/lib/mutant/mutator/node/named_value/variable_assignment.rb @@ -28,7 +28,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_singletons mutate_name @@ -40,7 +39,6 @@ module Mutant # @return [undefined] # # @api private - # def mutate_name prefix, regexp = MAP.fetch(node.type) stripped = name.to_s.sub(regexp, EMPTY_STRING) diff --git a/lib/mutant/mutator/node/next.rb b/lib/mutant/mutator/node/next.rb index bbc25561..2d918e77 100644 --- a/lib/mutant/mutator/node/next.rb +++ b/lib/mutant/mutator/node/next.rb @@ -14,7 +14,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch super emit_singletons diff --git a/lib/mutant/mutator/node/noop.rb b/lib/mutant/mutator/node/noop.rb index 5f6178f7..3bf15952 100644 --- a/lib/mutant/mutator/node/noop.rb +++ b/lib/mutant/mutator/node/noop.rb @@ -14,7 +14,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch # noop end diff --git a/lib/mutant/mutator/node/nthref.rb b/lib/mutant/mutator/node/nthref.rb index 5330b010..a4780c9f 100644 --- a/lib/mutant/mutator/node/nthref.rb +++ b/lib/mutant/mutator/node/nthref.rb @@ -15,7 +15,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch unless number.equal?(1) emit_number(number - 1) diff --git a/lib/mutant/mutator/node/op_asgn.rb b/lib/mutant/mutator/node/op_asgn.rb index 3245099d..c7a7f379 100644 --- a/lib/mutant/mutator/node/op_asgn.rb +++ b/lib/mutant/mutator/node/op_asgn.rb @@ -16,7 +16,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_singletons emit_left_mutations do |node| diff --git a/lib/mutant/mutator/node/or_asgn.rb b/lib/mutant/mutator/node/or_asgn.rb index ee1350f7..64af5e51 100644 --- a/lib/mutant/mutator/node/or_asgn.rb +++ b/lib/mutant/mutator/node/or_asgn.rb @@ -16,7 +16,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_singletons emit_right_mutations diff --git a/lib/mutant/mutator/node/resbody.rb b/lib/mutant/mutator/node/resbody.rb index 811761d0..d40263a0 100644 --- a/lib/mutant/mutator/node/resbody.rb +++ b/lib/mutant/mutator/node/resbody.rb @@ -15,7 +15,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_assignment(nil) emit_body_mutations if body @@ -27,7 +26,6 @@ module Mutant # @return [undefined] # # @api private - # def mutate_captures return unless captures Util::Array::Element.each(captures.children, self) do |matchers| diff --git a/lib/mutant/mutator/node/rescue.rb b/lib/mutant/mutator/node/rescue.rb index fccc441a..e551bc27 100644 --- a/lib/mutant/mutator/node/rescue.rb +++ b/lib/mutant/mutator/node/rescue.rb @@ -17,7 +17,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch mutate_body mutate_rescue_bodies @@ -31,7 +30,6 @@ module Mutant # @return [undefined] # # @api private - # def mutate_rescue_bodies children_indices(RESCUE_INDICES).each do |index| rescue_body = children.at(index) @@ -49,7 +47,6 @@ module Mutant # @return [undefined] # # @api private - # def emit_concat(child) if body emit(s(:begin, body, child)) @@ -63,7 +60,6 @@ module Mutant # @return [undefined] # # @api private - # def mutate_body return unless body emit_body_mutations @@ -75,7 +71,6 @@ module Mutant # @return [undefined] # # @api private - # def mutate_else_body return unless else_body emit_else_body_mutations diff --git a/lib/mutant/mutator/node/return.rb b/lib/mutant/mutator/node/return.rb index d57ceeba..3d1bb2c5 100644 --- a/lib/mutant/mutator/node/return.rb +++ b/lib/mutant/mutator/node/return.rb @@ -15,7 +15,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_singletons return unless value diff --git a/lib/mutant/mutator/node/send.rb b/lib/mutant/mutator/node/send.rb index 011ff635..f923a49e 100644 --- a/lib/mutant/mutator/node/send.rb +++ b/lib/mutant/mutator/node/send.rb @@ -40,7 +40,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_singletons if meta.index_assignment? @@ -55,7 +54,6 @@ module Mutant # @return [undefined] # # @api private - # def non_index_dispatch if meta.binary_method_operator? run(Binary) @@ -66,20 +64,21 @@ module Mutant end end - # Return AST metadata for node + # AST metadata for node # # @return [AST::Meta::Send] + # + # @api private def meta AST::Meta::Send.new(node) end memoize :meta - # Return arguments + # Arguments being send # # @return [Enumerable] # # @api private - # alias_method :arguments, :remaining_children # Perform normal, non special case dispatch @@ -87,7 +86,6 @@ module Mutant # @return [undefined] # # @api private - # def normal_dispatch emit_naked_receiver emit_selector_replacement @@ -101,7 +99,6 @@ module Mutant # @return [undefined] # # @api private - # def emit_selector_replacement SELECTOR_REPLACEMENTS.fetch(selector, EMPTY_ARRAY).each do |replacement| emit_selector(replacement) @@ -113,7 +110,6 @@ module Mutant # @return [undefined] # # @api private - # def emit_naked_receiver emit(receiver) if receiver && !NOT_ASSIGNABLE.include?(receiver.type) end @@ -123,7 +119,6 @@ module Mutant # @return [undefined] # # @api private - # def mutate_arguments emit_type(receiver, selector) remaining_children_with_index.each do |_node, index| @@ -137,7 +132,6 @@ module Mutant # @return [undefined] # # @api private - # def emit_argument_propagation node = arguments.first emit(node) if arguments.one? && !NOT_STANDALONE.include?(node.type) @@ -148,7 +142,6 @@ module Mutant # @return [undefined] # # @api private - # def mutate_receiver return unless receiver emit_implicit_self @@ -162,7 +155,6 @@ module Mutant # @return [undefined] # # @api private - # def emit_implicit_self emit_receiver(nil) if n_self?(receiver) && !( KEYWORDS.include?(selector) || diff --git a/lib/mutant/mutator/node/send/attribute_assignment.rb b/lib/mutant/mutator/node/send/attribute_assignment.rb index bd1577f5..fa025c44 100644 --- a/lib/mutant/mutator/node/send/attribute_assignment.rb +++ b/lib/mutant/mutator/node/send/attribute_assignment.rb @@ -12,7 +12,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch normal_dispatch emit_attribute_read @@ -23,7 +22,6 @@ module Mutant # @return [undefined] # # @api private - # def mutate_arguments remaining_children_indices.each do |index| mutate_child(index) @@ -35,7 +33,6 @@ module Mutant # @return [undefined] # # @api private - # def emit_attribute_read emit_type(receiver, selector.to_s[0..-2].to_sym) end diff --git a/lib/mutant/mutator/node/send/binary.rb b/lib/mutant/mutator/node/send/binary.rb index 5cc52923..5778145a 100644 --- a/lib/mutant/mutator/node/send/binary.rb +++ b/lib/mutant/mutator/node/send/binary.rb @@ -15,7 +15,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit(left) emit_left_mutations diff --git a/lib/mutant/mutator/node/send/index.rb b/lib/mutant/mutator/node/send/index.rb index 6424b032..9454e8cc 100644 --- a/lib/mutant/mutator/node/send/index.rb +++ b/lib/mutant/mutator/node/send/index.rb @@ -19,7 +19,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_naked_receiver emit_value_mutations @@ -33,7 +32,6 @@ module Mutant # @return [undefined] # # @api private - # def mutate_indices children_indices(INDEX_RANGE).each do |index| delete_child(index) @@ -46,7 +44,6 @@ module Mutant # @return [undefined] # # @api private - # def emit_index_read emit_type(receiver, :[], *children[INDEX_RANGE]) end diff --git a/lib/mutant/mutator/node/splat.rb b/lib/mutant/mutator/node/splat.rb index cb7511bf..3efb005f 100644 --- a/lib/mutant/mutator/node/splat.rb +++ b/lib/mutant/mutator/node/splat.rb @@ -15,7 +15,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_singletons emit_expression_mutations diff --git a/lib/mutant/mutator/node/super.rb b/lib/mutant/mutator/node/super.rb index 57b14915..d03e0967 100644 --- a/lib/mutant/mutator/node/super.rb +++ b/lib/mutant/mutator/node/super.rb @@ -14,7 +14,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_singletons emit(N_ZSUPER) diff --git a/lib/mutant/mutator/node/when.rb b/lib/mutant/mutator/node/when.rb index bec34ea8..4441413d 100644 --- a/lib/mutant/mutator/node/when.rb +++ b/lib/mutant/mutator/node/when.rb @@ -14,7 +14,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch if body mutate_body @@ -29,7 +28,6 @@ module Mutant # @return [undefined] # # @api private - # def mutate_conditions conditions = children.length - 1 children[0..-2].each_index do |index| @@ -43,12 +41,11 @@ module Mutant # @return [undefined] # # @api private - # def mutate_body mutate_child(body_index) end - # Return body node + # Body node # # @return [Parser::AST::Node] # if body is present @@ -57,17 +54,15 @@ module Mutant # otherwise # # @api private - # def body children[body_index] end - # Return body index + # Index of body node # # @return [Fixnum] # # @api private - # def body_index children.length - 1 end diff --git a/lib/mutant/mutator/node/yield.rb b/lib/mutant/mutator/node/yield.rb index 377a6773..a3ae3c4d 100644 --- a/lib/mutant/mutator/node/yield.rb +++ b/lib/mutant/mutator/node/yield.rb @@ -14,7 +14,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch super emit_singletons diff --git a/lib/mutant/mutator/node/zsuper.rb b/lib/mutant/mutator/node/zsuper.rb index acd90d9b..658b737b 100644 --- a/lib/mutant/mutator/node/zsuper.rb +++ b/lib/mutant/mutator/node/zsuper.rb @@ -14,7 +14,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit_singletons end diff --git a/lib/mutant/mutator/registry.rb b/lib/mutant/mutator/registry.rb index a1d8391a..ceab37fe 100644 --- a/lib/mutant/mutator/registry.rb +++ b/lib/mutant/mutator/registry.rb @@ -8,7 +8,6 @@ module Mutant # @return [undefined] # # @api private - # def initialize @registry = {} end @@ -21,10 +20,9 @@ module Mutant # @param [Symbol] type # @param [Class:Mutator] mutator # - # @api private - # # @return [self] # + # @api private def register(type, mutator) fail RegistryError, "Invalid type registration: #{type}" unless AST::Types::ALL.include?(type) fail RegistryError, "Duplicate type registration: #{type}" if @registry.key?(type) @@ -42,7 +40,6 @@ module Mutant # raises argument error when mutator class cannot be found # # @api private - # def lookup(node) type = node.type @registry.fetch(type) do diff --git a/lib/mutant/mutator/util.rb b/lib/mutant/mutator/util.rb index 9e098348..992154ae 100644 --- a/lib/mutant/mutator/util.rb +++ b/lib/mutant/mutator/util.rb @@ -15,7 +15,6 @@ module Mutant # otherwise # # @api private - # def self.each(object, parent, &block) return to_enum(__method__, object, parent) unless block_given? @@ -33,7 +32,6 @@ module Mutant # @return [Boolean] # # @api private - # def new?(generated) !input.eql?(generated) end diff --git a/lib/mutant/mutator/util/array.rb b/lib/mutant/mutator/util/array.rb index 508e985a..1e2b3bb6 100644 --- a/lib/mutant/mutator/util/array.rb +++ b/lib/mutant/mutator/util/array.rb @@ -15,7 +15,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch input.each_index do |index| dup = dup_input @@ -36,7 +35,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch input.each_with_index do |element, index| Mutator.each(element).each do |mutation| @@ -56,7 +54,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch run(Element) run(Presence) diff --git a/lib/mutant/mutator/util/symbol.rb b/lib/mutant/mutator/util/symbol.rb index f58332a9..6253466d 100644 --- a/lib/mutant/mutator/util/symbol.rb +++ b/lib/mutant/mutator/util/symbol.rb @@ -14,7 +14,6 @@ module Mutant # @return [undefined] # # @api private - # def dispatch emit((input.to_s + POSTFIX).to_sym) end diff --git a/lib/mutant/parallel.rb b/lib/mutant/parallel.rb index 7d5e07b3..84339e05 100644 --- a/lib/mutant/parallel.rb +++ b/lib/mutant/parallel.rb @@ -6,12 +6,11 @@ module Mutant class Driver include Concord.new(:binding) - # Return scheduler status + # Scheduler status # # @return [Object] # # @api private - # def status binding.call(__method__) end @@ -21,7 +20,6 @@ module Mutant # @return [self] # # @api private - # def stop binding.call(__method__) self @@ -33,7 +31,6 @@ module Mutant # @return [Driver] # # @api private - # def self.async(config) Driver.new(config.env.new_mailbox.bind(Master.call(config))) end @@ -49,15 +46,13 @@ module Mutant # @return [self] # # @api private - # abstract_method :result - # Return status + # Sink status # # @return [Object] # # @api private - # abstract_method :status # Test if processing should stop @@ -65,7 +60,6 @@ module Mutant # @return [Boolean] # # @api private - # abstract_method :stop? end # Sink diff --git a/lib/mutant/parallel/master.rb b/lib/mutant/parallel/master.rb index c217b653..7e3f0dc4 100644 --- a/lib/mutant/parallel/master.rb +++ b/lib/mutant/parallel/master.rb @@ -13,7 +13,6 @@ module Mutant # @return [Actor::Sender] # # @api private - # def self.call(config) config.env.spawn do |mailbox| new(config, mailbox).__send__(:run) @@ -25,7 +24,6 @@ module Mutant # @return [undefined] # # @api private - # def initialize(*) super @@ -39,10 +37,11 @@ module Mutant # Run work loop # - # @api private - # # rubocop:disable MethodLength # + # @return [undefined] + # + # @api private def run config.jobs.times do @workers += 1 @@ -72,7 +71,6 @@ module Mutant # @return [undefined] # # @api private - # def handle(message) type, payload = message.type, message.payload method = MAP.fetch(type) do @@ -86,7 +84,6 @@ module Mutant # @return [undefined] # # @api private - # def receive_loop handle(mailbox.receiver.call) until @workers.zero? && @stop end @@ -98,7 +95,6 @@ module Mutant # @return [undefined] # # @api private - # def handle_status(sender) status = Status.new( payload: sink.status, @@ -115,7 +111,6 @@ module Mutant # @return [undefined] # # @api private - # def handle_result(job_result) @active_jobs.delete(job_result.job) sink.result(job_result.payload) @@ -128,7 +123,6 @@ module Mutant # @return [undefined] # # @api private - # def handle_stop(sender) @stop = true receive_loop @@ -142,7 +136,6 @@ module Mutant # @return [undefined] # # @api private - # def handle_ready(sender) if stop_work? stop_worker(sender) @@ -152,13 +145,14 @@ module Mutant sender.call(Actor::Message.new(:job, next_job)) end - # Return next job if any + # Next job if any # # @return [Job] # if next job is available # # @return [nil] # + # @api private def next_job Job.new( index: @index, @@ -176,7 +170,6 @@ module Mutant # @return [undefined] # # @api private - # def stop_worker(sender) @workers -= 1 sender.call(Actor::Message.new(:stop)) @@ -187,27 +180,24 @@ module Mutant # @return [Boolean] # # @api private - # def stop_work? @stop || !source.next? || sink.stop? end - # Return source + # Job source # # @return [Source] # # @api private - # def source config.source end - # Return sink + # Job result sink # # @return [Sink] # # @api private - # def sink config.sink end diff --git a/lib/mutant/parallel/source.rb b/lib/mutant/parallel/source.rb index 76cc6f82..2d5c605e 100644 --- a/lib/mutant/parallel/source.rb +++ b/lib/mutant/parallel/source.rb @@ -6,7 +6,7 @@ module Mutant NoJobError = Class.new(RuntimeError) - # Return next job + # Next job # # @return [Object] # @@ -14,7 +14,6 @@ module Mutant # when no next job is available # # @api private - # abstract_method :next # Test if next job is available @@ -22,7 +21,6 @@ module Mutant # @return [Boolean] # # @api private - # abstract_method :next? # Job source backed by a finite array @@ -34,7 +32,6 @@ module Mutant # @return [undefined] # # @api private - # def initialize(*) super @@ -46,12 +43,11 @@ module Mutant # @return [Boolean] # # @api private - # def next? @next_index < jobs.length end - # Return next job + # Next job # # @return [Object] # @@ -59,7 +55,6 @@ module Mutant # when no next job is available # # @api private - # def next fail NoJobError unless next? jobs.fetch(@next_index).tap do diff --git a/lib/mutant/parallel/worker.rb b/lib/mutant/parallel/worker.rb index fbd29bbc..82697599 100644 --- a/lib/mutant/parallel/worker.rb +++ b/lib/mutant/parallel/worker.rb @@ -11,7 +11,6 @@ module Mutant # @return [self] # # @api private - # def self.run(attributes) new(attributes).run self @@ -23,10 +22,9 @@ module Mutant # # @return [self] # - # @api private - # # rubocop:disable Lint/Loop # + # @api private def run begin parent.call(Actor::Message.new(:ready, mailbox.sender)) @@ -42,7 +40,6 @@ module Mutant # @return [Boolean] # # @api private - # def handle(message) type, payload = message.type, message.payload case message.type @@ -63,7 +60,6 @@ module Mutant # @return [undefined] # # @api private - # def handle_job(job) result = processor.call(job.payload) parent.call(Actor::Message.new(:result, JobResult.new(job: job, payload: result))) diff --git a/lib/mutant/reporter.rb b/lib/mutant/reporter.rb index ebc00cf5..80ffe87e 100644 --- a/lib/mutant/reporter.rb +++ b/lib/mutant/reporter.rb @@ -10,7 +10,6 @@ module Mutant # @return [self] # # @api private - # abstract_method :warn # Report start @@ -20,7 +19,6 @@ module Mutant # @return [self] # # @api private - # abstract_method :start # Report collector state @@ -30,7 +28,6 @@ module Mutant # @return [self] # # @api private - # abstract_method :report # Report progress on object @@ -40,7 +37,6 @@ module Mutant # @return [self] # # @api private - # abstract_method :progress end # Reporter diff --git a/lib/mutant/reporter/cli.rb b/lib/mutant/reporter/cli.rb index 45146502..213082dc 100644 --- a/lib/mutant/reporter/cli.rb +++ b/lib/mutant/reporter/cli.rb @@ -11,7 +11,6 @@ module Mutant # @return [Reporter::CLI] # # @api private - # def self.build(output) tput = Tput.detect tty = output.respond_to?(:tty?) && output.tty? @@ -30,7 +29,6 @@ module Mutant # @return [self] # # @api private - # def start(env) write(format.start(env)) self @@ -43,20 +41,18 @@ module Mutant # @return [self] # # @api private - # def progress(status) write(format.progress(status)) self end - # Return report delay in seconds + # Report delay in seconds # # TODO: Move this to a callback registration # # @return [Float] # # @api private - # def delay format.delay end @@ -68,7 +64,6 @@ module Mutant # @return [self] # # @api private - # def warn(message) output.puts(message) self @@ -81,7 +76,6 @@ module Mutant # @return [self] # # @api private - # def report(env) Printer::EnvResult.call(output, env) self @@ -96,7 +90,6 @@ module Mutant # @return [undefined] # # @api private - # def write(frame) output.write(frame) end diff --git a/lib/mutant/reporter/cli/format.rb b/lib/mutant/reporter/cli/format.rb index 51534da6..49629971 100644 --- a/lib/mutant/reporter/cli/format.rb +++ b/lib/mutant/reporter/cli/format.rb @@ -5,32 +5,29 @@ module Mutant class Format include AbstractType, Anima.new(:tty) - # Return start representation + # Start representation # # @param [Env] env # # @return [String] # # @api private - # abstract_method :start - # Return progress representation + # Progress representation # # @param [Runner::Status] status # # @return [String] # # @api private - # abstract_method :progress - # Return report delay in seconds + # Report delay in seconds # # @return [Float] # # @api private - # def delay self.class::REPORT_DELAY end @@ -44,7 +41,6 @@ module Mutant # @return [Boolean] # # @api private - # def tty? @tty end @@ -66,7 +62,6 @@ module Mutant # @return [String] # # @api private - # def format(printer, object) buffer = new_buffer printer.call(Output.new(tty, buffer), object) @@ -80,34 +75,31 @@ module Mutant REPORT_FREQUENCY = 1.0 REPORT_DELAY = 1 / REPORT_FREQUENCY - # Return start representation + # Start representation # # @return [String] # # @api private - # def start(env) format(Printer::Config, env.config) end - # Return progress representation + # Progress representation # # @return [String] # # @api private - # def progress(status) format(Printer::StatusProgressive, status) end private - # Return new buffer + # New buffer # # @return [StringIO] # # @api private - # def new_buffer StringIO.new end @@ -130,7 +122,6 @@ module Mutant # @return [String] # # @api private - # def start(_env) tput.prepare end @@ -142,19 +133,17 @@ module Mutant # @return [String] # # @api private - # def progress(status) format(Printer::Status, status) end private - # Return new buffer + # New buffer # # @return [StringIO] # # @api private - # def new_buffer # For some reason this raises an Ernno::EACCESS errror: # diff --git a/lib/mutant/reporter/cli/printer.rb b/lib/mutant/reporter/cli/printer.rb index 87b745de..c7c8ce3e 100644 --- a/lib/mutant/reporter/cli/printer.rb +++ b/lib/mutant/reporter/cli/printer.rb @@ -16,17 +16,15 @@ module Mutant # @return [self] # # @api private - # abstract_method :run private - # Return status color + # Status color # # @return [Color] # # @api private - # def status_color success? ? Color::GREEN : Color::RED end @@ -39,7 +37,6 @@ module Mutant # @return [undefined] # # @api private - # def visit_collection(printer, collection) collection.each do |object| visit(printer, object) @@ -54,7 +51,6 @@ module Mutant # @return [undefined] # # @api private - # def visit(printer, object) printer.call(output, object) end @@ -64,7 +60,6 @@ module Mutant # @return [undefined] # # @api private - # def info(string, *arguments) puts(format(string, *arguments)) end @@ -74,7 +69,6 @@ module Mutant # @return [undefined] # # @api private - # def status(string, *arguments) puts(colorize(status_color, format(string, *arguments))) end @@ -84,7 +78,6 @@ module Mutant # @return [undefined] # # @api private - # def puts(string) output.puts(string) end @@ -94,12 +87,11 @@ module Mutant # @param [Color] color # @param [String] message # - # @api private - # # @return [String] # if color is enabled # unmodified message otherwise # + # @api private def colorize(color, message) color = Color::NONE unless tty? color.format(message) @@ -110,7 +102,6 @@ module Mutant # @return [Boolean] # # @api private - # def tty? output.tty? end @@ -120,7 +111,6 @@ module Mutant # @return [Boolean] # # @api private - # alias_method :color?, :tty? end # Printer end # CLI diff --git a/lib/mutant/reporter/cli/printer/config.rb b/lib/mutant/reporter/cli/printer/config.rb index fbbbf5de..a8d8884b 100644 --- a/lib/mutant/reporter/cli/printer/config.rb +++ b/lib/mutant/reporter/cli/printer/config.rb @@ -11,10 +11,9 @@ module Mutant # # @return [undefined] # - # @api private - # # rubocop:disable AbcSize # + # @api private def run info 'Mutant configuration:' info 'Matcher: %s', object.matcher.inspect diff --git a/lib/mutant/reporter/cli/printer/env_progress.rb b/lib/mutant/reporter/cli/printer/env_progress.rb index b5128d96..728d6a1c 100644 --- a/lib/mutant/reporter/cli/printer/env_progress.rb +++ b/lib/mutant/reporter/cli/printer/env_progress.rb @@ -20,10 +20,9 @@ module Mutant # # @return [undefined] # - # @api private - # # rubocop:disable AbcSize # + # @api private def run visit(Config, env.config) info 'Subjects: %s', amount_subjects @@ -39,22 +38,20 @@ module Mutant private - # Return coverage percent + # Coverage in percent # # @return [Float] # # @api private - # def coverage_percent coverage * 100 end - # Return overhead percent + # Overhead in percent # # @return [Float] # # @api private - # def overhead_percent (overhead / killtime) * 100 end diff --git a/lib/mutant/reporter/cli/printer/env_result.rb b/lib/mutant/reporter/cli/printer/env_result.rb index 34f778e1..462366d8 100644 --- a/lib/mutant/reporter/cli/printer/env_result.rb +++ b/lib/mutant/reporter/cli/printer/env_result.rb @@ -11,7 +11,6 @@ module Mutant # @return [undefined] # # @api private - # def run visit_collection(SubjectResult, failed_subject_results) visit(EnvProgress, object) diff --git a/lib/mutant/reporter/cli/printer/mutation_progress_result.rb b/lib/mutant/reporter/cli/printer/mutation_progress_result.rb index 799ada73..8a6047a6 100644 --- a/lib/mutant/reporter/cli/printer/mutation_progress_result.rb +++ b/lib/mutant/reporter/cli/printer/mutation_progress_result.rb @@ -12,7 +12,6 @@ module Mutant # @return [undefined] # # @api private - # def run char(success? ? SUCCESS : FAILURE) end @@ -26,7 +25,6 @@ module Mutant # @return [undefined] # # @api private - # def char(char) output.write(colorize(status_color, char)) end diff --git a/lib/mutant/reporter/cli/printer/mutation_result.rb b/lib/mutant/reporter/cli/printer/mutation_result.rb index f867fe96..1025aaaa 100644 --- a/lib/mutant/reporter/cli/printer/mutation_result.rb +++ b/lib/mutant/reporter/cli/printer/mutation_result.rb @@ -51,7 +51,6 @@ module Mutant # @return [undefined] # # @api private - # def run puts(mutation.identification) print_details @@ -60,22 +59,20 @@ module Mutant private - # Return details + # Print mutation details # # @return [undefined] # # @api private - # def print_details __send__(MAP.fetch(mutation.class)) end - # Return evil details + # Evil mutation details # # @return [String] # # @api private - # def evil_details diff = Diff.build(mutation.original_source, mutation.source) diff = color? ? diff.colorized_diff : diff.diff @@ -91,7 +88,6 @@ module Mutant # @return [undefined] # # @api private - # def print_no_diff_message info( NO_DIFF_MESSAGE, @@ -107,7 +103,6 @@ module Mutant # @return [String] # # @api private - # def noop_details info(NOOP_MESSAGE) visit_test_result @@ -118,7 +113,6 @@ module Mutant # @return [String] # # @api private - # def neutral_details info(NEUTRAL_MESSAGE, original_node.inspect, mutation.source) visit_test_result @@ -129,17 +123,15 @@ module Mutant # @return [undefined] # # @api private - # def visit_test_result visit(TestResult, test_result) end - # Return original node + # Original node # # @return [Parser::AST::Node] # # @api private - # def original_node mutation.subject.node end diff --git a/lib/mutant/reporter/cli/printer/status.rb b/lib/mutant/reporter/cli/printer/status.rb index 7c505677..56bbfc1a 100644 --- a/lib/mutant/reporter/cli/printer/status.rb +++ b/lib/mutant/reporter/cli/printer/status.rb @@ -15,7 +15,6 @@ module Mutant # @return [undefined] # # @api private - # def run visit(EnvProgress, payload) job_status @@ -30,7 +29,6 @@ module Mutant # @return [undefined] # # @api private - # def job_status return if active_jobs.empty? info(ACTIVE_JOB_HEADER) @@ -39,12 +37,11 @@ module Mutant end end - # Return active subject results + # Active subject results # # @return [Array] # # @api private - # def active_subject_results active_subjects = active_jobs.map(&:payload).flat_map(&:subject) diff --git a/lib/mutant/reporter/cli/printer/status_progressive.rb b/lib/mutant/reporter/cli/printer/status_progressive.rb index 00787570..842b1f16 100644 --- a/lib/mutant/reporter/cli/printer/status_progressive.rb +++ b/lib/mutant/reporter/cli/printer/status_progressive.rb @@ -21,7 +21,6 @@ module Mutant # @return [undefined] # # @api private - # def run status( FORMAT, @@ -36,12 +35,11 @@ module Mutant private - # Return object being printed + # Object being printed # # @return [Result::Env] # # @api private - # def object super.payload end diff --git a/lib/mutant/reporter/cli/printer/subject_progress.rb b/lib/mutant/reporter/cli/printer/subject_progress.rb index 2e30d3e9..8fe23776 100644 --- a/lib/mutant/reporter/cli/printer/subject_progress.rb +++ b/lib/mutant/reporter/cli/printer/subject_progress.rb @@ -23,7 +23,6 @@ module Mutant # @return [undefined] # # @api private - # def run puts("#{subject.identification} mutations: #{amount_mutations}") print_mutation_results @@ -39,7 +38,6 @@ module Mutant # @return [undefined] # # @api private - # def print_stats status( FORMAT, @@ -57,7 +55,6 @@ module Mutant # @return [undefined] # # @api private - # def print_tests tests.each do |test| puts "- #{test.identification}" @@ -69,7 +66,6 @@ module Mutant # @return [undefined] # # @api private - # def print_progress_bar_finish puts(nil) unless amount_mutation_results.zero? end @@ -79,7 +75,6 @@ module Mutant # @return [undefined] # # @api private - # def print_mutation_results visit_collection(MutationProgressResult, object.mutation_results) end diff --git a/lib/mutant/reporter/cli/printer/subject_result.rb b/lib/mutant/reporter/cli/printer/subject_result.rb index fcaf1317..b9fa51c4 100644 --- a/lib/mutant/reporter/cli/printer/subject_result.rb +++ b/lib/mutant/reporter/cli/printer/subject_result.rb @@ -12,7 +12,6 @@ module Mutant # @return [undefined] # # @api private - # def run status(subject.identification) tests.each do |test| diff --git a/lib/mutant/reporter/cli/printer/test_result.rb b/lib/mutant/reporter/cli/printer/test_result.rb index 19024e9d..3aa3907f 100644 --- a/lib/mutant/reporter/cli/printer/test_result.rb +++ b/lib/mutant/reporter/cli/printer/test_result.rb @@ -16,7 +16,6 @@ module Mutant # @return [undefined] # # @api private - # def run info(STATUS_FORMAT, tests.length, runtime) tests.each do |test| diff --git a/lib/mutant/reporter/cli/tput.rb b/lib/mutant/reporter/cli/tput.rb index 2ad251f5..f4eb577f 100644 --- a/lib/mutant/reporter/cli/tput.rb +++ b/lib/mutant/reporter/cli/tput.rb @@ -7,13 +7,15 @@ module Mutant private_class_method :new - # Return detected tput support + # Detected tput support # # @return [Tput] # if tput support is present # # @return [nil] # otherwise + # + # @api private def self.detect reset = capture('tput reset') save = capture('tput sc') if reset @@ -33,6 +35,7 @@ module Mutant # @return [nil] # otherwise # + # @api private def self.capture(command) stdout, _stderr, exitstatus = Open3.capture3(command) stdout if exitstatus.success? diff --git a/lib/mutant/reporter/trace.rb b/lib/mutant/reporter/trace.rb index f1bb4973..dd2100ba 100644 --- a/lib/mutant/reporter/trace.rb +++ b/lib/mutant/reporter/trace.rb @@ -4,12 +4,11 @@ module Mutant class Trace include Adamantium::Mutable, Anima.new(:start_calls, :progress_calls, :report_calls, :warn_calls) - # Return new trace reporter + # New trace reporter # # @return [Trace] # # @api private - # def self.new super(Hash[anima.attribute_names.map { |name| [name, []] }]) end @@ -23,12 +22,11 @@ module Mutant REPORT_DELAY = 0.0 - # Return report delay + # Report delay # # @return [Float] # # @api private - # def delay REPORT_DELAY end diff --git a/lib/mutant/require_highjack.rb b/lib/mutant/require_highjack.rb index 9f406371..eb072cb5 100644 --- a/lib/mutant/require_highjack.rb +++ b/lib/mutant/require_highjack.rb @@ -11,7 +11,6 @@ module Mutant # the original implementation on singleton # # @api private - # def self.call(target, callback) target.method(:require).tap do target.module_eval do diff --git a/lib/mutant/result.rb b/lib/mutant/result.rb index 2fef51e2..92f04322 100644 --- a/lib/mutant/result.rb +++ b/lib/mutant/result.rb @@ -5,12 +5,11 @@ module Mutant # Coverage mixin module Coverage - # Return coverage + # Observed coverage # # @return [Rational] # # @api private - # def coverage return Rational(0) if amount_mutation_results.zero? @@ -24,7 +23,6 @@ module Mutant # @return [undefined] # # @api private - # def self.included(host) super @@ -47,7 +45,6 @@ module Mutant # @return [undefined] # # @api private - # def sum(name, collection) define_method(name) do public_send(collection).map(&name).reduce(0, :+) @@ -56,12 +53,15 @@ module Mutant end end # ClassMethods - # Return overhead + # Mutant overhead running mutatet tests + # + # This is NOT the overhead of mutation testing, just an engine specific + # measurement for the efficiency of the parellelization engine, kill + # isolation etc. # # @return [Float] # # @api private - # def overhead runtime - killtime end @@ -73,7 +73,6 @@ module Mutant # @return [undefined] # # @api private - # def self.included(host) host.class_eval do include Adamantium, Anima::Update @@ -90,18 +89,16 @@ module Mutant # @return [Boolean] # # @api private - # def success? coverage.eql?(env.config.expected_coverage) end memoize :success? - # Return failed subject results + # Failed subject results # # @return [Array] # # @api private - # def failed_subject_results subject_results.reject(&:success?) end @@ -111,22 +108,20 @@ module Mutant sum :amount_mutations_killed, :subject_results sum :killtime, :subject_results - # Return amount of mutations + # Amount of mutations # # @return [Fixnum] # # @api private - # def amount_mutations env.mutations.length end - # Return amount of subjects + # Amount of subjects # # @return [Fixnum] # # @api private - # def amount_subjects env.subjects.length end @@ -155,7 +150,6 @@ module Mutant # @return [Boolean] # # @api private - # def success? alive_mutation_results.empty? end @@ -165,68 +159,61 @@ module Mutant # @return [Boolean] # # @api private - # def continue? mutation_results.all?(&:success?) end - # Return killed mutations + # Killed mutations # # @return [Array] # # @api private - # def alive_mutation_results mutation_results.reject(&:success?) end memoize :alive_mutation_results - # Return amount of mutations + # Amount of mutations # # @return [Fixnum] # # @api private - # def amount_mutation_results mutation_results.length end - # Return amount of mutations + # Amount of mutations # # @return [Fixnum] # # @api private - # def amount_mutations subject.mutations.length end - # Return number of killed mutations + # Number of killed mutations # # @return [Fixnum] # # @api private - # def amount_mutations_killed killed_mutation_results.length end - # Return number of alive mutations + # Number of alive mutations # # @return [Fixnum] # # @api private - # def amount_mutations_alive alive_mutation_results.length end - # Return alive mutations + # Alive mutations # # @return [Array] # # @api private - # def killed_mutation_results mutation_results.select(&:success?) end @@ -238,12 +225,11 @@ module Mutant class Mutation include Result, Anima.new(:mutation, :test_result) - # Return runtime + # The runtime # # @return [Float] # # @api private - # def runtime test_result.runtime end @@ -255,7 +241,6 @@ module Mutant # @return [Boolean] # # @api private - # def success? mutation.class.success?(test_result) end diff --git a/lib/mutant/runner.rb b/lib/mutant/runner.rb index a914ba06..b72c5eb6 100644 --- a/lib/mutant/runner.rb +++ b/lib/mutant/runner.rb @@ -8,7 +8,6 @@ module Mutant # @return [undefined] # # @api private - # def initialize(*) super @@ -17,22 +16,20 @@ module Mutant run_mutation_analysis end - # Return result + # Final result # # @return [Result::Env] # # @api private - # attr_reader :result private # Run mutation analysis # - # @return [undefined] - # - # @api private + # @return [undefined] # + # @api private def run_mutation_analysis @result = run_driver(Parallel.async(mutation_test_config)) reporter.report(@result) @@ -46,7 +43,6 @@ module Mutant # the last returned status payload # # @api private - # def run_driver(driver) status = nil @@ -62,12 +58,11 @@ module Mutant status.payload end - # Return mutation test config + # Confiugation for paralell execution engine # # @return [Parallel::Config] # # @api private - # def mutation_test_config Parallel::Config.new( env: env.actor_env, @@ -78,22 +73,20 @@ module Mutant ) end - # Return reporter + # Reporter to use # # @return [Reporter] # # @api private - # def reporter env.config.reporter end - # Return config + # Config for this mutant execution # # @return [Config] # # @api private - # def config env.config end diff --git a/lib/mutant/runner/sink.rb b/lib/mutant/runner/sink.rb index c9cec37c..def241d0 100644 --- a/lib/mutant/runner/sink.rb +++ b/lib/mutant/runner/sink.rb @@ -4,12 +4,11 @@ module Mutant class Sink include AbstractType - # Return sink status + # sink status # # @return [Object] # # @api private - # abstract_method :status # Test if computation should be stopped @@ -17,7 +16,6 @@ module Mutant # @return [Boolean] # # @api private - # abstract_method :stop? # Consume result @@ -27,7 +25,6 @@ module Mutant # @return [self] # # @api private - # abstract_method :result # Mutation result sink @@ -39,7 +36,6 @@ module Mutant # @return [undefined] # # @api private - # def initialize(*) super @start = Time.now @@ -52,12 +48,11 @@ module Mutant end end - # Return runner status + # Runner status # # @return [Status] # # @api private - # def status env_result end @@ -67,7 +62,6 @@ module Mutant # @return [Boolean] # # @api private - # def stop? env.config.fail_fast && !env_result.subject_results.all?(&:success?) end @@ -79,7 +73,6 @@ module Mutant # @return [self] # # @api private - # def result(mutation_result) mutation = mutation_result.mutation @@ -95,12 +88,11 @@ module Mutant private - # Return current result + # Current result # # @return [Result::Env] # # @api private - # def env_result Result::Env.new( env: env, diff --git a/lib/mutant/selector.rb b/lib/mutant/selector.rb index 3bf0b4e8..b7f00555 100644 --- a/lib/mutant/selector.rb +++ b/lib/mutant/selector.rb @@ -3,14 +3,13 @@ module Mutant class Selector include AbstractType, Adamantium::Flat - # Return tests for subject + # Tests for subject # # @param [Subject] subjecto # # @return [Enumerable] # # @api private - # abstract_method :call end # Selector diff --git a/lib/mutant/selector/expression.rb b/lib/mutant/selector/expression.rb index 350b3910..f07fc960 100644 --- a/lib/mutant/selector/expression.rb +++ b/lib/mutant/selector/expression.rb @@ -4,14 +4,13 @@ module Mutant class Expression < self include Concord.new(:integration) - # Return tests for subject + # Tests for subject # # @param [Subject] subject # # @return [Enumerable] # # @api private - # def call(subject) subject.match_expressions.each do |match_expression| subject_tests = integration.all_tests.select do |test| diff --git a/lib/mutant/subject.rb b/lib/mutant/subject.rb index 4d898854..33599317 100644 --- a/lib/mutant/subject.rb +++ b/lib/mutant/subject.rb @@ -4,13 +4,12 @@ module Mutant include AbstractType, Adamantium::Flat, Enumerable include Concord::Public.new(:context, :node) - # Return mutations + # Mutations for this subject # # @return [Enumerable] # @return [undefined] # # @api private - # def mutations mutations = [neutral_mutation] Mutator.each(node) do |mutant| @@ -20,94 +19,85 @@ module Mutant end memoize :mutations - # Return source path + # Source path # # @return [String] # # @api private - # def source_path context.source_path end - # Prepare the subject for the insertion of mutation + # Prepare subject for insertion of mutation # # @return [self] # # @api private - # def prepare self end - # Return source lines + # Source line range # # @return [Range] # # @api private - # def source_lines expression = node.location.expression expression.line..expression.source_buffer.decompose_position(expression.end_pos).first end memoize :source_lines - # Return source line + # First source line # # @return [Fixnum] # # @api private - # def source_line source_lines.begin end - # Return subject identification + # Identification string # # @return [String] # # @api private - # def identification "#{expression.syntax}:#{source_path}:#{source_line}" end memoize :identification - # Return source representation of ast + # Source representation of AST # # @return [String] # # @api private - # def source Unparser.unparse(wrap_node(node)) end memoize :source - # Return match expression + # Match expression # # @return [Expression] # # @api private - # abstract_method :expression - # Return match expressions + # Match expressions # # @return [Enumerable] # # @api private - # abstract_method :match_expressions private - # Return neutral mutation + # Neutral mutation # # @return [Mutation::Neutral] # # @api private - # def neutral_mutation Mutation::Neutral.new(self, wrap_node(node)) end @@ -119,7 +109,6 @@ module Mutant # @return [Parser::AST::Node] # # @api private - # def wrap_node(node) node end diff --git a/lib/mutant/subject/method.rb b/lib/mutant/subject/method.rb index 7882f50e..2d0f294c 100644 --- a/lib/mutant/subject/method.rb +++ b/lib/mutant/subject/method.rb @@ -8,25 +8,22 @@ module Mutant # @return [Boolean] # # @api private - # abstract_method :public? - # Return method name + # Method name # # @return [Expression] # # @api private - # def name node.children.fetch(self.class::NAME_INDEX) end - # Return match expression + # Match expression # # @return [String] # # @api private - # def expression Expression::Method.new( scope_symbol: self.class::SYMBOL, @@ -36,12 +33,11 @@ module Mutant end memoize :expression - # Return match expressions + # Match expressions # # @return [Array] # # @api private - # def match_expressions [expression].concat(context.match_expressions) end @@ -49,12 +45,11 @@ module Mutant private - # Return scope + # The scope # # @return [Class, Module] # # @api private - # def scope context.scope end diff --git a/lib/mutant/subject/method/instance.rb b/lib/mutant/subject/method/instance.rb index cc2e0532..085c8206 100644 --- a/lib/mutant/subject/method/instance.rb +++ b/lib/mutant/subject/method/instance.rb @@ -12,7 +12,6 @@ module Mutant # @return [Boolean] # # @api private - # def public? scope.public_method_defined?(name) end @@ -23,7 +22,6 @@ module Mutant # @return [self] # # @api private - # def prepare scope.__send__(:undef_method, name) self @@ -38,7 +36,6 @@ module Mutant # @return [self] # # @api private - # def prepare scope.__send__(:memoized_methods).instance_variable_get(:@memory).delete(name) super @@ -47,14 +44,13 @@ module Mutant private - # Return memoizer node for mutant + # Memoizer node for mutant # # @param [Parser::AST::Node] mutant # # @return [Parser::AST::Node] # # @api private - # def wrap_node(mutant) s(:begin, mutant, s(:send, nil, :memoize, s(:args, s(:sym, name)))) end diff --git a/lib/mutant/subject/method/singleton.rb b/lib/mutant/subject/method/singleton.rb index 0850084f..a240c6ae 100644 --- a/lib/mutant/subject/method/singleton.rb +++ b/lib/mutant/subject/method/singleton.rb @@ -12,7 +12,6 @@ module Mutant # @return [Boolean] # # @api private - # def public? scope.singleton_class.public_method_defined?(name) end @@ -23,7 +22,6 @@ module Mutant # @return [self] # # @api private - # def prepare scope.singleton_class.__send__(:undef_method, name) self diff --git a/lib/mutant/test.rb b/lib/mutant/test.rb index 13319e60..7f32271b 100644 --- a/lib/mutant/test.rb +++ b/lib/mutant/test.rb @@ -3,12 +3,11 @@ module Mutant class Test include Adamantium::Flat, Anima.new(:id, :expression) - # Return test identification + # Identification string # # @return [String] # # @api private - # alias_method :identification, :id end # Test diff --git a/lib/mutant/version.rb b/lib/mutant/version.rb index 4f697f77..afe16323 100644 --- a/lib/mutant/version.rb +++ b/lib/mutant/version.rb @@ -1,4 +1,4 @@ module Mutant - # The current mutant version + # Current mutant version VERSION = '0.8.0'.freeze end # Mutant diff --git a/lib/mutant/warning_filter.rb b/lib/mutant/warning_filter.rb index bb7905db..7c816850 100644 --- a/lib/mutant/warning_filter.rb +++ b/lib/mutant/warning_filter.rb @@ -12,28 +12,25 @@ module Mutant # @return [undefined] # # @api private - # def initialize(target) @target = target @warnings = [] end - # Return filtered warnings + # Warnings captured by filter # # @return [Array] # # @api private - # attr_reader :warnings - # Return target + # Target stream to capture warnings on # # @return [#write] target # # @return [undefined] # # @api private - # attr_reader :target protected :target @@ -44,7 +41,6 @@ module Mutant # @return [self] # # @api private - # def write(message) if WARNING_PATTERN =~ message warnings << message @@ -60,7 +56,6 @@ module Mutant # @return [Array] # # @api private - # def self.use original = $stderr $stderr = filter = new(original) diff --git a/lib/mutant/zombifier.rb b/lib/mutant/zombifier.rb index 9c3fc3fc..2b396a7c 100644 --- a/lib/mutant/zombifier.rb +++ b/lib/mutant/zombifier.rb @@ -22,13 +22,17 @@ module Mutant # @return [undefined] # # @api private - # def initialize(*) super @includes = %r{\A#{Regexp.union(includes)}(?:/.*)?\z} @zombified = Set.new end + # Call zombifier + # + # @return [self] + # + # @api private def self.call(*args) new(*args).__send__(:call) self @@ -41,7 +45,6 @@ module Mutant # @return [undefined] # # @api private - # def call @original = require_highjack.call(method(:require)) require(root_require) @@ -52,7 +55,6 @@ module Mutant # @param [String] # # @api private - # def include?(logical_name) !@zombified.include?(logical_name) && @includes =~ logical_name end @@ -64,7 +66,6 @@ module Mutant # @return [undefined] # # @api private - # def require(logical_name) logical_name = logical_name.to_s @original.call(logical_name) @@ -83,7 +84,6 @@ module Mutant # otherwise # # @api private - # def find(logical_name) file_name = "#{logical_name}.rb" @@ -104,7 +104,6 @@ module Mutant # @return [undefined] # # @api private - # def zombify(source_path) kernel.eval( Unparser.unparse(namespaced_node(source_path)), @@ -113,14 +112,13 @@ module Mutant ) end - # Return namespaced root + # Namespaced root node # # @param [Symbol] namespace # # @return [Parser::AST::Node] # # @api private - # def namespaced_node(source_path) s(:module, s(:const, nil, namespace), Parser::CurrentRuby.parse(source_path.read)) end diff --git a/spec/support/corpus.rb b/spec/support/corpus.rb index 86980380..6b80382e 100644 --- a/spec/support/corpus.rb +++ b/spec/support/corpus.rb @@ -31,6 +31,7 @@ module MutantSpec # # @raise [Exception] # + # @api private def verify_mutation_coverage checkout Dir.chdir(repo_path) do @@ -60,6 +61,7 @@ module MutantSpec # # rubocop:disable AbcSize # + # @api private def verify_mutation_generation checkout start = Time.now @@ -99,7 +101,6 @@ module MutantSpec # @return [self] # # @api private - # def checkout return self if noinstall? TMP.mkdir unless TMP.directory? @@ -126,7 +127,6 @@ module MutantSpec # @return [undefined] # # @api private - # def install_mutant return if noinstall? relative = ROOT.relative_path_from(repo_path) @@ -142,12 +142,11 @@ module MutantSpec # Not in the docs. Number from chatting with their support. CIRCLE_CI_CONTAINER_PROCESSES = 2 - # Return number of parallel processes to use + # Number of parallel processes to use # # @return [Fixnum] # # @api private - # def parallel_processes if ENV['CI'] Mutant::Config::DEFAULT.jobs @@ -156,12 +155,11 @@ module MutantSpec end end - # Return repository path + # Repository path # # @return [Pathname] # # @api private - # def repo_path TMP.join(name) end @@ -171,7 +169,6 @@ module MutantSpec # @return [Boolean] # # @api private - # def noinstall? ENV.key?('NOINSTALL') end @@ -208,7 +205,6 @@ module MutantSpec # @param [Array] arguments # # @api private - # def system(arguments) return if Kernel.system(*arguments) if block_given? diff --git a/spec/support/rb_bug.rb b/spec/support/rb_bug.rb index bb646fa9..ed319199 100644 --- a/spec/support/rb_bug.rb +++ b/spec/support/rb_bug.rb @@ -10,7 +10,6 @@ module RbBug # @return [undefined] # # @api private - # def self.call rb_bug('%s', :string, 'test bug') end diff --git a/spec/support/rspec.rb b/spec/support/rspec.rb index a495f2de..cb756cbc 100644 --- a/spec/support/rspec.rb +++ b/spec/support/rspec.rb @@ -6,7 +6,6 @@ module Rspec # returns the value of block # # @api private - # def self.nest original_world, original_configuration = ::RSpec.instance_variable_get(:@world),