CaffGeek/MBACNationals

View on GitHub
Web.Admin/2014/wordpress/wp-includes/SimplePie/Parser.php

Summary

Maintainability
F
1 wk
Test Coverage

Function parse has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

    public function parse(&$data, $encoding)
    {
        // Use UTF-8 if we get passed US-ASCII, as every US-ASCII character is a UTF-8 character
        if (strtoupper($encoding) === 'US-ASCII')
        {
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Parser.php - About 6 hrs 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 139 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function parse(&$data, $encoding)
    {
        // Use UTF-8 if we get passed US-ASCII, as every US-ASCII character is a UTF-8 character
        if (strtoupper($encoding) === 'US-ASCII')
        {
Severity: Major
Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Parser.php - About 5 hrs to fix

    Function tag_open has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

        public function tag_open($parser, $tag, $attributes)
        {
            list($this->namespace[], $this->element[]) = $this->split_ns($tag);
    
            $attribs = array();
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Parser.php - About 4 hrs 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

    File Parser.php has 319 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * SimplePie
     *
     * A PHP-Based RSS and Atom Feed Framework.
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Parser.php - About 3 hrs to fix

      Consider simplifying this complex logical expression.
      Open

                  if ((end($this->namespace) === SIMPLEPIE_NAMESPACE_ATOM_03 && in_array(end($this->element), array('title', 'tagline', 'copyright', 'info', 'summary', 'content')) && isset($attribs['']['mode']) && $attribs['']['mode'] === 'xml')
                  || (end($this->namespace) === SIMPLEPIE_NAMESPACE_ATOM_10 && in_array(end($this->element), array('rights', 'subtitle', 'summary', 'info', 'title', 'content')) && isset($attribs['']['type']) && $attribs['']['type'] === 'xhtml')
                  || (end($this->namespace) === SIMPLEPIE_NAMESPACE_RSS_20 && in_array(end($this->element), array('title')))
                  || (end($this->namespace) === SIMPLEPIE_NAMESPACE_RSS_090 && in_array(end($this->element), array('title')))
                  || (end($this->namespace) === SIMPLEPIE_NAMESPACE_RSS_10 && in_array(end($this->element), array('title'))))
      Severity: Critical
      Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Parser.php - About 3 hrs to fix

        Method tag_open has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function tag_open($parser, $tag, $attributes)
            {
                list($this->namespace[], $this->element[]) = $this->split_ns($tag);
        
                $attribs = array();
        Severity: Major
        Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Parser.php - About 2 hrs to fix

          Function split_ns has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              public function split_ns($string)
              {
                  static $cache = array();
                  if (!isset($cache[$string]))
                  {
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Parser.php - 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 split_ns has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function split_ns($string)
              {
                  static $cache = array();
                  if (!isset($cache[$string]))
                  {
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Parser.php - About 1 hr to fix

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                public function tag_close($parser, $tag)
                {
                    if ($this->current_xhtml_construct >= 0)
                    {
                        $this->current_xhtml_construct--;
            Severity: Major
            Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Parser.php and 1 other location - About 1 day to fix
            Web.Admin/2014/wordpress/wp-includes/class-simplepie.php on lines 14588..14609

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 259.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                    if ($xml_is_sane)
                    {
                        $xml = xml_parser_create_ns($this->encoding, $this->separator);
                        xml_parser_set_option($xml, XML_OPTION_SKIP_WHITE, 1);
                        xml_parser_set_option($xml, XML_OPTION_CASE_FOLDING, 0);
            Severity: Major
            Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Parser.php and 1 other location - About 7 hrs to fix
            Web.Admin/2014/wordpress/wp-includes/class-simplepie.php on lines 14392..14483

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 230.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                    if (substr($data, 0, 4) === "\x00\x00\xFE\xFF")
                    {
                        $data = substr($data, 4);
                    }
                    // UTF-32 Little Endian BOM
            Severity: Major
            Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Parser.php and 1 other location - About 5 hrs to fix
            Web.Admin/2014/wordpress/wp-includes/class-simplepie.php on lines 14340..14363

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 191.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                        if ((end($this->namespace) === SIMPLEPIE_NAMESPACE_ATOM_03 && in_array(end($this->element), array('title', 'tagline', 'copyright', 'info', 'summary', 'content')) && isset($attribs['']['mode']) && $attribs['']['mode'] === 'xml')
                        || (end($this->namespace) === SIMPLEPIE_NAMESPACE_ATOM_10 && in_array(end($this->element), array('rights', 'subtitle', 'summary', 'info', 'title', 'content')) && isset($attribs['']['type']) && $attribs['']['type'] === 'xhtml')
            Severity: Major
            Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Parser.php and 1 other location - About 4 hrs to fix
            Web.Admin/2014/wordpress/wp-includes/class-simplepie.php on lines 14568..14569

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 181.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                    if ($this->current_xhtml_construct >= 0)
                    {
                        $this->current_xhtml_construct++;
                        if (end($this->namespace) === SIMPLEPIE_NAMESPACE_XHTML)
                        {
            Severity: Major
            Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Parser.php and 1 other location - About 2 hrs to fix
            Web.Admin/2014/wordpress/wp-includes/class-simplepie.php on lines 14547..14573

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 138.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                        if ($declaration->parse())
                        {
                            $data = substr($data, $pos + 2);
                            $data = '<?xml version="' . $declaration->version . '" encoding="' . $encoding . '" standalone="' . (($declaration->standalone) ? 'yes' : 'no') . '"?>' . $data;
                        }
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Parser.php and 1 other location - About 35 mins to fix
            Web.Admin/2014/wordpress/wp-includes/class-simplepie.php on lines 14368..14377

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 92.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            There are no issues that match your filters.

            Category
            Status