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
This commit is contained in:
parent
e104630b90
commit
3a73c1bcbf
3 changed files with 3 additions and 3 deletions
|
@ -2,7 +2,7 @@ module Mutant
|
|||
class Mutator
|
||||
class Node
|
||||
|
||||
# OpAsgn mutator
|
||||
# AndAsgn mutator
|
||||
class AndAsgn < self
|
||||
|
||||
handle(:and_asgn)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module Mutant
|
||||
class Mutator
|
||||
class Node
|
||||
# Namespace for define mutations
|
||||
# Namespace for `defined?` mutations
|
||||
class Defined < self
|
||||
|
||||
handle(:defined?)
|
||||
|
|
|
@ -2,7 +2,7 @@ module Mutant
|
|||
class Mutator
|
||||
class Node
|
||||
|
||||
# OpAsgn mutator
|
||||
# OrAsgn mutator
|
||||
class OrAsgn < self
|
||||
|
||||
handle(:or_asgn)
|
||||
|
|
Loading…
Add table
Reference in a new issue