Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

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

Offen
#34 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
25/100
Issue-Typ
Refactoring
Klarheit
Muss geklärt werden
Aktivitätsstatus
Veraltet
Tech-Stack
ruby
Bereich
backend

Rechercherichtung

Führe den aufgeführten RuboCop-Befehl gegen /usr/lib/ruby/2.7.0/rexml/ aus und überprüfe die gemeldeten Stellen in den REXML-Dateien, einschließlich der Parser, Formatter und Kernklassen. Bestimme, welche Verstöße sinnvoll behoben werden können, und verifiziere das Endergebnis mit den relevanten REXML-Tests; als erledigt gilt die Aufgabe, wenn die vorgesehenen Verstöße behoben oder ausdrücklich berücksichtigt sind.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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

Vorherrschende Sprache
Ruby
Sterne
181
Forks
105
Ø Merge
11 Std. 3 Min.
Gemergte PRs (30 T.)
1

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus ruby/rexml

Alle Issues in ruby/rexml

Ähnliche Issues

Weitere Issues zu Ruby

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.