ImpressCMS/impresscms

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

Summary

Maintainability
A
3 hrs
Test Coverage

Method icmsFormField has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

function icmsFormField( $name, $value, $label, $maxlength, $help = '' )
Severity: Minor
Found in upgrade/upd-icms-1.0-to-1.1/settings_trust_path.php - About 35 mins to fix

    Reference to undeclared constant \_SUBMIT
    Open

        <button type="submit"><?php echo _SUBMIT; ?></button>

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

    function icmsFormField( $name, $value, $label, $maxlength, $help = '' )
    {
        $label = htmlspecialchars( $label );
        $name = htmlspecialchars( $name, ENT_QUOTES );
        $value = htmlspecialchars( $value, ENT_QUOTES );
    Severity: Major
    Found in upgrade/upd-icms-1.0-to-1.1/settings_trust_path.php and 2 other locations - About 2 hrs to fix
    htdocs/install/page_dbsettings.php on lines 306..319
    upgrade/upd-icms-1.0-to-1.1/settings_salt.php on lines 19..33

    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 140.

    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

    Tabs must be used to indent lines; spaces are not allowed
    Open

            $field .= '<div class="xoform-help1">' . $help . "</div>\n";

    Tabs must be used to indent lines; spaces are not allowed
    Open

        $maxlength = (int) $maxlength;

    Tabs must be used to indent lines; spaces are not allowed
    Open

        $vars['TRUST_PATH'] = '';

    Tabs must be used to indent lines; spaces are not allowed
    Open

        $field = "<label for='$name'>$label</label>\n";

    Tabs must be used to indent lines; spaces are not allowed
    Open

        <button type="submit"><?php echo _SUBMIT; ?></button>

    Tabs must be used to indent lines; spaces are not allowed
    Open

        $value = htmlspecialchars( $value, ENT_QUOTES );

    Tabs must be used to indent lines; spaces are not allowed
    Open

            $error = ERR_NO_TRUST_PATH;

    Tabs must be used to indent lines; spaces are not allowed
    Open

        return $field;

    Tabs must be used to indent lines; spaces are not allowed
    Open

        if ($help) {

    Tabs must be used to indent lines; spaces are not allowed
    Open

            $error = ERR_WRONG_TRUST_PATH;

    Tabs must be used to indent lines; spaces are not allowed
    Open

        die( 'Bad installation: please add this folder to the ImpressCMS install you want to upgrade');

    Tabs must be used to indent lines; spaces are not allowed
    Open

        $name = htmlspecialchars( $name, ENT_QUOTES );

    Tabs must be used to indent lines; spaces are not allowed
    Open

        }

    Tabs must be used to indent lines; spaces are not allowed
    Open

        $label = htmlspecialchars( $label );

    Expected 0 spaces between argument "$help" and closing bracket; 1 found
    Open

    function icmsFormField( $name, $value, $label, $maxlength, $help = '' )

    Expected 0 spaces between opening bracket and argument "$name"; 1 found
    Open

    function icmsFormField( $name, $value, $label, $maxlength, $help = '' )

    Expected 0 spaces before closing bracket; 1 found
    Open

    <?php if (!empty( $error ) ) echo '<div class="x2-note error">' . $error . "</div>\n"; ?>

    Opening brace should be on the same line as the declaration
    Open

    {

    Tabs must be used to indent lines; spaces are not allowed
    Open

            return false;

    PHP keywords must be lowercase; expected "or" but found "OR"
    Open

        } elseif (substr( $vars, -1 ) == '/' OR substr( $vars, -1 ) == '\'') {

    Tabs must be used to indent lines; spaces are not allowed
    Open

            $error = ERR_INVALID_TRUST_PATH;

    Expected 1 space after comma in function call; 4 found
    Open

        <?php echo icmsFormField( 'TRUST_PATH',    $vars['TRUST_PATH'],    TRUST_PATH_LABEL, 255, TRUST_PATH_HELP ); ?>

    Tabs must be used to indent lines; spaces are not allowed
    Open

        $field .= "<input type='text' name='$name' id='$name' value='$value' />";

    Expected 0 spaces before closing bracket; 1 found
    Open

        if (@empty( $vars['TRUST_PATH'] ) )

    Inline control structures are not allowed
    Open

    <?php if (!empty( $error ) ) echo '<div class="x2-note error">' . $error . "</div>\n"; ?>

    Space after opening parenthesis of function call prohibited
    Open

    if (!defined( 'ICMS_ROOT_PATH' )) {

    Expected 0 spaces before closing bracket; 1 found
    Open

                        return str_replace( "//", "/", str_replace( "\\", "/", substr( $vars, 0, -1 ) ) );

    Space after opening parenthesis of function call prohibited
    Open

        } elseif (substr( $vars, -1 ) == '/' OR substr( $vars, -1 ) == '\'') {

    Space after opening parenthesis of function call prohibited
    Open

        $label = htmlspecialchars( $label );

    Expected 0 spaces before closing bracket; 1 found
    Open

        } elseif (!is_dir( $vars['TRUST_PATH'] )) {

    Expected 0 spaces before closing bracket; 1 found
    Open

        if (@empty( $vars['TRUST_PATH'] ) )

    Expected 1 space after closing parenthesis; found 5
    Open

        if (@empty( $vars['TRUST_PATH'] ) )

    Space after opening parenthesis of function call prohibited
    Open

        } elseif (substr( $vars, -1 ) == '/' OR substr( $vars, -1 ) == '\'') {

    Expected 0 spaces before closing bracket; 1 found
    Open

        } elseif (substr( $vars, -1 ) == '/' OR substr( $vars, -1 ) == '\'') {

    Space after opening parenthesis of function call prohibited
    Open

        $name = htmlspecialchars( $name, ENT_QUOTES );

    Space after opening parenthesis of function call prohibited
    Open

        die( 'Bad installation: please add this folder to the ImpressCMS install you want to upgrade');

    Expected 0 spaces before closing bracket; 1 found
    Open

                        return str_replace( "//", "/", str_replace( "\\", "/", $vars ) );

    Expected 0 spaces before closing bracket; 1 found
    Open

                        return str_replace( "//", "/", str_replace( "\\", "/", $vars ) );

    Space after opening parenthesis of function call prohibited
    Open

    if (!isset( $vars['TRUST_PATH'] )) {

    Expected 0 spaces before closing bracket; 1 found
    Open

    if (!isset( $vars['TRUST_PATH'] )) {

    Space after opening parenthesis of function call prohibited
    Open

        $value = htmlspecialchars( $value, ENT_QUOTES );

    Space after opening parenthesis of function call prohibited
    Open

        if (@empty( $vars['TRUST_PATH'] ) )

    Space after opening parenthesis of function call prohibited
    Open

                        return str_replace( "//", "/", str_replace( "\\", "/", substr( $vars, 0, -1 ) ) );

    Expected 0 spaces before closing bracket; 1 found
    Open

        <?php echo icmsFormField( 'TRUST_PATH',    $vars['TRUST_PATH'],    TRUST_PATH_LABEL, 255, TRUST_PATH_HELP ); ?>

    Expected 0 spaces before closing bracket; 1 found
    Open

        $value = htmlspecialchars( $value, ENT_QUOTES );

    Expected 0 spaces before closing bracket; 1 found
    Open

        } elseif (substr( $vars, -1 ) == '/' OR substr( $vars, -1 ) == '\'') {

    Expected 0 spaces before closing bracket; 1 found
    Open

    <?php if (!empty( $error ) ) echo '<div class="x2-note error">' . $error . "</div>\n"; ?>

    Expected 0 spaces before closing bracket; 1 found
    Open

                        return str_replace( "//", "/", str_replace( "\\", "/", substr( $vars, 0, -1 ) ) );

    Expected 0 spaces before closing bracket; 1 found
    Open

                        return str_replace( "//", "/", str_replace( "\\", "/", substr( $vars, 0, -1 ) ) );

    Space after opening parenthesis of function call prohibited
    Open

                        return str_replace( "//", "/", str_replace( "\\", "/", $vars ) );

    Expected 0 spaces before closing bracket; 1 found
    Open

        $name = htmlspecialchars( $name, ENT_QUOTES );

    Space after opening parenthesis of function call prohibited
    Open

        } elseif (!is_dir( $vars['TRUST_PATH'] )) {

    Space after opening parenthesis of function call prohibited
    Open

                        return str_replace( "//", "/", str_replace( "\\", "/", substr( $vars, 0, -1 ) ) );

    Space after opening parenthesis of function call prohibited
    Open

        <?php echo icmsFormField( 'TRUST_PATH',    $vars['TRUST_PATH'],    TRUST_PATH_LABEL, 255, TRUST_PATH_HELP ); ?>

    Space after opening parenthesis of function call prohibited
    Open

                        return str_replace( "//", "/", str_replace( "\\", "/", substr( $vars, 0, -1 ) ) );

    Space after opening parenthesis of function call prohibited
    Open

    <?php if (!empty( $error ) ) echo '<div class="x2-note error">' . $error . "</div>\n"; ?>

    Expected 0 spaces before closing bracket; 1 found
    Open

    if (!defined( 'ICMS_ROOT_PATH' )) {

    Expected 0 spaces before closing bracket; 1 found
    Open

        $label = htmlspecialchars( $label );

    Space after opening parenthesis of function call prohibited
    Open

                        return str_replace( "//", "/", str_replace( "\\", "/", $vars ) );

    Unexpected spaces found.
    Open

        }

    Unexpected spaces found.
    Open

            $field .= '<div class="xoform-help1">' . $help . "</div>\n";

    Unexpected spaces found.
    Open

        $maxlength = (int) $maxlength;

    Unexpected spaces found.
    Open

        die( 'Bad installation: please add this folder to the ImpressCMS install you want to upgrade');

    Unexpected spaces found.
    Open

        <button type="submit"><?php echo _SUBMIT; ?></button>

    Unexpected spaces found.
    Open

        $field .= "<input type='text' name='$name' id='$name' value='$value' />";

    Unexpected spaces found.
    Open

        $value = htmlspecialchars( $value, ENT_QUOTES );

    Unexpected spaces found.
    Open

        if ($help) {

    Unexpected spaces found.
    Open

            $error = ERR_WRONG_TRUST_PATH;

    Unexpected spaces found.
    Open

        $vars['TRUST_PATH'] = '';

    Unexpected spaces found.
    Open

        $name = htmlspecialchars( $name, ENT_QUOTES );

    Unexpected spaces found.
    Open

        $label = htmlspecialchars( $label );

    Unexpected spaces found.
    Open

            $error = ERR_NO_TRUST_PATH;

    Unexpected spaces found.
    Open

            return false;

    Unexpected spaces found.
    Open

        $field = "<label for='$name'>$label</label>\n";

    Unexpected spaces found.
    Open

        return $field;

    Unexpected spaces found.
    Open

            $error = ERR_INVALID_TRUST_PATH;

    There are no issues that match your filters.

    Category
    Status