midasplatform/Midas

View on GitHub
core/controllers/forms/MigrateForm.php

Summary

Maintainability
B
4 hrs
Test Coverage

Method createMigrateForm has 81 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function createMigrateForm($assetstores)
    {
        // Setup the form
        $form = new Zend_Form();
        $form->setAction('migratemidas2');
Severity: Major
Found in core/controllers/forms/MigrateForm.php - About 3 hrs to fix

The method createMigrateForm() has 102 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public function createMigrateForm($assetstores)
    {
        // Setup the form
        $form = new Zend_Form();
        $form->setAction('migratemidas2');

Missing class import via use statement (line '50', column '28').
Open

        $midas2_user = new Zend_Form_Element_Text(

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '117', column '46').
Open

        $assetstore->setValidators(array(new Zend_Validate_GreaterThan(array('min' => 0))));

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '42', column '28').
Open

        $midas2_port = new Zend_Form_Element_Text(

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '122', column '23').
Open

        $submit = new Zend_Form_Element_Button('migratesubmit', $this->t('Migrate'));

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '71', column '34').
Open

        $midas2_assetstore = new Zend_Form_Element_Text(

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '100', column '27').
Open

        $assetstore = new Zend_Form_Element_Select('assetstore');

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '28', column '21').
Open

        $form = new Zend_Form();

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '47', column '47').
Open

        $midas2_port->setValidators(array(new Zend_Validate_Digits()));

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '57', column '32').
Open

        $midas2_password = new Zend_Form_Element_Password(

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '35', column '32').
Open

        $midas2_hostname = new Zend_Form_Element_Text(

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '64', column '32').
Open

        $midas2_database = new Zend_Form_Element_Text(

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '79', column '41').
Open

        $midas2_assetstore_button = new Zend_Form_Element_Button('midas2_assetstore_button', $this->t('Choose'));

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

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

        $assetstore->setDescription(
            ' <a class="load-newassetstore" href="#newassetstore-form" rel="#newassetstore-form" title="'.$this->t(
                'Add a new assetstore'
            ).'"> '.$this->t('Add a new assetstore').'</a>'
        )->setDecorators(
Severity: Major
Found in core/controllers/forms/MigrateForm.php and 1 other location - About 1 hr to fix
core/controllers/forms/ImportForm.php on lines 92..104

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

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

Avoid excessively long variable names like $midas2_assetstore_button. Keep variable name length under 20.
Open

        $midas2_assetstore_button = new Zend_Form_Element_Button('midas2_assetstore_button', $this->t('Choose'));

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class MigrateForm extends AppForm

The variable $midas2_database is not named in camelCase.
Open

    public function createMigrateForm($assetstores)
    {
        // Setup the form
        $form = new Zend_Form();
        $form->setAction('migratemidas2');

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $midas2_assetstore_button is not named in camelCase.
Open

    public function createMigrateForm($assetstores)
    {
        // Setup the form
        $form = new Zend_Form();
        $form->setAction('migratemidas2');

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $midas2_port is not named in camelCase.
Open

    public function createMigrateForm($assetstores)
    {
        // Setup the form
        $form = new Zend_Form();
        $form->setAction('migratemidas2');

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $midas2_assetstore_button is not named in camelCase.
Open

    public function createMigrateForm($assetstores)
    {
        // Setup the form
        $form = new Zend_Form();
        $form->setAction('migratemidas2');

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $midas2_hostname is not named in camelCase.
Open

    public function createMigrateForm($assetstores)
    {
        // Setup the form
        $form = new Zend_Form();
        $form->setAction('migratemidas2');

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $midas2_password is not named in camelCase.
Open

    public function createMigrateForm($assetstores)
    {
        // Setup the form
        $form = new Zend_Form();
        $form->setAction('migratemidas2');

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $midas2_port is not named in camelCase.
Open

    public function createMigrateForm($assetstores)
    {
        // Setup the form
        $form = new Zend_Form();
        $form->setAction('migratemidas2');

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $midas2_database is not named in camelCase.
Open

    public function createMigrateForm($assetstores)
    {
        // Setup the form
        $form = new Zend_Form();
        $form->setAction('migratemidas2');

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $midas2_assetstore is not named in camelCase.
Open

    public function createMigrateForm($assetstores)
    {
        // Setup the form
        $form = new Zend_Form();
        $form->setAction('migratemidas2');

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $midas2_assetstore is not named in camelCase.
Open

    public function createMigrateForm($assetstores)
    {
        // Setup the form
        $form = new Zend_Form();
        $form->setAction('migratemidas2');

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $midas2_user is not named in camelCase.
Open

    public function createMigrateForm($assetstores)
    {
        // Setup the form
        $form = new Zend_Form();
        $form->setAction('migratemidas2');

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $midas2_user is not named in camelCase.
Open

    public function createMigrateForm($assetstores)
    {
        // Setup the form
        $form = new Zend_Form();
        $form->setAction('migratemidas2');

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $midas2_user is not named in camelCase.
Open

    public function createMigrateForm($assetstores)
    {
        // Setup the form
        $form = new Zend_Form();
        $form->setAction('migratemidas2');

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $midas2_hostname is not named in camelCase.
Open

    public function createMigrateForm($assetstores)
    {
        // Setup the form
        $form = new Zend_Form();
        $form->setAction('migratemidas2');

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $midas2_port is not named in camelCase.
Open

    public function createMigrateForm($assetstores)
    {
        // Setup the form
        $form = new Zend_Form();
        $form->setAction('migratemidas2');

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $midas2_password is not named in camelCase.
Open

    public function createMigrateForm($assetstores)
    {
        // Setup the form
        $form = new Zend_Form();
        $form->setAction('migratemidas2');

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $midas2_hostname is not named in camelCase.
Open

    public function createMigrateForm($assetstores)
    {
        // Setup the form
        $form = new Zend_Form();
        $form->setAction('migratemidas2');

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $midas2_password is not named in camelCase.
Open

    public function createMigrateForm($assetstores)
    {
        // Setup the form
        $form = new Zend_Form();
        $form->setAction('migratemidas2');

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $midas2_database is not named in camelCase.
Open

    public function createMigrateForm($assetstores)
    {
        // Setup the form
        $form = new Zend_Form();
        $form->setAction('migratemidas2');

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $midas2_assetstore_button is not named in camelCase.
Open

    public function createMigrateForm($assetstores)
    {
        // Setup the form
        $form = new Zend_Form();
        $form->setAction('migratemidas2');

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $midas2_port is not named in camelCase.
Open

    public function createMigrateForm($assetstores)
    {
        // Setup the form
        $form = new Zend_Form();
        $form->setAction('migratemidas2');

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $midas2_assetstore is not named in camelCase.
Open

    public function createMigrateForm($assetstores)
    {
        // Setup the form
        $form = new Zend_Form();
        $form->setAction('migratemidas2');

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

There are no issues that match your filters.

Category
Status