jidaikobo-shibata/a11yc

View on GitHub

Showing 426 of 426 total issues

Method each has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function each($url, $base_url = '', $is_assign = false, $is_center = false)
    {
        $page = Model\Page::fetch($url);

        if ( ! $page || ! $page['done'] || $page['trash'])
Severity: Minor
Found in classes/Controller/ResultEach.php - About 1 hr to fix

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

          public static function revertHtml($html)
          {
              if (is_array($html)) Util::error('invalid HTML was given');
      
              $retval = str_replace(
      Severity: Minor
      Found in classes/Validate.php - About 1 hr to fix

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

            public static function check($url)
            {
                Validate\Set::log($url, 'suspicious_attributes', self::$unspec, 1);
                Validate\Set::log($url, 'duplicated_attributes', self::$unspec, 1);
                $str = Element\Get::ignoredHtml($url);
        Severity: Minor
        Found in classes/Validate/Check/SuspiciousAttributes.php - About 1 hr to fix

          Method check has 40 lines of code (exceeds 25 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 1 hr to fix

            Function getText has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function getText($url, $code_str, $place, $key, $num_of_err)
                {
                    $yml = Yaml::fetch();
            
                    $current_err = Validate::setCurrentErr($url, $code_str);
            Severity: Minor
            Found in classes/Message.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 check has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

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

                private static function scopeless($n, $m, $url, $tstr)
                {
                    // return because simple table
                    if (substr_count($m, '<th') == substr_count($m, '<td')) return;
            
            
            Severity: Minor
            Found in classes/Validate/Check/Table.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 addIclLines has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                private static function addIclLines($csv, $pages)
                {
                    $resultspts = Values::resultsOptions();
                    $criterions = Yaml::each('criterions');
                    $icls = Model\Icl::fetchAll();
            Severity: Minor
            Found in classes/Controller/DownloadCsv.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 issue has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function issue()
                {
                    $issues = Model\Issue::fetchByStatus(0);
                    $settings = Model\Setting::fetchAll();
                    $pages = Model\Page::fetchAll();
            Severity: Minor
            Found in classes/Controller/DownloadIssue.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 fetchByStatus has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function fetchByStatus($status, $force = false)
                {
                    $vals = static::fetchAll($force);
            
                    $retvals = array();
            Severity: Minor
            Found in classes/Model/Issue.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 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function check($url)
                {
                    Validate\Set::log($url, 'not_label_but_title', self::$unspec, 1);
                    $str = Element\Get::ignoredHtml($url);
                    $ms = Element\Get::elementsByRe($str, 'ignores', 'tags');
            Severity: Minor
            Found in classes/Validate/Check/NotLabelButTitle.php - About 1 hr to fix

              Method assignLinks has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function assignLinks($base_url = '')
                  {
                      $removes = array('a11yc_policy', 'a11yc_report', 'a11yc_page', 'url');
                      if ( ! array_key_exists(Input::get('a11yc_version'), Model\Version::fetchAll()))
                      {
              Severity: Minor
              Found in classes/Controller/Result.php - About 1 hr to fix

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

                    public static function check($url)
                    {
                        Validate\Set::log($url, 'duplicated_ids', self::$unspec, 1);
                        Validate\Set::log($url, 'duplicated_accesskeys', self::$unspec, 1);
                        $str = Element\Get::ignoredHtml($url);
                Severity: Minor
                Found in classes/Validate/Check/DuplicatedIdsAndAccesskey.php - About 1 hr to fix

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

                      public static function explodeStrings($str)
                      {
                          $attrs = array();
                          foreach (explode(' ', $str) as $k => $v)
                          {
                  Severity: Minor
                  Found in classes/Element.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

                      The class Element has 16 fields. Consider redesigning Element to keep the number of fields under 15.
                      Open

                      class Element
                      {
                          public static $ignores = array(
                              "/\<script.+?\<\/script\>/si",
                              "/\<style.+?\<\/style\>/si",
                      Severity: Minor
                      Found in classes/Element.php by phpmd

                      TooManyFields

                      Since: 0.1

                      Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

                      Example

                      class Person {
                         protected $one;
                         private $two;
                         private $three;
                         [... many more fields ...]
                      }

                      Source https://phpmd.org/rules/codesize.html#toomanyfields

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

                          public static function check($url)
                          {
                              Validate\Set::log($url, 'notice_non_html_exists', self::$unspec, 1);
                              $str = Element\Get::ignoredHtml($url);
                      
                      
                      Severity: Minor
                      Found in classes/Validate/Check/NoticeNonHtmlExists.php - About 1 hr to fix

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

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

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

                              public static function resultStr($level, $target_level, $is_str = TRUE)
                              {
                                  $level = intval($level);
                                  if ($target_level == 2 && $level == 1)
                                  {
                          Severity: Minor
                          Found in classes/Evaluate.php - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language