lancew/DojoList

View on GitHub

Showing 1,940 of 1,940 total issues

Avoid variables with short names like $ky. Configured minimum length is 3.
Open

    $ky = pack('H*', $privkey);
Severity: Minor
Found in lib/recaptchalib.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

The parameter $use_ssl is not named in camelCase.
Open

function recaptcha_get_html($pubkey, $error = null, $use_ssl = false)
{
    if ($pubkey == null || $pubkey == '') {
        die("To use reCAPTCHA you must get an API key from <a href='http://recaptcha.net/api/getkey'>http://recaptcha.net/api/getkey</a>");
    }
Severity: Minor
Found in lib/recaptchalib.php by phpmd

CamelCaseParameterName

Since: 0.2

It is considered best practice to use the camelCase notation to name parameters.

Example

class ClassName {
    public function doSomething($user_name) {
    }
}

Source

The parameter $item_array is not named in camelCase.
Open

function Add_Rss_item($item_array = null)
{
    $new_rss = RSS_header();
    $item_count = 0;
    $rss = Load_RSS_data();
Severity: Minor
Found in lib/rss.php by phpmd

CamelCaseParameterName

Since: 0.2

It is considered best practice to use the camelCase notation to name parameters.

Example

class ClassName {
    public function doSomething($user_name) {
    }
}

Source

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

        for (var i = 0; i < this.markers.length; i++) {
            this.addMarker(this.markers[i], true);
        }
Severity: Minor
Found in js/mapstraction.js and 1 other location - About 50 mins to fix
js/mapstraction.js on lines 263..265

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 51.

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

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

        for (var j = 0; j < this.polylines.length; j++) {
            this.addPolyline( this.polylines[j], true);
        }
Severity: Minor
Found in js/mapstraction.js and 1 other location - About 50 mins to fix
js/mapstraction.js on lines 259..261

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 51.

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

Avoid deeply nested control flow statements.
Open

              if (targetNode.parentNode == node) return [targetNode];
Severity: Major
Found in js/prototype/prototype-1.6.0.3.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if (! this.applyFilter(this.markers[m], this.filters[f])) {
                                vis = false;
                            }
    Severity: Major
    Found in js/mapstraction.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                  if (node.nodeIndex == indices[j]) results.push(node);
      Severity: Major
      Found in js/prototype/prototype-1.6.0.3.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

              if(element.tagName.toUpperCase() == 'IMG' && element.width) {
                element.width++; element.width--;
              } else try {
                var n = document.createTextNode(' ');
                element.appendChild(n);
        Severity: Major
        Found in js/prototype/prototype-1.6.0.3.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                  if (value[1]) return parseFloat(value[1]) / 100;
          Severity: Major
          Found in js/prototype/prototype-1.6.0.3.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                        for (var i = 0, node; node = nodes[i]; i++)
                          if (Element.descendantOf(targetNode, node)) return [targetNode];
            Severity: Major
            Found in js/prototype/prototype-1.6.0.3.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if (hideCallback) hideCallback(this.markers[m]);
                                      else this.markers[m].hide();
              Severity: Major
              Found in js/mapstraction.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if (showCallback) showCallback(this.markers[m]);
                                        else this.markers[m].show();
                Severity: Major
                Found in js/mapstraction.js - About 45 mins to fix

                  Function attr has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      attr: function(nodes, root, attr, value, operator, combinator) {
                  Severity: Minor
                  Found in js/prototype/prototype-1.6.0.3.js - About 45 mins to fix

                    Function updateContent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      updateContent: function(responseText) {
                        var receiver = this.container[this.success() ? 'success' : 'failure'],
                            options = this.options;
                    
                        if (!options.evalScripts) responseText = responseText.stripScripts();
                    Severity: Minor
                    Found in js/prototype/prototype-1.6.0.3.js - About 45 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

                    Avoid deeply nested control flow statements.
                    Open

                          if (element.offsetParent == document.body)
                            if (Element.getStyle(element, 'position') == 'absolute') break;
                    Severity: Major
                    Found in js/prototype/prototype-1.6.0.3.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                } else if (combinator == 'adjacent') {
                                  for (var i = 0, node; node = nodes[i]; i++)
                                    if (Selector.handlers.previousElementSibling(targetNode) == node)
                                      return [targetNode];
                                } else nodes = h[combinator](nodes);
                      Severity: Major
                      Found in js/prototype/prototype-1.6.0.3.js - About 45 mins to fix

                        Function halt has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function halt($errno = SERVER_ERROR, $msg = '', $debug_args = null)
                        {
                          $args = func_get_args();
                          $error = array_shift($args);
                        
                        
                        Severity: Minor
                        Found in lib/limonade.php - About 45 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

                        Function Validate_field has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function Validate_field($data, $type)
                        {
                            // This function checks fields and returns the number of errors found.
                            // Check if the parameters have been sent.
                            //if(!$data or !$type) { return 1;}
                        Severity: Minor
                        Found in lib/data.model.php - About 45 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

                        Function http_ua_accepts has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function http_ua_accepts($type, $env = null)
                        {
                          if(is_null($env)) $env = env();
                          $accept = array_key_exists('HTTP_ACCEPT', $env['SERVER']) ? $env['SERVER']['HTTP_ACCEPT'] : null;
                          
                        Severity: Minor
                        Found in lib/limonade.php - About 45 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

                        Severity
                        Category
                        Status
                        Source
                        Language