sparklemotion/nokogiri

View on GitHub

Showing 400 of 537 total issues

Method in_context has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  @JRubyMethod(required = 2, visibility = Visibility.PRIVATE)
  public IRubyObject
  in_context(ThreadContext context, IRubyObject str, IRubyObject options)
  {
    RubyClass klass;
Severity: Minor
Found in ext/java/nokogiri/XmlNode.java - About 1 hr to fix

    Method extractDecls has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      protected IRubyObject[]
      extractDecls(ThreadContext context, Node node)
      {
        List<IRubyObject> decls = new ArrayList<IRubyObject>();
        while (node != null) {
    Severity: Minor
    Found in ext/java/nokogiri/XmlDtd.java - About 1 hr to fix

      Method parse_with has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        @JRubyMethod
        public IRubyObject
        parse_with(ThreadContext context, IRubyObject handlerRuby)
        {
          final Ruby runtime = context.getRuntime();
      Severity: Minor
      Found in ext/java/nokogiri/XmlSaxParserContext.java - About 1 hr to fix

        Method writeStringToUtf8 has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          public static void
          writeStringToUtf8(
            final String str,
            final OutputStream out
          ) throws IOException
        Severity: Minor
        Found in ext/java/nokogiri/internals/c14n/UtfHelper.java - About 1 hr to fix

          Method getSchema has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private Schema
            getSchema(Source source, ThreadContext context)
            {
              InputStream is;
              VerifierFactory factory = new com.thaiopensource.relaxng.jarv.VerifierFactoryImpl();
          Severity: Minor
          Found in ext/java/nokogiri/XmlRelaxng.java - About 1 hr to fix

            Method op_or has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

              @JRubyMethod(name = {"|", "+"})
              public IRubyObject
              op_or(ThreadContext context, IRubyObject nodeSet)
              {
                IRubyObject[] otherNodes = getNodes(context, nodeSet);
            Severity: Minor
            Found in ext/java/nokogiri/XmlNodeSet.java - About 1 hr to fix

            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 accept has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

              @Override
              public void
              accept(ThreadContext context, SaveContextVisitor visitor)
              {
                Document document = getDocument();
            Severity: Minor
            Found in ext/java/nokogiri/XmlDocument.java - About 1 hr to fix

            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 namespace_scopes has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

              @JRubyMethod
              public RubyArray<?>
              namespace_scopes(ThreadContext context)
              {
                final XmlDocument doc = document(context.runtime);
            Severity: Minor
            Found in ext/java/nokogiri/XmlNode.java - About 1 hr to fix

            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 op_diff has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

              @JRubyMethod(name = "-")
              public IRubyObject
              op_diff(ThreadContext context, IRubyObject nodeSet)
              {
                IRubyObject[] otherNodes = getNodes(context, nodeSet);
            Severity: Minor
            Found in ext/java/nokogiri/XmlNodeSet.java - About 1 hr to fix

            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 add_namespace_definition has a Cognitive Complexity of 12 (exceeds 5 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();
            Severity: Minor
            Found in ext/java/nokogiri/XmlNode.java - About 1 hr to fix

            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 createAndCacheNamespaces has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

              private static void
              createAndCacheNamespaces(Ruby runtime, Node node)
              {
                if (node.hasAttributes()) {
                  NamedNodeMap nodeMap = node.getAttributes();
            Severity: Minor
            Found in ext/java/nokogiri/XmlDocument.java - About 1 hr to fix

            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 handleParent has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

              protected void
              handleParent(Element e, NameSpaceSymbTable ns)
              {
                if (!e.hasAttributes() && e.getNamespaceURI() == null) {
                  return;
            Severity: Minor
            Found in ext/java/nokogiri/internals/c14n/CanonicalizerBase.java - About 1 hr to fix

            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 parse has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                    def parse(string_or_io, url = nil, encoding = nil, **options, &block)
                      yield options if block
                      string_or_io = "" unless string_or_io
            
                      if string_or_io.respond_to?(:encoding) && string_or_io.encoding != Encoding::ASCII_8BIT
            Severity: Minor
            Found in lib/nokogiri/html5/document.rb - About 1 hr to fix

            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 initialize has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                  def initialize(document, tags = nil, ctx = nil, options = XML::ParseOptions::DEFAULT_HTML) # rubocop:disable Lint/MissingSuper
                    return self unless tags
            
                    options = Nokogiri::XML::ParseOptions.new(options) if Integer === options
                    @parse_options = options
            Severity: Minor
            Found in lib/nokogiri/html4/document_fragment.rb - About 1 hr to fix

            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 handleAttributesSubtree has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              @Override
              protected Iterator<Attr>
              handleAttributesSubtree(Element element, NameSpaceSymbTable ns)
              throws CanonicalizationException
              {
            Severity: Minor
            Found in ext/java/nokogiri/internals/c14n/Canonicalizer20010315.java - About 1 hr to fix

              Method handleAttributesSubtree has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                @Override
                protected Iterator<Attr>
                handleAttributesSubtree(Element element, NameSpaceSymbTable ns)
                throws CanonicalizationException
                {
              Severity: Minor
              Found in ext/java/nokogiri/internals/c14n/Canonicalizer11.java - About 1 hr to fix

                Method outputPItoWriter has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  protected void
                  outputPItoWriter(
                    ProcessingInstruction currentPI, OutputStream writer, int position
                  ) throws IOException
                  {
                Severity: Minor
                Found in ext/java/nokogiri/internals/c14n/CanonicalizerBase.java - About 1 hr to fix

                  Method compare has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    public int
                    compare(Attr attr0, Attr attr1)
                    {
                      String namespaceURI0 = attr0.getNamespaceURI();
                      String namespaceURI1 = attr1.getNamespaceURI();
                  Severity: Minor
                  Found in ext/java/nokogiri/internals/c14n/AttrCompare.java - About 1 hr to fix

                    Method resolveEntity has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      protected InputSource
                      resolveEntity(Ruby runtime, String name, String publicId, String baseURI, String systemId)
                      throws IOException, SAXException
                      {
                        InputSource s = new InputSource();
                    Severity: Minor
                    Found in ext/java/nokogiri/internals/NokogiriEntityResolver.java - About 1 hr to fix

                      Method getXmlnsAttr has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          void
                          getXmlnsAttr(Collection<Attr> col)
                          {
                            int size = levels.size() - 1;
                            if (cur == null) {
                      Severity: Minor
                      Found in ext/java/nokogiri/internals/c14n/Canonicalizer20010315.java - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language