YetiForceCompany/YetiForceCRM

View on GitHub
tests/setup/docker_post_install.php

Summary

Maintainability
A
0 mins
Test Coverage

Call to method __construct from undeclared class \Nette\PhpGenerator\PhpLiteral
Open

    $configFile->set('SMARTY_ERROR_REPORTING', new \Nette\PhpGenerator\PhpLiteral('E_ALL'));
Severity: Critical
Found in tests/setup/docker_post_install.php by phan

Call to method __construct from undeclared class \Nette\PhpGenerator\PhpLiteral
Open

    $configFile->set('EXCEPTION_ERROR_LEVEL', new \Nette\PhpGenerator\PhpLiteral('E_ALL'));
Severity: Critical
Found in tests/setup/docker_post_install.php by phan

Call to method __construct from undeclared class \Nette\PhpGenerator\PhpLiteral
Open

    \App\Config::set('module', 'OSSMail', 'root_directory', new \Nette\PhpGenerator\PhpLiteral('ROOT_DIRECTORY . DIRECTORY_SEPARATOR'));
Severity: Critical
Found in tests/setup/docker_post_install.php by phan

Define a constant instead of duplicating this literal "component" 3 times.
Open

    \App\Config::set('component', 'Mail', 'MAILER_REQUIRED_ACCEPTATION_BEFORE_SENDING', true);
Severity: Critical
Found in tests/setup/docker_post_install.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.

Remove this commented out code.
Open

    // $configFile->set('MISSING_LIBRARY_DEV_MODE', true);

Programmers should not comment out code as it bloats programs and reduces readability.

Unused code should be deleted and can be retrieved from source control history if required.

See

  • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
  • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
  • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
  • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

Define a constant instead of duplicating this literal "module" 3 times.
Open

    \App\Config::set('module', 'OSSMail', 'root_directory', new \Nette\PhpGenerator\PhpLiteral('ROOT_DIRECTORY . DIRECTORY_SEPARATOR'));
Severity: Critical
Found in tests/setup/docker_post_install.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

    $configFile->set('db_username', 'yetiforce');

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

    $configFile->set('default_timezone', 'Europe/Warsaw');

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

    $configFile->set('layoutInLoginView', true);

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

    $configFile->set('LOG_LEVELS', ['error', 'warning']);

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

    $configFile->set('MINIMIZE_JS', false);

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

    \App\Config::set('module', 'OSSMail', 'root_directory', new \Nette\PhpGenerator\PhpLiteral('ROOT_DIRECTORY . DIRECTORY_SEPARATOR'));

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

    if (!is_dir($dirPath)) {

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

    $componentsData = require_once "$path";

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

    $configFile->set('apiShowExceptionBacktrace', true);

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

    $configFile->set('SMARTY_ERROR_REPORTING', new \Nette\PhpGenerator\PhpLiteral('E_ALL'));

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

    $configFile->set('enableCardDAV', true);

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

    $configFile->set('db_type', 'mysql');

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

    $configFile->set('DISPLAY_EXCEPTION_LOGS', true);

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

    $configFile->set('askAdminAboutVisitPurpose', false);

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

    file_put_contents($path, $content);

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

    );

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

    require_once 'include/main/WebUI.php';

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

    $configFile = new \App\ConfigFile('db');

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

    $configFile = new \App\ConfigFile('developer');

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

    $configFile->set('askSuperUserAboutVisitPurpose', false);

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

    $skip = ['db', 'main', 'debug', 'developer', 'security', 'module', 'component'];

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

    file_put_contents($path, $content);

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

    $configFile->set('db_password', 'Q4WK2yRUpliyjMRivDJE');

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

    $configFile = new \App\ConfigFile('main');

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

    $configFile = new \App\ConfigFile('debug');

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

    $configFile->set('LOG_TRACE_LEVEL', 9);

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

    $configFile->set('enableCalDAV', true);

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

    $configFile->set('apiLogAllRequests', true);

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

    $configFile->create();

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

    $configFile->set('LANGUAGES_UPDATE_DEV_MODE', true);

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

    $configFile->set('SHOW_RECORDS_COUNT', true);

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

    $path = \ROOT_DIRECTORY . \DIRECTORY_SEPARATOR . 'config' . \DIRECTORY_SEPARATOR . 'Components' . \DIRECTORY_SEPARATOR . 'ConfigTemplates.php';

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

    $configFile->set('enabledServices', ['dav', 'webservice']);

Line exceeds 120 characters; contains 147 characters
Open

    $path = \ROOT_DIRECTORY . \DIRECTORY_SEPARATOR . 'config' . \DIRECTORY_SEPARATOR . 'Components' . \DIRECTORY_SEPARATOR . 'ConfigTemplates.php';

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

    $configFile->set('cookieForceHttpOnly', false);

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

        ['; Pool Definitions ;', ''],

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

    $configFile->set('systemMode', 'test');

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

    $configFile->set('apiShowExceptionMessages', true);

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

    $configFile->set('apiShowExceptionReasonPhrase', true);

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

    $configFile->set('davDebugExceptions', true);

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

    $configFile->create();

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

    $configFile = new \App\ConfigFile('relation');

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

    foreach (array_diff(\App\ConfigFile::TYPES, $skip) as $type) {

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

    $configFile->set('loginSessionRegenerate', false);

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

        ["; Pool Definitions ;\nlog_level = warning\nerror_log = /var/log/fpm-php.www.log\n"],

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

        file_get_contents($path)

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

    $configFile->set('db_server', 'localhost');

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

    $configFile->set('db_port', 3306);

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

    $configFile->set('EXCEPTION_ERROR_LEVEL', new \Nette\PhpGenerator\PhpLiteral('E_ALL'));

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

        (new \App\ConfigFile($type))->create();

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

                (new \App\ConfigFile('module', $moduleName))->create();

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

    }

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

    $configFile->set('langInLoginView', true);

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

    $configFile->create();

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

    }

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

    $dirPath = \ROOT_DIRECTORY . \DIRECTORY_SEPARATOR . 'config' . \DIRECTORY_SEPARATOR . 'Modules';

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

    foreach ($componentsData as $component => $data) {

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

    }

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

        if ($item->isDir() && !\in_array($item->getBasename(), ['.', '..'])) {

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

    $configFile->set('LOG_TO_FILE', true);

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

    $configFile->set('DISPLAY_EXCEPTION_BACKTRACE', true);

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

    $configFile->set('DEBUG_CRON', true);

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

    $configFile->create();

Line exceeds 120 characters; contains 136 characters
Open

    \App\Config::set('module', 'OSSMail', 'root_directory', new \Nette\PhpGenerator\PhpLiteral('ROOT_DIRECTORY . DIRECTORY_SEPARATOR'));

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

    chdir(__DIR__ . '/../../');

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

    $configFile->set('db_name', 'yetiforce');

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

    $configFile->set('CHANGE_GENERATEDTYPE', true);

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

    $configFile->set('CHANGE_RELATIONS', true);

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

    // $configFile->set('MISSING_LIBRARY_DEV_MODE', true);

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

    $configFile->set('RESET_LOGIN_PASSWORD', 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

    $configFile->create();

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

    $configFile->set('site_URL', 'http://localhost/');

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

    $content = str_replace('password = ', 'password = ' . getenv('DB_ROOT_PASS'), file_get_contents($path));

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

    $configFile->set('default_language', 'en-US');

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

    $configFile->set('EXCEPTION_ERROR_TO_SHOW', true);

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

    $content = str_replace(

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

    $configFile->set('EXCEPTION_ERROR_TO_FILE', true);

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

    $configFile->set('CHANGE_VISIBILITY', true);

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

    $configFile->set('davDebugPlugin', true);

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

    $configFile = new \App\ConfigFile('api');

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

    $configFile->set('PERMITTED_BY_PRIVATE_FIELD', false);

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

    $configFile = new \App\ConfigFile('security');

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

    $configFile->create();

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

    \App\Config::set('component', 'Mail', 'MAILER_REQUIRED_ACCEPTATION_BEFORE_SENDING', true);

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

    foreach ((new \DirectoryIterator('modules/')) as $item) {

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

        mkdir($dirPath);

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

    }

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

    $configFile->create();

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

    $configFile->set('MINIMIZE_CSS', false);

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

    $configFile->set('updaterDevMode', true);

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

            $moduleName = $item->getBasename();

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

            $filePath = 'modules' . \DIRECTORY_SEPARATOR . $moduleName . \DIRECTORY_SEPARATOR . 'ConfigTemplate.php';

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

            if (file_exists($filePath)) {

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

        (new \App\ConfigFile('component', $component))->create();

There are no issues that match your filters.

Category
Status