CaffGeek/MBACNationals

View on GitHub
Web.Admin/2014/wordpress/wp-includes/pomo/po.php

Summary

Maintainability
F
3 days
Test Coverage

Function read_entry has a Cognitive Complexity of 80 (exceeds 5 allowed). Consider refactoring.
Open

    function read_entry($f, $lineno = 0) {
        $entry = new Translation_Entry();
        // where were we in the last step
        // can be: comment, msgctxt, msgid, msgid_plural, msgstr, msgstr_plural
        $context = '';
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-includes/pomo/po.php - About 1 day 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 read_entry has 97 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function read_entry($f, $lineno = 0) {
        $entry = new Translation_Entry();
        // where were we in the last step
        // can be: comment, msgctxt, msgid, msgid_plural, msgstr, msgstr_plural
        $context = '';
Severity: Major
Found in Web.Admin/2014/wordpress/wp-includes/pomo/po.php - About 3 hrs to fix

    Function export_entry has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        function export_entry(&$entry) {
            if (is_null($entry->singular)) return false;
            $po = array();
            if (!empty($entry->translator_comments)) $po[] = PO::comment_block($entry->translator_comments);
            if (!empty($entry->extracted_comments)) $po[] = PO::comment_block($entry->extracted_comments, '.');
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/pomo/po.php - About 2 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 po.php has 258 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * Class for working with PO files
     *
     * @version $Id: po.php 283 2009-09-23 16:21:51Z nbachiyski $
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/pomo/po.php - About 2 hrs to fix

      Function unpoify has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          function unpoify($string) {
              $escapes = array('t' => "\t", 'n' => "\n", '\\' => '\\');
              $lines = array_map('trim', explode("\n", $string));
              $lines = array_map(array('PO', 'trim_quotes'), $lines);
              $unpoified = '';
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-includes/pomo/po.php - About 2 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

      Function import_from_file has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          function import_from_file($filename) {
              $f = fopen($filename, 'r');
              if (!$f) return false;
              $lineno = 0;
              while (true) {
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-includes/pomo/po.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

      Avoid too many return statements within this method.
      Open

                          return false;
      Severity: Major
      Found in Web.Admin/2014/wordpress/wp-includes/pomo/po.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                            return false;
        Severity: Major
        Found in Web.Admin/2014/wordpress/wp-includes/pomo/po.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                                  return false;
          Severity: Major
          Found in Web.Admin/2014/wordpress/wp-includes/pomo/po.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return false;
            Severity: Major
            Found in Web.Admin/2014/wordpress/wp-includes/pomo/po.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return array('entry' => $entry, 'lineno' => $lineno);
              Severity: Major
              Found in Web.Admin/2014/wordpress/wp-includes/pomo/po.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                    return false;
                Severity: Major
                Found in Web.Admin/2014/wordpress/wp-includes/pomo/po.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                      return false;
                  Severity: Major
                  Found in Web.Admin/2014/wordpress/wp-includes/pomo/po.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                        return false;
                    Severity: Major
                    Found in Web.Admin/2014/wordpress/wp-includes/pomo/po.php - About 30 mins to fix

                      There are no issues that match your filters.

                      Category
                      Status