Showing 400 of 533 total issues
Method visit_attribute_condition
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def visit_attribute_condition(node)
attribute = node.value.first.accept(self)
return attribute if node.value.length == 1
value = node.value.last
Method add_namespace_definition
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
@JRubyMethod(name = {"add_namespace_definition", "add_namespace"})
public IRubyObject
add_namespace_definition(ThreadContext context, IRubyObject prefix, IRubyObject href)
{
String hrefStr, prefixStr = prefix.isNil() ? null : prefix.convertToString().decodeString();
Method handleParent
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected void
handleParent(Element e, NameSpaceSymbTable ns)
{
if (!e.hasAttributes() && e.getNamespaceURI() == null) {
return;
Method addNamespaceDeclIfNeeded
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static String
addNamespaceDeclIfNeeded(XmlDocument doc, String tags)
{
if (doc.getDocument() == null) { return tags; }
if (doc.getDocument().getDocumentElement() == null) { return tags; }
Method dispatchNodeData
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
@SuppressWarnings("fallthrough")
protected static void
dispatchNodeData(Node node,
org.xml.sax.ContentHandler ch,
int depth)
Method iconv_configure_flags
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def iconv_configure_flags
# give --with-iconv-dir and --with-opt-dir first priority
["iconv", "opt"].each do |target|
config = preserving_globals { dir_config(target) }
next unless config.any? && try_link_iconv("--with-#{target}-* flags") { dir_config(target) }
Method parse
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse(string_or_io, url = nil, encoding = nil, options = XML::ParseOptions::DEFAULT_HTML)
options = Nokogiri::XML::ParseOptions.new(options) if Integer === options
yield options if block_given?
url ||= string_or_io.respond_to?(:path) ? string_or_io.path : nil
Method reencode
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def reencode(body, content_type = nil)
if body.encoding == Encoding::ASCII_8BIT
encoding = nil
# look for a Byte Order Mark (BOM)
Method applyGroup
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected void
applyGroup(Ruby runtime, RubyClass klass,
XmlDocument doc, NodeIter iter)
{
// LEFT branch
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method native_write
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
@JRubyMethod
public IRubyObject
native_write(ThreadContext context, IRubyObject chunk, IRubyObject isLast)
{
try {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method outputCommentToWriter
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected void
outputCommentToWriter(
Comment currentComment, OutputStream writer, int position
) throws IOException
{
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method writeCharToUtf8
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static void
writeCharToUtf8(final char c, final OutputStream out) throws IOException
{
if (c < 0x80) {
out.write(c);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method nkf
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private static CharSequence
nkf(ThreadContext context, Charset encoding, CharSequence str)
{
final Ruby runtime = context.getRuntime();
final ByteList opt;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method index
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def index(node = nil)
if node
warn("given block not used") if block_given?
each_with_index { |member, j| return j if member == node }
elsif block_given?
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method write_to
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def write_to(io, *options)
options = options.first.is_a?(Hash) ? options.shift : {}
encoding = options[:encoding] || options[0] || document.encoding
if Nokogiri.jruby?
save_options = options[:save_with] || options[1]
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method method_missing
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def method_missing(method, *args, &block)
opts = args.last.is_a?(Hash) ? args.pop : {}
case method.to_s
when /^(.*)!$/
@node["id"] = Regexp.last_match(1)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method method_missing
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def method_missing(method, *args, &block) # :nodoc:
if @context&.respond_to?(method)
@context.send(method, *args, &block)
else
node = @doc.create_element(method.to_s.sub(/[_!]$/, ""), *args) do |n|
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method meta_encoding=
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def meta_encoding=(encoding)
if (meta = meta_content_type)
meta["content"] = format("text/html; charset=%s", encoding)
encoding
elsif (meta = at_xpath("//meta[@charset]"))
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method related_class
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def related_class(class_name)
klass = nil
inspecting = self.class
while inspecting
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method outputTextToWriter
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static final void
outputTextToWriter(
final String text, final OutputStream writer
) throws IOException
{