check these possible issues reported by rubocop and by rubocop/require_tools
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Chạy lệnh RuboCop được liệt kê đối với /usr/lib/ruby/2.7.0/rexml/ và xem xét các vị trí được báo cáo trong các tệp REXML, bao gồm các parser, formatter và lớp cốt lõi. Xác định những offense nào cần được xử lý và xác minh kết quả cuối cùng bằng các bài kiểm thử REXML liên quan; được xem là hoàn tất khi các offense dự kiến đã được giải quyết hoặc được ghi nhận rõ ràng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Ruby
- Star
- 181
- Fork
- 105
- Merge trung bình
- 11 giờ 3 phút
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ruby/rexml
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
-
XPath underscored function name is wrongly acceptedCó thể đã có người làm @sjh9714 đã nhận 47 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Issue tương tự
-
NoMethodError in auth#createĐang mởbugsnag
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
JoeMcB/improvcoaches#827 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
TheOdinProject/curriculum#31465 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area: docs eco: ruby good first issue help wanted lane: free-agent roadmap size: XS type: docs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 66/100
arminazimi/evergreen#465 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
simp/puppetsync#120 ·
Maintainer thường phản hồi trong vòng 2 ngày