ImpressCMS/impresscms

View on GitHub
upgrade/upd-icms-1.0-to-1.1/mainfile.dist.php

Summary

Maintainability
F
4 days
Test Coverage

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<?php
/**
 * All information in order to connect to database are going through here.
 *
 * Be careful if you are changing data's in this file.
Severity: Major
Found in upgrade/upd-icms-1.0-to-1.1/mainfile.dist.php and 1 other location - About 4 days to fix
htdocs/install/templates/mainfile.dist.php on lines 1..121

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 742.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Space found after opening bracket of FOREACH loop
Open

    foreach ( array('GLOBALS', '_SESSION', 'HTTP_SESSION_VARS', '_GET', 'HTTP_GET_VARS', '_POST', 'HTTP_POST_VARS', '_COOKIE', 'HTTP_COOKIE_VARS', '_REQUEST', '_SERVER', 'HTTP_SERVER_VARS', '_ENV', 'HTTP_ENV_VARS', '_FILES', 'HTTP_POST_FILES', 'xoopsDB', 'xoopsUser', 'xoopsUserId', 'xoopsUserGroups', 'xoopsUserIsAdmin', 'xoopsConfig', 'xoopsOption', 'xoopsModule', 'xoopsModuleConfig', 'xoopsRequestUri') as $bad_global) {

Inline control structures are not allowed
Open

    if (defined('XOOPS_DB_CHARSET')) die();

Space after opening parenthesis of function call prohibited
Open

        if (isset( $_REQUEST[$bad_global] )) {

Expected 1 newline at end of file; 0 found
Open

?>

Space after opening parenthesis of function call prohibited
Open

            $xoopsScriptPath = str_replace( strpos( $xoopsScriptPath, '\\\\', 2 ) ? '\\\\' : DIRECTORY_SEPARATOR, '/', $xoopsScriptPath);

No space found after comma in function call
Open

    define("XOOPS_MAINFILE_INCLUDED",1);

Space after opening parenthesis of function call prohibited
Open

            $xoopsScriptPath = str_replace( strpos( $xoopsScriptPath, '\\\\', 2 ) ? '\\\\' : DIRECTORY_SEPARATOR, '/', $xoopsScriptPath);

Expected 0 spaces before closing bracket; 1 found
Open

    define( 'ICMS_TRUST_PATH', XOOPS_TRUST_PATH );

Space after opening parenthesis of function call prohibited
Open

        if (strcasecmp( substr($xoopsScriptPath, 0, strlen(XOOPS_ROOT_PATH)), str_replace( DIRECTORY_SEPARATOR, '/', XOOPS_ROOT_PATH))) {

Space after opening parenthesis of function call prohibited
Open

    define( 'ICMS_TRUST_PATH', XOOPS_TRUST_PATH );

Space after opening parenthesis of function call prohibited
Open

    define( 'ICMS_ROOT_PATH', XOOPS_ROOT_PATH );

Space after opening parenthesis of function call prohibited
Open

        if (strcasecmp( substr($xoopsScriptPath, 0, strlen(XOOPS_ROOT_PATH)), str_replace( DIRECTORY_SEPARATOR, '/', XOOPS_ROOT_PATH))) {

Space after opening parenthesis of function call prohibited
Open

    define( 'ICMS_URL', XOOPS_URL );

Expected 0 spaces after opening bracket; 1 found
Open

    foreach ( array('GLOBALS', '_SESSION', 'HTTP_SESSION_VARS', '_GET', 'HTTP_GET_VARS', '_POST', 'HTTP_POST_VARS', '_COOKIE', 'HTTP_COOKIE_VARS', '_REQUEST', '_SERVER', 'HTTP_SERVER_VARS', '_ENV', 'HTTP_ENV_VARS', '_FILES', 'HTTP_POST_FILES', 'xoopsDB', 'xoopsUser', 'xoopsUserId', 'xoopsUserGroups', 'xoopsUserIsAdmin', 'xoopsConfig', 'xoopsOption', 'xoopsModule', 'xoopsModuleConfig', 'xoopsRequestUri') as $bad_global) {

Expected 0 spaces before closing bracket; 1 found
Open

        if (isset( $_REQUEST[$bad_global] )) {

Expected 0 spaces before closing bracket; 1 found
Open

            header( 'Location: '.XOOPS_URL.'/' );

Expected 0 spaces before closing bracket; 1 found
Open

    define( 'ICMS_ROOT_PATH', XOOPS_ROOT_PATH );

A closing tag is not permitted at the end of a PHP file
Open

?>

Expected 0 spaces before closing bracket; 1 found
Open

    define( 'ICMS_URL', XOOPS_URL );

Space after opening parenthesis of function call prohibited
Open

            header( 'Location: '.XOOPS_URL.'/' );

Expected 0 spaces before closing bracket; 1 found
Open

            $xoopsScriptPath = str_replace( strpos( $xoopsScriptPath, '\\\\', 2 ) ? '\\\\' : DIRECTORY_SEPARATOR, '/', $xoopsScriptPath);

There are no issues that match your filters.

Category
Status