lancew/DojoList

View on GitHub

Showing 388 of 1,940 total issues

Function clonePosition has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  clonePosition: function(element, source) {
    var options = Object.extend({
      setLeft:    true,
      setTop:     true,
      setWidth:   true,
Severity: Minor
Found in js/prototype/prototype-1.6.0.3.js - About 25 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 inspect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  inspect: function(object) {
    try {
      if (Object.isUndefined(object)) return 'undefined';
      if (object === null) return 'null';
      return object.inspect ? object.inspect() : String(object);
Severity: Minor
Found in js/prototype/prototype-1.6.0.3.js - About 25 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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  initialize: function(request){
    this.request = request;
    var transport  = this.transport  = request.transport,
        readyState = this.readyState = transport.readyState;

Severity: Minor
Found in js/prototype/prototype-1.6.0.3.js - About 25 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 getInputs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  getInputs: function(form, typeName, name) {
    form = $(form);
    var inputs = form.getElementsByTagName('input');

    if (!typeName && !name) return $A(inputs).map(Element.extend);
Severity: Minor
Found in js/prototype/prototype-1.6.0.3.js - About 25 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 flash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function flash($name = null, $value = null)
{
  if(!defined('SID')) trigger_error("Flash messages can't be used because session isn't enabled", E_USER_WARNING);
  static $messages = array();
  $args = func_get_args();
Severity: Minor
Found in lib/limonade.php - About 25 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 file_read_chunked has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function file_read_chunked($filename, $retbytes = true)
{
  $chunksize = 1*(1024*1024); // how many bytes per chunk
  $buffer    = '';
  $cnt       = 0;
Severity: Minor
Found in lib/limonade.php - About 25 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 recaptcha_check_answer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function recaptcha_check_answer($privkey, $remoteip, $challenge, $response, $extra_params = array())
{
    if ($privkey == null || $privkey == '') {
        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 - About 25 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

The function search() has an NPath complexity of 216. The configured NPath complexity threshold is 200.
Open

function search() 
{
    $term = params('term');
    set('term', $term);
    $term = strtolower($term);
Severity: Minor
Found in controllers/main.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

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

The function Create_dojo() has an NPath complexity of 1344. The configured NPath complexity threshold is 200.
Open

function Create_dojo($dojo, $file = null)
{
    Backup_data();
    
    $xml = Load_Xml_data();
Severity: Minor
Found in lib/dojo.model.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

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

The function Create_dojo() has 118 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

function Create_dojo($dojo, $file = null)
{
    Backup_data();
    
    $xml = Load_Xml_data();
Severity: Minor
Found in lib/dojo.model.php by phpmd

The function Dojo_Editform_end() has 131 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

function Dojo_Editform_end() 
{
    if (!Validate_form($_POST) ) {
        $resp = recaptcha_check_answer(
            option('recaptcha_private_key'),
Severity: Minor
Found in controllers/dojo.php by phpmd

The function search() has 125 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

function search() 
{
    $term = params('term');
    set('term', $term);
    $term = strtolower($term);
Severity: Minor
Found in controllers/main.php by phpmd

The function request_uri() has an NPath complexity of 918. The configured NPath complexity threshold is 200.
Open

function request_uri($env = null)
{
  static $uri = null;
  if(is_null($env))
  {
Severity: Minor
Found in lib/limonade.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

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

The function run() has an NPath complexity of 16704. The configured NPath complexity threshold is 200.
Open

function run($env = null)
{
  if(is_null($env)) $env = env();
   
  # 0. Set default configuration
Severity: Minor
Found in lib/limonade.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

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

The function run() has 122 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

function run($env = null)
{
  if(is_null($env)) $env = env();
   
  # 0. Set default configuration
Severity: Minor
Found in lib/limonade.php by phpmd

The function url_for() has an NPath complexity of 208. The configured NPath complexity threshold is 200.
Open

function url_for($params = null)
{
  $paths  = array();
  $params = func_get_args();
  $GET_params = array();
Severity: Minor
Found in lib/limonade.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

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

The function render() has an NPath complexity of 480. The configured NPath complexity threshold is 200.
Open

function render($content_or_func, $layout = '', $locals = array())
{
  $args = func_get_args();
  $content_or_func = array_shift($args);
  $layout = count($args) > 0 ? array_shift($args) : layout();
Severity: Minor
Found in lib/limonade.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

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

The function route_build() has an NPath complexity of 356. The configured NPath complexity threshold is 200.
Open

function route_build($method, $path_or_array, $callback, $options = array())
{
  $method = strtoupper($method);
  if(!in_array($method, request_methods())) 
    trigger_error("'$method' request method is unkown or unavailable.", E_USER_WARNING);
Severity: Minor
Found in lib/limonade.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

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

The function mime_type() has 169 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

function mime_type($ext = null)
{
  $types = array(
    'ai'      => 'application/postscript',
    'aif'     => 'audio/x-aiff',
Severity: Minor
Found in lib/limonade.php by phpmd

The function Validate_field() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
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 by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

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

Severity
Category
Status
Source
Language