free_mutant/lib/mutant/mutator/node
John Backus 3a73c1bcbf
Fix incorrect mutator comments
I used a script which detects duplicate comments:

    require 'parser/current'
    require 'pathname'

    require 'concord'

    class Comment
      include Equalizer.new(:text)

      def initialize(path, comment)
        @path    = path
        @comment = comment
      end

      def text
        comment.text
      end

      def <=>(other)
        text <=> other.text
      end

      attr_reader :path, :comment
    end

    comments =
      Pathname
        .glob('lib/**/*.rb')
        .flat_map do |path|
          Parser::CurrentRuby
            .parse_with_comments(path.read)
            .last
            .map do |comment|
              Comment.new(path, comment)
            end
        end

    @seen = Set.new

    ignores = [
      '#',
      '#   otherwise',
      /\A# [A-Z]\w+\z/,
      /\A# rubocop:disable \w+/,
      /\A# @\w/,
      /\A# @\w/,
      /\A# @\w/,
      /\A# @\w/,
    ]

    duplicates = []

    comments
      .reject do |comment|
        ignores.any? { |ignore| ignore === comment.text }
      end
      .sort
      .group_by { |comment| comment.text }
      .reject { |_, comments| comments.one? }
      .sort_by { |_, comments| comments.size }
      .each do |text, comments|
        next if comments.one?
        warn text

        comments.each do |comment|
          warn "  #{comment.path}:#{comment.comment.loc.line}"
        end
      end
2016-06-18 15:56:22 -07:00
..
literal Revert "Mutate regexp body" 2016-05-29 17:07:35 +00:00
named_value Revert "Mutate regexp body" 2016-05-29 17:07:35 +00:00
send Fix coverage of Mutant::Mutator namespace 2016-03-22 01:01:21 +00:00
and_asgn.rb Fix incorrect mutator comments 2016-06-18 15:56:22 -07:00
argument.rb Add kwoptarg mutations 2016-04-05 01:21:04 -07:00
arguments.rb Refactor to add Mutant::Mutator.mutate(...) 2016-05-07 15:03:45 -07:00
begin.rb Fix namespace annotations 2016-04-10 14:33:47 -07:00
binary.rb Remove redundant @api private YARD docs 2015-11-15 23:13:43 +00:00
block.rb Remove redundant @api private YARD docs 2015-11-15 23:13:43 +00:00
break.rb Fix coverage of Mutant::Mutator namespace 2016-03-22 01:01:21 +00:00
case.rb Remove redundant @api private YARD docs 2015-11-15 23:13:43 +00:00
conditional_loop.rb Fix namespace annotations 2016-04-10 14:33:47 -07:00
const.rb Remove redundant @api private YARD docs 2015-11-15 23:13:43 +00:00
define.rb Fix namespace annotations 2016-04-10 14:33:47 -07:00
defined.rb Fix incorrect mutator comments 2016-06-18 15:56:22 -07:00
dstr.rb Fix coverage of Mutant::Mutator namespace 2016-03-22 01:01:21 +00:00
dsym.rb Fix coverage of Mutant::Mutator namespace 2016-03-22 01:01:21 +00:00
generic.rb Add mutation from /regex/i -> /regex/ 2016-04-15 01:03:58 -07:00
if.rb Remove redundant @api private YARD docs 2015-11-15 23:13:43 +00:00
kwbegin.rb Fix coverage of Mutant::Mutator namespace 2016-03-22 01:01:21 +00:00
literal.rb Fix coverage of Mutant::Mutator namespace 2016-03-22 01:01:21 +00:00
masgn.rb Remove redundant @api private YARD docs 2015-11-15 23:13:43 +00:00
match_current_line.rb Remove redundant @api private YARD docs 2015-11-15 23:13:43 +00:00
mlhs.rb Fix coverage of Mutant::Mutator namespace 2016-03-22 01:01:21 +00:00
next.rb Fix coverage of Mutant::Mutator namespace 2016-03-22 01:01:21 +00:00
noop.rb Remove redundant @api private YARD docs 2015-11-15 23:13:43 +00:00
nthref.rb Remove redundant @api private YARD docs 2015-11-15 23:13:43 +00:00
op_asgn.rb Remove redundant @api private YARD docs 2015-11-15 23:13:43 +00:00
or_asgn.rb Fix incorrect mutator comments 2016-06-18 15:56:22 -07:00
regopt.rb Revert "Mutate regexp body" 2016-05-29 17:07:35 +00:00
resbody.rb Fix coverage of Mutant::Mutator namespace 2016-03-22 01:01:21 +00:00
rescue.rb Fix coverage of Mutant::Mutator namespace 2016-03-22 01:01:21 +00:00
return.rb Remove redundant @api private YARD docs 2015-11-15 23:13:43 +00:00
send.rb Additional mutations for array item access. 2016-06-14 23:24:14 -07:00
splat.rb Remove redundant @api private YARD docs 2015-11-15 23:13:43 +00:00
super.rb Remove redundant @api private YARD docs 2015-11-15 23:13:43 +00:00
when.rb Fix coverage of Mutant::Mutator namespace 2016-03-22 01:01:21 +00:00
yield.rb Fix coverage of Mutant::Mutator namespace 2016-03-22 01:01:21 +00:00
zsuper.rb Remove redundant @api private YARD docs 2015-11-15 23:13:43 +00:00