YetiForceCompany/YetiForceCRM

View on GitHub
modules/Assets/ConfigTemplate.php

Summary

Maintainability
A
0 mins
Test Coverage
F
25%

Define a constant instead of duplicating this literal "validation" 4 times.
Open

        'validation' => '\App\Validator::standard'
Severity: Critical
Found in modules/Assets/ConfigTemplate.php by sonar-php

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Define a constant instead of duplicating this literal "default" 5 times.
Open

        'default' => '2 month',
Severity: Critical
Found in modules/Assets/ConfigTemplate.php by sonar-php

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Define a constant instead of duplicating this literal "description" 5 times.
Open

        'description' => 'How long before the renewal date should the status be changed
Severity: Critical
Found in modules/Assets/ConfigTemplate.php by sonar-php

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Spaces must be used to indent lines; tabs are not allowed
Open

    'SHOW_HIERARCHY_IN_MODAL' => [

Spaces must be used to indent lines; tabs are not allowed
Open

            $fields = $moduleModel->getFields();

Spaces must be used to indent lines; tabs are not allowed
Open

    ],

Spaces must be used to indent lines; tabs are not allowed
Open

    ],

Spaces must be used to indent lines; tabs are not allowed
Open

            $moduleModel = Vtiger_Module_Model::getInstance('Assets');

Spaces must be used to indent lines; tabs are not allowed
Open

        'description' => 'Call a callback: ["class" => "", "method" => "", "hierarchy" => ""]',

Spaces must be used to indent lines; tabs are not allowed
Open

            $args = func_get_arg(0);

Spaces must be used to indent lines; tabs are not allowed
Open

                return \in_array($field, $args);

Spaces must be used to indent lines; tabs are not allowed
Open

    'RENEWAL_CUSTOMER_FUNCTION' => [

Spaces must be used to indent lines; tabs are not allowed
Open

        'default' => [],

Spaces must be used to indent lines; tabs are not allowed
Open

        'default' => '2 month',

Spaces must be used to indent lines; tabs are not allowed
Open

        'description' => 'How long before the renewal date should the status be changed

Spaces must be used to indent lines; tabs are not allowed
Open

            }

Spaces must be used to indent lines; tabs are not allowed
Open

        'validation' => function () {

Spaces must be used to indent lines; tabs are not allowed
Open

    ],

Spaces must be used to indent lines; tabs are not allowed
Open

    ],

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

        'default' => [],

Spaces must be used to indent lines; tabs are not allowed
Open

    'SHOW_RELATION_IN_MODAL' => [

Line exceeds 120 characters; contains 151 characters
Open

        'default' => ['relationField' => 'parent_id', 'module' => 'Accounts', 'relatedModule' => ['FInvoice', 'ModComments', 'Calendar', 'Documents']],

Spaces must be used to indent lines; tabs are not allowed
Open

    ],

Spaces must be used to indent lines; tabs are not allowed
Open

    'RENEWAL_TIME' => [

Spaces must be used to indent lines; tabs are not allowed
Open

    'SHOW_FIELD_IN_MODAL' => [

Spaces must be used to indent lines; tabs are not allowed
Open

        'description' => 'Show relations in the modal',

Spaces must be used to indent lines; tabs are not allowed
Open

        'description' => 'false, [] - inherit fields, [ label => column name, .. ]',

Spaces must be used to indent lines; tabs are not allowed
Open

        'default' => ['relationField' => 'parent_id', 'module' => 'Accounts', 'relatedModule' => ['FInvoice', 'ModComments', 'Calendar', 'Documents']],

Spaces must be used to indent lines; tabs are not allowed
Open

        'validation' => function () {

Spaces must be used to indent lines; tabs are not allowed
Open

            return false;

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

        'default' => [],

Spaces must be used to indent lines; tabs are not allowed
Open

        'validation' => '\App\Validator::standard'

Spaces must be used to indent lines; tabs are not allowed
Open

        'description' => 'Show fields in the modal'

Spaces must be used to indent lines; tabs are not allowed
Open

            foreach ($fields as $field => $key) {

Spaces must be used to indent lines; tabs are not allowed
Open

        'validation' => ''

There are no issues that match your filters.

Category
Status