Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

check these possible issues reported by rubocop and by rubocop/require_tools

Ouverte
#34 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
25/100
Type d'issue
Refactorisation
Clarté
À clarifier
Activité
À l'abandon
Stack technique
ruby
Domaine
backend

Piste de recherche

Exécutez la commande RuboCop indiquée sur /usr/lib/ruby/2.7.0/rexml/ et examinez les emplacements signalés dans les fichiers REXML, y compris les analyseurs, les formateurs et les classes principales. Déterminez quelles infractions peuvent être traitées de manière pertinente et vérifiez le résultat final avec les tests REXML concernés ; c’est terminé lorsque les infractions prévues sont résolues ou explicitement prises en compte.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

rubocop -P --only Lint /usr/lib/ruby/2.7.0/rexml/ --except Lint/EmptyWhen,Lint/Loop
Offenses:

/usr/lib/ruby/2.7.0/rexml/attlistdecl.rb:55:20: W: Lint/UnusedMethodArgument: Unused method argument - indent. If it's necessary, use _ or _indent as an argument name to indicate that it won't be used.
    def write out, indent=-1
                   ^^^^^^
/usr/lib/ruby/2.7.0/rexml/attribute.rb:173:7: W: Lint/Void: self used in void context.
      self
      ^^^^
/usr/lib/ruby/2.7.0/rexml/attribute.rb:184:24: W: Lint/UnusedMethodArgument: Unused method argument - indent. If it's necessary, use _ or _indent as an argument name to indicate that it won't be used.
    def write( output, indent=-1 )
                       ^^^^^^
/usr/lib/ruby/2.7.0/rexml/cdata.rb:60:43: W: Lint/UnusedMethodArgument: Unused method argument - transitive. If it's necessary, use _ or _transitive as an argument name to indicate that it won't be used.
    def write( output=$stdout, indent=-1, transitive=false, ie_hack=false )
                                          ^^^^^^^^^^
/usr/lib/ruby/2.7.0/rexml/cdata.rb:60:61: W: Lint/UnusedMethodArgument: Unused method argument - ie_hack. If it's necessary, use _ or _ie_hack as an argument name to indicate that it won't be used.
    def write( output=$stdout, indent=-1, transitive=false, ie_hack=false )
                                                            ^^^^^^^
/usr/lib/ruby/2.7.0/rexml/child.rb:53:7: W: Lint/ReturnInVoidContext: Do not return a value in parent=.
      return @parent if @parent == other
      ^^^^^^
/usr/lib/ruby/2.7.0/rexml/comment.rb:50:35: W: Lint/UnusedMethodArgument: Unused method argument - transitive. If it's necessary, use _ or _transitive as an argument name to indicate that it won't be used.
    def write( output, indent=-1, transitive=false, ie_hack=false )
                                  ^^^^^^^^^^
/usr/lib/ruby/2.7.0/rexml/comment.rb:50:53: W: Lint/UnusedMethodArgument: Unused method argument - ie_hack. If it's necessary, use _ or _ie_hack as an argument name to indicate that it won't be used.
    def write( output, indent=-1, transitive=false, ie_hack=false )
                                                    ^^^^^^^
/usr/lib/ruby/2.7.0/rexml/doctype.rb:109:34: W: Lint/UnusedMethodArgument: Unused method argument - transitive. If it's necessary, use _ or _transitive as an argument name to indicate that it won't be used.
    def write( output, indent=0, transitive=false, ie_hack=false )
                                 ^^^^^^^^^^
/usr/lib/ruby/2.7.0/rexml/doctype.rb:109:52: W: Lint/UnusedMethodArgument: Unused method argument - ie_hack. If it's necessary, use _ or _ie_hack as an argument name to indicate that it won't be used.
    def write( output, indent=0, transitive=false, ie_hack=false )
                                                   ^^^^^^^
/usr/lib/ruby/2.7.0/rexml/doctype.rb:226:24: W: Lint/UnusedMethodArgument: Unused method argument - indent. If it's necessary, use _ or _indent as an argument name to indicate that it won't be used.
    def write( output, indent )
                       ^^^^^^
/usr/lib/ruby/2.7.0/rexml/doctype.rb:231:3: W: Lint/UselessAccessModifier: Useless public access modifier.
  public
  ^^^^^^
/usr/lib/ruby/2.7.0/rexml/doctype.rb:246:24: W: Lint/UnusedMethodArgument: Unused method argument - indent. If it's necessary, use _ or _indent as an argument name to indicate that it won't be used.
    def write( output, indent )
                       ^^^^^^
/usr/lib/ruby/2.7.0/rexml/doctype.rb:276:24: W: Lint/UnusedMethodArgument: Unused method argument - indent. If it's necessary, use _ or _indent as an argument name to indicate that it won't be used.
    def write( output, indent=-1 )
                       ^^^^^^
/usr/lib/ruby/2.7.0/rexml/element.rb:509:7: W: Lint/ReturnInVoidContext: Do not return a value in text=.
      return self
      ^^^^^^
/usr/lib/ruby/2.7.0/rexml/element.rb:748:9: W: Lint/NonLocalExitFromIterator: Non-local exit from iterator, without return value. next, break, Array#find, Array#any?, etc. is preferred.
        return if max>0 and num == max
        ^^^^^^
/usr/lib/ruby/2.7.0/rexml/element.rb:829:7: W: Lint/ReturnInVoidContext: Do not return a value in []=.
      return previous
      ^^^^^^
/usr/lib/ruby/2.7.0/rexml/element.rb:1150:7: W: Lint/ReturnInVoidContext: Do not return a value in []=.
      return @element
      ^^^^^^
/usr/lib/ruby/2.7.0/rexml/encoding.rb:16:7: W: Lint/ReturnInVoidContext: Do not return a value in encoding=.
      return false if defined?(@encoding) and encoding == @encoding
      ^^^^^^
/usr/lib/ruby/2.7.0/rexml/encoding.rb:22:7: W: Lint/Void: Literal true used in void context.
      true
      ^^^^
/usr/lib/ruby/2.7.0/rexml/entity.rb:97:20: W: Lint/UnusedMethodArgument: Unused method argument - indent. If it's necessary, use _ or _indent as an argument name to indicate that it won't be used.
    def write out, indent=-1
                   ^^^^^^
/usr/lib/ruby/2.7.0/rexml/formatters/pretty.rb:124:52: W: Lint/UnusedMethodArgument: Unused method argument - indentfirstline. If it's necessary, use _ or _indentfirstline as an argument name to indicate that it won't be used.
      def indent_text(string, level=1, style="\t", indentfirstline=true)
                                                   ^^^^^^^^^^^^^^^
/usr/lib/ruby/2.7.0/rexml/formatters/pretty.rb:131:47: W: Lint/AssignmentInCondition: Use == if you meant to do a comparison or wrap the expression in parentheses to indicate you meant to assign in a condition.
        while string.length > width and place = string.rindex(' ', width)
                                              ^
/usr/lib/ruby/2.7.0/rexml/functions.rb:269:25: W: Lint/UnusedBlockArgument: Unused block argument - x. You can omit the argument if you don't care about it.
        string.collect{|x| string.to_s.strip.gsub(/\s+/um, ' ') if string}
                        ^
/usr/lib/ruby/2.7.0/rexml/instruction.rb:51:34: W: Lint/UnusedMethodArgument: Unused method argument - transitive. If it's necessary, use _ or _transitive as an argument name to indicate that it won't be used.
    def write writer, indent=-1, transitive=false, ie_hack=false
                                 ^^^^^^^^^^
/usr/lib/ruby/2.7.0/rexml/instruction.rb:51:52: W: Lint/UnusedMethodArgument: Unused method argument - ie_hack. If it's necessary, use _ or _ie_hack as an argument name to indicate that it won't be used.
    def write writer, indent=-1, transitive=false, ie_hack=false
                                                   ^^^^^^^
/usr/lib/ruby/2.7.0/rexml/light/node.rb:24:11: W: Lint/UselessAssignment: Useless assignment to variable - node.
          node = [ :text, node ]
          ^^^^
/usr/lib/ruby/2.7.0/rexml/light/node.rb:26:11: W: Lint/UselessAssignment: Useless assignment to variable - node.
          node = [ :document, nil, nil ]
          ^^^^
/usr/lib/ruby/2.7.0/rexml/light/node.rb:137:18: W: Lint/UnusedMethodArgument: Unused method argument - foo. If it's necessary, use _ or _foo as an argument name to indicate that it won't be used. You can also write as text=(*) if you want the method to accept any arguments but don't care about them.
      def text=( foo )
                 ^^^
/usr/lib/ruby/2.7.0/rexml/light/node.rb:172:25: W: Lint/UnusedMethodArgument: Unused method argument - node. If it's necessary, use _ or _node as an argument name to indicate that it won't be used.
      def namespace_of( node, prefix=nil )
                        ^^^^
/usr/lib/ruby/2.7.0/rexml/light/node.rb:190:30: W: Lint/UnusedBlockArgument: Unused block argument - k. If it's necessary, use _ or _k as an argument name to indicate that it won't be used.
          ns = at(3).find { |k,v| v == namespace }
                             ^
/usr/lib/ruby/2.7.0/rexml/parsers/baseparser.rb:228:30: W: Lint/UselessAssignment: Useless assignment to variable - curr_ns.
            @nsstack.unshift(curr_ns=Set.new)
                             ^^^^^^^
/usr/lib/ruby/2.7.0/rexml/parsers/baseparser.rb:437:35: W: Lint/UnusedBlockArgument: Unused block argument - key. If it's necessary, use _ or _key as an argument name to indicate that it won't be used.
        DEFAULT_ENTITIES.each do |key, value|
                                  ^^^
/usr/lib/ruby/2.7.0/rexml/parsers/lightparser.rb:25:15: W: Lint/LiteralAsCondition: Literal true appeared as a condition.
        while true
              ^^^^
/usr/lib/ruby/2.7.0/rexml/parsers/sax2parser.rb:87:28: W: Lint/UnusedBlockArgument: Unused block argument - match. If it's necessary, use _ or _match as an argument name to indicate that it won't be used.
        @procs.each { |sym,match,block| block.call if sym == :start_document }
                           ^^^^^
/usr/lib/ruby/2.7.0/rexml/parsers/sax2parser.rb:88:32: W: Lint/UnusedBlockArgument: Unused block argument - match. If it's necessary, use _ or _match as an argument name to indicate that it won't be used.
        @listeners.each { |sym,match,block|
                               ^^^^^
/usr/lib/ruby/2.7.0/rexml/parsers/sax2parser.rb:92:15: W: Lint/LiteralAsCondition: Literal true appeared as a condition.
        while true
              ^^^^
/usr/lib/ruby/2.7.0/rexml/parsers/sax2parser.rb:111:48: W: Lint/UnusedBlockArgument: Unused block argument - value. If it's necessary, use _ or _value as an argument name to indicate that it won't be used.
              nsdecl = event[2].find_all { |n, value| n =~ /^xmlns(:|$)/ }
                                               ^^^^^
/usr/lib/ruby/2.7.0/rexml/parsers/sax2parser.rb:153:53: W: Lint/UnusedBlockArgument: Unused block argument - ns_uri. If it's necessary, use _ or _ns_uri as an argument name to indicate that it won't be used.
              namespace_mapping.each do |ns_prefix, ns_uri|
                                                    ^^^^^^
/usr/lib/ruby/2.7.0/rexml/parsers/sax2parser.rb:174:15: W: Lint/ShadowedArgument: Argument m was shadowed by a local variable before it was used.
              m=$1
              ^^^^
/usr/lib/ruby/2.7.0/rexml/parsers/sax2parser.rb:232:41: W: Lint/UnusedBlockArgument: Unused block argument - block. If it's necessary, use _ or _block as an argument name to indicate that it won't be used.
        @procs.find_all do |sym, match, block|
                                        ^^^^^
/usr/lib/ruby/2.7.0/rexml/parsers/sax2parser.rb:245:45: W: Lint/UnusedBlockArgument: Unused block argument - block. If it's necessary, use _ or _block as an argument name to indicate that it won't be used.
        @listeners.find_all do |sym, match, block|
                                            ^^^^^
/usr/lib/ruby/2.7.0/rexml/parsers/streamparser.rb:19:15: W: Lint/LiteralAsCondition: Literal true appeared as a condition.
        while true
              ^^^^
/usr/lib/ruby/2.7.0/rexml/parsers/treeparser.rb:22:17: W: Lint/LiteralAsCondition: Literal true appeared as a condition.
          while true
                ^^^^
/usr/lib/ruby/2.7.0/rexml/parsers/treeparser.rb:64:34: W: Lint/UnusedBlockArgument: Unused block argument - v. If it's necessary, use _ or _v as an argument name to indicate that it won't be used.
              entities.each { |k,v| entities[k] = @build_context.entities[k].value }
                                 ^
/usr/lib/ruby/2.7.0/rexml/parsers/ultralightparser.rb:24:15: W: Lint/LiteralAsCondition: Literal true appeared as a condition.
        while true
              ^^^^
/usr/lib/ruby/2.7.0/rexml/quickpath.rb:217:7: W: Lint/RescueException: Avoid rescuing the Exception class. Perhaps you meant to rescue StandardError?
      rescue Exception ...
      ^^^^^^^^^^^^^^^^
/usr/lib/ruby/2.7.0/rexml/source.rb:91:19: W: Lint/UnusedMethodArgument: Unused method argument - char. If it's necessary, use _ or _char as an argument name to indicate that it won't be used.
    def match_to( char, pattern )
                  ^^^^
/usr/lib/ruby/2.7.0/rexml/source.rb:95:27: W: Lint/UnusedMethodArgument: Unused method argument - char. If it's necessary, use _ or _char as an argument name to indicate that it won't be used.
    def match_to_consume( char, pattern )
                          ^^^^
/usr/lib/ruby/2.7.0/rexml/source.rb:163:25: W: Lint/UnusedMethodArgument: Unused method argument - block_size. If it's necessary, use _ or _block_size as an argument name to indicate that it won't be used.
    def initialize(arg, block_size=500, encoding=nil)
                        ^^^^^^^^^^
/usr/lib/ruby/2.7.0/rexml/source.rb:210:7: W: Lint/RescueException: Avoid rescuing the Exception class. Perhaps you meant to rescue StandardError?
      rescue Exception, NameError ...
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/ruby/2.7.0/rexml/source.rb:210:7: W: Lint/ShadowedException: Do not shadow rescued Exceptions.
      rescue Exception, NameError ...
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/ruby/2.7.0/rexml/source.rb:255:9: W: Lint/SuppressedException: Do not suppress exceptions.
        rescue
        ^^^^^^
/usr/lib/ruby/2.7.0/rexml/text.rb:131:37: W: Lint/UnusedMethodArgument: Unused method argument - doctype. If it's necessary, use _ or _doctype as an argument name to indicate that it won't be used.
    def Text.check string, pattern, doctype
                                    ^^^^^^^
/usr/lib/ruby/2.7.0/rexml/text.rb:293:35: W: Lint/UnusedMethodArgument: Unused method argument - transitive. If it's necessary, use _ or _transitive as an argument name to indicate that it won't be used.
    def write( writer, indent=-1, transitive=false, ie_hack=false )
                                  ^^^^^^^^^^
/usr/lib/ruby/2.7.0/rexml/text.rb:293:53: W: Lint/UnusedMethodArgument: Unused method argument - ie_hack. If it's necessary, use _ or _ie_hack as an argument name to indicate that it won't be used.
    def write( writer, indent=-1, transitive=false, ie_hack=false )
                                                    ^^^^^^^
/usr/lib/ruby/2.7.0/rexml/text.rb:344:5: W: Lint/IneffectiveAccessModifier: private (on line 337) does not make singleton methods private. Use private_class_method or private inside a class << self block instead.
    def Text::read_with_substitution( input, illegal=nil )
    ^^^
/usr/lib/ruby/2.7.0/rexml/text.rb:370:5: W: Lint/IneffectiveAccessModifier: private (on line 337) does not make singleton methods private. Use private_class_method or private inside a class << self block instead.
    def Text::normalize( input, doctype=nil, entity_filter=nil )
    ^^^
/usr/lib/ruby/2.7.0/rexml/text.rb:392:5: W: Lint/IneffectiveAccessModifier: private (on line 337) does not make singleton methods private. Use private_class_method or private inside a class << self block instead.
    def Text::unnormalize( string, doctype=nil, filter=nil, illegal=nil )
    ^^^
/usr/lib/ruby/2.7.0/rexml/text.rb:392:61: W: Lint/UnusedMethodArgument: Unused method argument - illegal. If it's necessary, use _ or _illegal as an argument name to indicate that it won't be used.
    def Text::unnormalize( string, doctype=nil, filter=nil, illegal=nil )
                                                            ^^^^^^^
/usr/lib/ruby/2.7.0/rexml/text.rb:405:5: W: Lint/IneffectiveAccessModifier: private (on line 337) does not make singleton methods private. Use private_class_method or private inside a class << self block instead.
    def Text.expand(ref, doctype, filter)
    ^^^
/usr/lib/ruby/2.7.0/rexml/undefinednamespaceexception.rb:5:29: W: Lint/UnusedMethodArgument: Unused method argument - source. If it's necessary, use _ or _source as an argument name to indicate that it won't be used.
    def initialize( prefix, source, parser )
                            ^^^^^^
/usr/lib/ruby/2.7.0/rexml/undefinednamespaceexception.rb:5:37: W: Lint/UnusedMethodArgument: Unused method argument - parser. If it's necessary, use _ or _parser as an argument name to indicate that it won't be used.
    def initialize( prefix, source, parser )
                                    ^^^^^^
/usr/lib/ruby/2.7.0/rexml/validation/relaxng.rb:182:14: W: Lint/RedundantStringCoercion: Use self instead of Object#to_s in interpolation.
        "< #{to_s} #{@events.collect{|e|
             ^^^^
/usr/lib/ruby/2.7.0/rexml/validation/relaxng.rb:416:14: W: Lint/RedundantStringCoercion: Use self instead of Object#to_s in interpolation.
        "< #{to_s} #{@choices.collect{|e| e.collect{|f|f.to_s}.join(', ')}.join(' or ')} >"
             ^^^^
/usr/lib/ruby/2.7.0/rexml/validation/relaxng.rb:523:14: W: Lint/RedundantStringCoercion: Use self instead of Object#to_s in interpolation.
        "< #{to_s} #{@choices.collect{|e| e.collect{|f|f.to_s}.join(', ')}.join(' and ')} >"
             ^^^^
/usr/lib/ruby/2.7.0/rexml/validation/relaxng.rb:535:13: W: Lint/RedundantStringCoercion: Use self instead of Object#to_s in interpolation.
        "{#{to_s}}"
            ^^^^
/usr/lib/ruby/2.7.0/rexml/xmldecl.rb:49:23: W: Lint/UnusedMethodArgument: Unused method argument - indent. If it's necessary, use _ or _indent as an argument name to indicate that it won't be used.
    def write(writer, indent=-1, transitive=false, ie_hack=false)
                      ^^^^^^
/usr/lib/ruby/2.7.0/rexml/xmldecl.rb:49:34: W: Lint/UnusedMethodArgument: Unused method argument - transitive. If it's necessary, use _ or _transitive as an argument name to indicate that it won't be used.
    def write(writer, indent=-1, transitive=false, ie_hack=false)
                                 ^^^^^^^^^^
/usr/lib/ruby/2.7.0/rexml/xmldecl.rb:49:52: W: Lint/UnusedMethodArgument: Unused method argument - ie_hack. If it's necessary, use _ or _ie_hack as an argument name to indicate that it won't be used.
    def write(writer, indent=-1, transitive=false, ie_hack=false)
                                                   ^^^^^^^
/usr/lib/ruby/2.7.0/rexml/xpath_parser.rb:97:16: W: Lint/UnusedMethodArgument: Unused method argument - path_stack. If it's necessary, use _ or _path_stack as an argument name to indicate that it won't be used.
    def first( path_stack, node )
               ^^^^^^^^^^
/usr/lib/ruby/2.7.0/rexml/xpath_parser.rb:562:39: W: Lint/UnusedBlockArgument: Unused block argument - node. You can omit the argument if you don't care about it.
          filter_nodeset(nodeset) do |node|
                                      ^^^^
/usr/lib/ruby/2.7.0/rexml/xpath_parser.rb:660:45: W: Lint/UnusedBlockArgument: Unused block argument - node. If it's necessary, use _ or _node as an argument name to indicate that it won't be used.
      ordered = new_arry.sort_by do |index, node|
                                            ^^^^

49 files inspected, 73 offenses detected


$ rubocop --only Require  --require rubocop/require_tools /usr/lib/ruby/2.7.0/rexml/ -P
Offenses:

/usr/lib/ruby/2.7.0/rexml/dtd/entitydecl.rb:51:28: C: Require/MissingRequireStatement: PATTERN_RE not found, you're probably missing a require statement or there is a cycle in your dependencies.
        md = source.match( PATTERN_RE, true )
                           ^^^^^^^^^^
/usr/lib/ruby/2.7.0/rexml/dtd/notationdecl.rb:34:28: C: Require/MissingRequireStatement: PATTERN_RE not found, you're probably missing a require statement or there is a cycle in your dependencies.
        md = source.match( PATTERN_RE, true )
                           ^^^^^^^^^^
/usr/lib/ruby/2.7.0/rexml/source.rb:195:18: C: Require/MissingRequireStatement: Iconv::IllegalSequence not found, you're probably missing a require statement or there is a cycle in your dependencies.
          rescue Iconv::IllegalSequence
                 ^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/ruby/2.7.0/rexml/validation/relaxng.rb:89:25: C: Require/MissingRequireStatement: AnyName not found, you're probably missing a require statement or there is a cycle in your dependencies.
              states << AnyName.new( self )
                        ^^^^^^^

49 files inspected, 4 offenses detected

Langage dominant
Ruby
Étoiles
181
Forks
104
Merge moyen
11 h 3 min
PR mergées (30 j)
1

Préparer son environnement

Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de ruby/rexml

Toutes les issues de ruby/rexml

Issues similaires

Plus d'issues Ruby

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.