jidaikobo-shibata/a11yc

View on GitHub
classes/Update/One2Two.php

Summary

Maintainability
D
2 days
Test Coverage

Function pages has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    private static function pages($pages_old_tbl, $checks_old_tbl)
    {
        // migrate pages
        self::migratePages($pages_old_tbl);

Severity: Minor
Found in classes/Update/One2Two.php - About 3 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 doEvaluate has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    private static function doEvaluate($cs, $ngs, $yml)
    {
        // passed
        $passed = self::passed($cs, $yml);

Severity: Minor
Found in classes/Update/One2Two.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

Method pages has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private static function pages($pages_old_tbl, $checks_old_tbl)
    {
        // migrate pages
        self::migratePages($pages_old_tbl);

Severity: Major
Found in classes/Update/One2Two.php - About 2 hrs to fix

    Function yml has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        private static function yml()
        {
            include A11YC_LIB_PATH.'/spyc/Spyc.php';
            if ( ! class_exists('Spyc')) Util::error('Spyc is not found');
            $chekcs_text = file_get_contents(__DIR__.'/resources/old_checks.yml');
    Severity: Minor
    Found in classes/Update/One2Two.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 settings has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private static function settings()
        {
            $sql = 'SELECT * FROM '.A11YC_TABLE_SETUP_OLD.';';
            $settings = Db::fetchAll($sql);
            if (empty($settings[0])) return;
    Severity: Minor
    Found in classes/Update/One2Two.php - About 1 hr to fix

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

          private static function migratePages($pages_old_tbl)
          {
              $sql = 'SELECT * FROM '.$pages_old_tbl.';';
              $pages = Db::fetchAll($sql);
      
      
      Severity: Minor
      Found in classes/Update/One2Two.php - About 1 hr to fix

        Method yml has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private static function yml()
            {
                include A11YC_LIB_PATH.'/spyc/Spyc.php';
                if ( ! class_exists('Spyc')) Util::error('Spyc is not found');
                $chekcs_text = file_get_contents(__DIR__.'/resources/old_checks.yml');
        Severity: Minor
        Found in classes/Update/One2Two.php - About 1 hr to fix

          Method doEvaluate has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private static function doEvaluate($cs, $ngs, $yml)
              {
                  // passed
                  $passed = self::passed($cs, $yml);
          
          
          Severity: Minor
          Found in classes/Update/One2Two.php - About 1 hr to fix

            Function passed has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                private static function passed($cs, $yml)
                {
                    $passed = array();
                    foreach ($yml['passes'] as $code => $codes)
                    {
            Severity: Minor
            Found in classes/Update/One2Two.php - About 35 mins 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

            There are no issues that match your filters.

            Category
            Status