jidaikobo-shibata/a11yc

View on GitHub

Showing 280 of 426 total issues

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

    public static function addErrorToHtml(
        $url,
        $error_id,
        $s_errors,
        $ignore_vals = '',
Severity: Major
Found in classes/Validate.php - About 2 hrs to fix

    Function check has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function check($url)
        {
            Validate\Set::log($url, 'meanless_element', self::$unspec, 1);
            Validate\Set::log($url, 'meanless_element_timing', self::$unspec, 1);
            $str = Element\Get::ignoredHtml($url);
    Severity: Minor
    Found in classes/Validate/Check/MeanlessElement.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 check has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function check($url)
        {
            Validate\Set::log($url, 'meta_refresh', self::$unspec, 5);
            if (Validate::$is_partial === true) return;
            Validate\Set::log($url, 'meta_refresh', self::$unspec, 1);
    Severity: Minor
    Found in classes/Validate/Check/MetaRefresh.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 collectFormItems has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        private static function collectFormItems($ms)
        {
            $form_items = array('<form ', '</form' ,'<label', '<input', '<select', '<texta', '<butto');
            $forms = array();
            $n = 0;
    Severity: Minor
    Found in classes/Validate/Check/FormAndLabels.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 filter has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function filter($vals, $fields)
        {
            foreach ($fields as $k => $v)
            {
                $vals[$k] = Arr::get($vals, $k, $v);
    Severity: Minor
    Found in classes/Model/DataFilter.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 prepareStrings has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function prepareStrings($str)
        {
            // escaped quote
            $str = str_replace(
                array("\\'", '\\"'),
    Severity: Major
    Found in classes/Element.php - About 2 hrs to fix

      File AddData.php has 257 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * A11yc\Update\AddData
       *
       * @package    part of A11yc
      Severity: Minor
      Found in classes/Update/AddData.php - About 2 hrs to fix

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

            public static function check($url)
            {
                Validate\Set::log($url, 'tell_user_file_type', self::$unspec, 1);
                $str = Element\Get::ignoredHtml($url);
                $ms = Element\Get::elementsByRe($str, 'ignores', 'anchors_and_values');
        Severity: Major
        Found in classes/Validate/Check/TellUserFileType.php - About 2 hrs to fix

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

                public static function check($url)
                {
                    Validate\Set::log($url, 'langless', self::$unspec, 5);
                    if (Validate::$is_partial === true) return;
                    Validate\Set::log($url, 'langless', self::$unspec, 1);
            Severity: Minor
            Found in classes/Validate/Check/Langless.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 check has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function check($url)
                {
                    Validate\Set::log($url, 'empty_alt_attr_of_img_inside_a', self::$unspec, 1);
            
                    $str = Element\Get::ignoredHtml($url);
            Severity: Minor
            Found in classes/Validate/Check/EmptyAltAttrOfImgInsideA.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 recognitionCharset has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                private static function recognitionCharset($html)
                {
                    $str = Element::ignoreElementsByStr($html);
                    // Do not use Element\Get::elementsByRe() because crashed character cause bad cache
                    preg_match_all("/\<([a-zA-Z1-6]+?) +?([^\>]*?)[\/]*?\>|\<([a-zA-Z1-6]+?)[ \/]*?\>/i", $str, $ms);
            Severity: Minor
            Found in classes/Model/Html.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

            Consider simplifying this complex logical expression.
            Open

                        if (
                            ($list == 'all'   && $page['trash'] == 0) ||
                            ($list == 'yet'   && $page['trash'] == 0 && $page['done'] == 0) ||
                            ($list == 'done'  && $page['trash'] == 0 && $page['done'] == 1) ||
                            ($list == 'trash' && $page['trash'] == 1)
            Severity: Critical
            Found in classes/Model/Page.php - About 2 hrs to fix

              Method addPages has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function addPages($is_force = false, $pages = array())
                  {
                      $pages = $pages ?: explode("\n", trim(Input::post('pages')));
              
                      // add without check
              Severity: Minor
              Found in classes/Controller/PageAdd.php - About 2 hrs to fix

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

                    public static function countTags($tags, $ignores)
                    {
                        $tags = is_null($tags) ? array() : $tags;
                
                        $opens = array();
                Severity: Minor
                Found in classes/Validate/Check/SuspiciousElements.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

                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

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

                    private static function divideEachProperties($each_properties)
                    {
                        $props = array();
                        foreach ($each_properties as $prop_and_val)
                        {
                Severity: Minor
                Found in classes/Model/CssFormat.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 check has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function check($url)
                    {
                        Validate\Set::log($url, 'langless', self::$unspec, 5);
                        if (Validate::$is_partial === true) return;
                        Validate\Set::log($url, 'langless', self::$unspec, 1);
                Severity: Minor
                Found in classes/Validate/Check/Langless.php - About 1 hr to fix

                  Method check has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function check($url)
                      {
                          Validate\Set::log($url, 'link_check', self::$unspec, 5);
                          if ( ! static::$do_link_check) return;
                          Validate\Set::log($url, 'link_check', self::$unspec, 1);
                  Severity: Minor
                  Found in classes/Validate/Check/LinkCheck.php - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language