jidaikobo-shibata/a11yc

View on GitHub

Showing 426 of 426 total issues

Function has a complexity of 8.
Open

            $(document).find('*').each(function(){
Severity: Minor
Found in public/assets/js/a11yc_live.js by eslint

Limit Cyclomatic Complexity (complexity)

Cyclomatic complexity measures the number of linearly independent paths through a program's source code. This rule allows setting a cyclomatic complexity threshold.

function a(x) {
    if (true) {
        return x; // 1st path
    } else if (false) {
        return x+1; // 2nd path
    } else {
        return 4; // 3rd path
    }
}

Rule Details

This rule is aimed at reducing code complexity by capping the amount of cyclomatic complexity allowed in a program. As such, it will warn when the cyclomatic complexity crosses the configured threshold (default is 20).

Examples of incorrect code for a maximum of 2:

/*eslint complexity: ["error", 2]*/

function a(x) {
    if (true) {
        return x;
    } else if (false) {
        return x+1;
    } else {
        return 4; // 3rd path
    }
}

Examples of correct code for a maximum of 2:

/*eslint complexity: ["error", 2]*/

function a(x) {
    if (true) {
        return x;
    } else {
        return 4;
    }
}

Options

Optionally, you may specify a max object property:

"complexity": ["error", 2]

is equivalent to

"complexity": ["error", { "max": 2 }]

Deprecated: the object property maximum is deprecated. Please use the property max instead.

When Not To Use It

If you can't determine an appropriate complexity limit for your code, then it's best to disable this rule.

Further Reading

Related Rules

  • [max-depth](max-depth.md)
  • [max-len](max-len.md)
  • [max-nested-callbacks](max-nested-callbacks.md)
  • [max-params](max-params.md)
  • [max-statements](max-statements.md) Source: http://eslint.org/docs/rules/

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

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

          public static function check($url)
          {
              $error_names = array(
                  'table_use_th',
                  'table_use_scope',
      Severity: Minor
      Found in classes/Validate/Check/Table.php - About 1 hr to fix

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

            public static function check($url)
            {
                Validate\Set::log($url, 'cannot_contain_newline', self::$unspec, 1);
                Validate\Set::log($url, 'unbalanced_quotation', self::$unspec, 1);
                Validate\Set::log($url, 'cannot_contain_multibyte_space', self::$unspec, 1);
        Severity: Minor
        Found in classes/Validate/Check/InvalidTag.php - About 1 hr to fix

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

              public static function check($url)
              {
                  Validate\Set::log($url, 'same_urls_should_have_same_text', self::$unspec, 1);
          
                  // urls
          Severity: Minor
          Found in classes/Validate/Check/SameUrlsShouldHaveSameText.php - About 1 hr to fix

            Function set_wrapper_position has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    function set_wrapper_position(){
                    // need relocate wrapper for changing objs height by load images
            
                        
            //            if(! $(this).hasClass('a11yc_live_noheight')) return;
            Severity: Minor
            Found in public/assets/js/a11yc_live.js - About 1 hr to fix

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

                  public static function check($url)
                  {
                      $error_names = array(
                          'labelless',
                          'submitless',
              Severity: Minor
              Found in classes/Validate/Check/FormAndLabels.php - About 1 hr to fix

                Method replaceErrorStrs has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private static function replaceErrorStrs($html)
                    {
                        // remove "back" link
                        $html = preg_replace(
                            '/\<a href="#index_.+?a11yc_back_link.+?\<\/a\>/i',
                Severity: Minor
                Found in classes/Controller/Live.php - About 1 hr to fix

                  Method getUrls has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private static function getUrls($url)
                      {
                          // fetch attributes
                          $ua   = 'using';
                          $html = Model\Html::fetch($url, $ua);
                  Severity: Minor
                  Found in classes/Controller/PageAdd.php - About 1 hr to fix

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

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

                        private static function setLabelAndElement($ms)
                        {
                            $eles = array();
                            $fors = array();
                    
                    
                    Severity: Minor
                    Found in classes/Validate/Check/NotLabelButTitle.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 textFromElement has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static function textFromElement($str)
                        {
                            $text = '';
                    
                            // alt of img
                    Severity: Minor
                    Found in classes/Element/Get/Each.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 getAriaLabelledby has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private static function getAriaLabelledby($eles, $str, $text = '')
                        {
                            $text = is_bool($text) ? '' : $text;
                    
                            if (strpos($eles, 'aria-labelledby') !== false)
                    Severity: Minor
                    Found in classes/Validate/Check/EmptyLinkElement.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 14 (exceeds 5 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

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

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

                      Method addPath has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static function addPath($path, $namespace = '')
                          {
                              spl_autoload_register(
                                  function ($class_name) use ($path, $namespace)
                                  {
                      Severity: Minor
                      Found in libs/kontiki/classes/Autoloader.php - About 1 hr to fix

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

                            public static function check($url)
                            {
                                $error_names = array(
                                    'css_suspicious_paren_num',
                                    'css_suspicious_props',
                        Severity: Minor
                        Found in classes/Validate/Check/CssTotal.php - About 1 hr to fix

                          Method issue has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public static function issue($users = array(), $current_user_id = NULL, $is_admin = false)
                              {
                                  $id = intval(Input::get('id'));
                                  $issue = Model\Issue::fetch($id);
                                  if (empty($issue) || Arr::get($issue, 'trash') == 1) Util::error('issue not found');
                          Severity: Minor
                          Found in classes/Controller/IssueRead.php - About 1 hr to fix

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

                                public static function getFields($table, $name = 'default')
                                {
                                    if ( ! static::isTableExist($table, $name)) return array();
                                    $instance = static::instance($name);
                                    $retvals = array();
                            Severity: Minor
                            Found in libs/kontiki/classes/Db.php - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language