YetiForceCompany/YetiForceCRM

View on GitHub
modules/Import/ConfigTemplate.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

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

        'description' => 'Threshold record limit for immediate import. If record count is more than this, then the import is scheduled through cron job'
Severity: Critical
Found in modules/Import/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' => 1000,
Severity: Critical
Found in modules/Import/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

    'IMMEDIATE_IMPORT_LIMIT' => [

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

    ],

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

    'CREATE_REFERENCE_RECORD' => [

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

        'default' => true,

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' => 1000,

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

        'description' => 'Threshold record limit for immediate import. If record count is more than this, then the import is scheduled through cron job'

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

        'description' => 'Individual batch limit - Specified number of records will be imported at one shot and the cycle will repeat till all records are imported'

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

    'SAVE_BY_HANDLERS' => [

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

    'ADD_PICKLIST_VALUE' => [

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

        'description' => 'Missing picklist values are added'

Line exceeds 120 characters; contains 152 characters
Open

        'description' => 'Threshold record limit for immediate import. If record count is more than this, then the import is scheduled through cron job'

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

        'description' => 'Save record including handlers'

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

    ],

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

    'BATCH_LIMIT' => [

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

        'default' => 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

        'description' => 'Records for reference fields modules are created while importing, when record is not found.'

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

        'default' => false,

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

        'default' => 250,

Line exceeds 120 characters; contains 164 characters
Open

        'description' => 'Individual batch limit - Specified number of records will be imported at one shot and the cycle will repeat till all records are imported'

There are no issues that match your filters.

Category
Status