Showing 699 of 699 total issues

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

  public function getEntityFieldLangcodes($entity_type, $entity) {
    list(, , $bundle) = entity_extract_ids($entity_type, $entity);
    $instances = field_info_instances($entity_type, $bundle);
    $langcodes = array();
    foreach (array_keys($instances) as $field) {
Severity: Minor
Found in modules/custom/deims_d6_migration/migration/DeimsMigration.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

Avoid unused local variables such as '$entity'.
Open

  foreach ($entities as $id => $entity) {

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Avoid unused local variables such as '$request'.
Open

    drupal_set_message('A request has been sent to PASTA to erase this dataset, which responded with this code: !code', array('!code' => $request->code));

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Avoid unused local variables such as '$attributes'.
Open

    foreach ($field['columns'] as $column => $attributes) {

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Avoid unused local variables such as '$delta'.
Open

  $delta = $context['delta'];

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

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

function deims_variable_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $element = array();

  switch ($display['type']) {
    case 'deims_variable_summary':

Avoid unused local variables such as '$revision'.
Open

    list($scope, $identifier, $revision) = $this->dataSet->getPackageIDParts();

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Avoid unused local variables such as '$instance'.
Open

  foreach ($instances as $field_name => $instance) {

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

The function deims_variable_field_widget_form() has an NPath complexity of 24192. The configured NPath complexity threshold is 200.
Open

function deims_variable_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
  // We need to actually track the form parents of our widget since it may be
  // used with inline entity forms.
  $field_name = $element['#field_name'];
  $langcode = $element['#language'];

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

Avoid unused local variables such as '$unitmetatada'.
Open

              $unitmetatada['minimum'] =  $item['data']['minimum'];

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Avoid unused local variables such as '$revision'.
Open

    list($scope, $identifier, $revision) = $this->dataSet->getPackageIDParts();
Severity: Minor
Found in modules/custom/pasta/lib/PastaApi.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

The method getVariables() has an NPath complexity of 1188. The configured NPath complexity threshold is 200.
Open

  public function getVariables($node, $row) {
    // We already have the array of referenced variable nodes in this row variable.
    // First filter out any NULL or empty values before proceeding.
    $variable_nids = array_filter($row->field_datafile_variable_ref);
    if (empty($variable_nids)) {

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

Avoid unused local variables such as '$instance'.
Open

  foreach ($instances as $field_name => $instance) {

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

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

function iso_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $element = array();
  $settings = $display['settings'];

  switch ($display['type']) {
Severity: Minor
Found in modules/custom/iso/iso.field.inc by phpmd

Avoid unused local variables such as '$langcode'.
Open

  $langcode = !empty($options['lanuage']) ? $options['language']->language : NULL;
Severity: Minor
Found in deims.tokens.inc by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

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

function bdp_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $element = array();
  $settings = $display['settings'];

  switch ($display['type']) {
Severity: Minor
Found in modules/custom/bdp/bdp.field.inc by phpmd

The function deims_variable_field_formatter_view() has an NPath complexity of 256. The configured NPath complexity threshold is 200.
Open

function deims_variable_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $element = array();

  switch ($display['type']) {
    case 'deims_variable_summary':

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

Avoid unused local variables such as '$file'.
Open

  foreach ($files as $filepath => $file) {  

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

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

function deims_variable_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
  // We need to actually track the form parents of our widget since it may be
  // used with inline entity forms.
  $field_name = $element['#field_name'];
  $langcode = $element['#language'];

Avoid unused local variables such as '$items'.
Open

  $items = $context['items'];

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Severity
Category
Status
Source
Language