jidaikobo-shibata/a11yc

View on GitHub

Showing 426 of 426 total issues

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

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

        public static function criterion()
        {
            // value check
            $criterions = Yaml::each('criterions');
            $criterion = Input::param('criterion', '');
    Severity: Minor
    Found in classes/Controller/BulkCriterion.php - About 1 hr to fix

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

          public static function form($url, $users = array(), $current_user_id = null)
          {
              // dbio
              if (Input::isPostExists())
              {
      Severity: Minor
      Found in classes/Controller/Checklist.php - About 1 hr to fix

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

                        if (in_array($attrs['type'], array('text', 'checkbox', 'radio', 'file', 'password')))
                        {
                            $eles[$k]['tag'] = $ms[0][$k];
                            $eles[$k]['tag_name'] = $ms[1][$k];
                            $eles[$k]['title'] = isset($attrs['title']) ? $attrs['title'] : '';
        Severity: Major
        Found in classes/Validate/Check/NotLabelButTitle.php and 1 other location - About 1 hr to fix
        classes/Validate/Check/NotLabelButTitle.php on lines 110..116

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 109.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

                    elseif (in_array($m, array('textarea', 'select')))
                    {
                        $eles[$k]['tag'] = $ms[0][$k];
                        $eles[$k]['tag_name'] = $ms[1][$k];
                        $eles[$k]['title'] = isset($attrs['title']) ? $attrs['title'] : '';
        Severity: Major
        Found in classes/Validate/Check/NotLabelButTitle.php and 1 other location - About 1 hr to fix
        classes/Validate/Check/NotLabelButTitle.php on lines 123..129

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 109.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function check has a Cognitive Complexity of 12 (exceeds 5 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

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

            public static function get($array, $key, $default = null)
            {
                if ( ! is_array($array) and ! $array instanceof \ArrayAccess)
                {
        //            throw new \InvalidArgumentException('First parameter must be an array or ArrayAccess object.');
        Severity: Minor
        Found in libs/kontiki/classes/Arr.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 duplicatedNames has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            private static function duplicatedNames($k, $url, $whole_form, $v, $action)
            {
                preg_match_all("/\<(?:input|select|textarea) .+?\>/si", $whole_form, $names);
                if (isset($names[0]))
                {
        Severity: Minor
        Found in classes/Validate/Check/FormAndLabels.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 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function check($url)
            {
                Validate\Set::log($url, 'empty_link_element', self::$unspec, 1);
                $str = Element\Get::ignoredHtml($url);
        
        
        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 setDeleteElement has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            private static function setDeleteElement($eles, $fors)
            {
                $del_eles = array();
                foreach ($fors as $for)
                {
        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 updateChecks has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            private static function updateChecks($url)
            {
                $bulk = Input::postArr('chk');
                $vals = array();
                $loops = array(
        Severity: Minor
        Found in classes/Controller/Bulk.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 fetchAll has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function fetchAll($force = false, $version = null, $group_id = null)
            {
                if ( ! is_null(static::$vals) && ! $force) return static::$vals;
                $ret = static::fetchRaw($version, $group_id);
        
        
        Severity: Minor
        Found in classes/Model/DataFetch.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 12 (exceeds 5 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

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

            public static function forge($controller = '\A11yc\Controller\Center', $action = 'actionIndex')
            {
                // vals
                $c = Input::get('c', '');
                $a = Input::get('a', '');
        Severity: Minor
        Found in classes/Route.php - About 1 hr to fix

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

            Method get has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function get()
                {
                    // don't call twice
                    if (isset($this->body) && $this->body) return true;
                    $url = $this->url;
            Severity: Minor
            Found in classes/Guzzle.php - About 1 hr to fix

              Method get has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function get($array, $key, $default = null)
                  {
                      if ( ! is_array($array) and ! $array instanceof \ArrayAccess)
                      {
              //            throw new \InvalidArgumentException('First parameter must be an array or ArrayAccess object.');
              Severity: Minor
              Found in libs/kontiki/classes/Arr.php - About 1 hr to fix

                Method uniqueLabel has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private static function uniqueLabel($k, $url, $whole_form, $v)
                    {
                        preg_match_all("/\<label[^\>]*?\>(.+?)\<\/label\>/is", $whole_form, $ms);
                
                        if (isset($ms[1]))
                Severity: Minor
                Found in classes/Validate/Check/FormAndLabels.php - About 1 hr to fix

                  Method update has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function update()
                      {
                          if ( ! Db::isTableExist(A11YC_TABLE_SETTINGS)) return;
                  
                          self::serialize2json(); // trait AddDataUtil
                  Severity: Minor
                  Found in classes/Update/AddData.php - About 1 hr to fix

                    Method index has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function index()
                        {
                            // fetch pages
                            $list  = Input::get('list', 'all');
                            $words = Util::searchWords2Arr(Input::get('s', ''));
                    Severity: Minor
                    Found in classes/Controller/PageIndex.php - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language