yoichiro/chrome_mysql_admin

View on GitHub
app/scripts/window/controllers/edit_column_dialog_controller.js

Summary

Maintainability
F
4 days
Test Coverage

Function editColumn has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    $scope.editColumn = function() {
        if ($scope.type === "SET" || $scope.type === "ENUM") {
            if ($scope.setEnumValues.length === 0) {
                $scope.errorMessage = "SET/ENUM type column must have one or more values.";
                return;
Severity: Major
Found in app/scripts/window/controllers/edit_column_dialog_controller.js - About 2 hrs to fix

    File edit_column_dialog_controller.js has 262 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    chromeMyAdmin.controller("EditColumnDialogController", function(
        $scope,
        Events,
        mySQLClientService,
        $q,
    Severity: Minor
    Found in app/scripts/window/controllers/edit_column_dialog_controller.js - About 2 hrs to fix

      Function onShowDialog has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          var onShowDialog = function(table, columnDefs, columnStructure) {
              resetErrorMessage();
              $scope.selectedTable = table;
              $scope.originalColumnDefs = columnDefs;
              $scope.originalColumnStructure = columnStructure;
      Severity: Minor
      Found in app/scripts/window/controllers/edit_column_dialog_controller.js - About 1 hr to fix

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

                mySQLClientService.query(sql).then(function(result) {
                    if (result.hasResultsetRows) {
                        $scope.fatalErrorOccurred("Editing column failed.");
                    } else {
                        $("#editColumnDialog").modal("hide");
        app/scripts/window/controllers/add_column_dialog_controller.js on lines 136..149
        app/scripts/window/controllers/add_index_dialog_controller.js on lines 123..136
        app/scripts/window/controllers/add_relation_dialog_controller.js on lines 141..154
        app/scripts/window/controllers/create_database_dialog_controller.js on lines 38..51
        app/scripts/window/controllers/create_routine_dialog_controller.js on lines 112..125
        app/scripts/window/controllers/insert_row_dialog_controller.js on lines 86..99
        app/scripts/window/controllers/update_row_dialog_controller.js on lines 101..114

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

        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

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

            var getTypeName = function(type) {
                var result = "";
                var b = type.indexOf("(");
                var s = type.indexOf(" ");
                if (b !== -1) {
        app/scripts/window/services/export_all_databases_service.js on lines 240..252

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

        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

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

                if ($scope.defaultValue) {
                    if (typeService.isNumeric($scope.type)
                        || $scope.type == 'TIMESTAMP' && $scope.defaultValue == "CURRENT_TIMESTAMP"
                    ) {
                        sql += "DEFAULT " + $scope.defaultValue + " ";
        app/scripts/window/controllers/add_column_dialog_controller.js on lines 113..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 104.

        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

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

                if ($scope.extra !== "NONE") {
                    sql += $scope.extra;
                    if ($scope.extra === "AUTO_INCREMENT") {
                        if ($scope.key === "PRIMARY") {
                            sql += " PRIMARY KEY";
        app/scripts/window/controllers/add_column_dialog_controller.js on lines 125..134

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

        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

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

            var setupItems = function() {
                $scope.types = typeService.getTypes();
                $scope.type = "VARCHAR";
                $scope.extras = ["NONE", "AUTO_INCREMENT",
                                 "ON UPDATE CURRENT_TIMESTAMP", "SERIAL DEFAULT VALUE"];
        app/scripts/window/controllers/add_column_dialog_controller.js on lines 39..47

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

        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

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

            $scope.addSetEnumValue = function() {
                if ($scope.setEnumValue && $scope.setEnumValues.indexOf($scope.setEnumValue) === -1) {
                    $scope.setEnumValues.push($scope.setEnumValue);
                }
                $scope.setEnumValue = "";
        app/scripts/window/controllers/add_column_dialog_controller.js on lines 164..169

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

        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

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

            $scope.deleteSetEnumValue = function(value) {
                var index = $scope.setEnumValues.indexOf(value);
                if (index !== -1) {
                    $scope.setEnumValues.splice(index, 1);
                }
        app/scripts/window/controllers/add_column_dialog_controller.js on lines 171..176

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

        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

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

                if ($scope.type === "SET" || $scope.type === "ENUM") {
                    if ($scope.setEnumValues.length === 0) {
                        $scope.errorMessage = "SET/ENUM type column must have one or more values.";
                        return;
                    }
        app/scripts/window/controllers/add_column_dialog_controller.js on lines 77..82

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

        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

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

                if (typeService.isString($scope.type)) {
                    sql += "CHARACTER SET " + $scope.characterSet + " ";
                    sql += "COLLATE " + $scope.collation + " ";
                    if ($scope.binary) {
                        sql += "BINARY ";
        app/scripts/window/controllers/add_column_dialog_controller.js on lines 93..106

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

        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

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

                if ($scope.type === "SET" || $scope.type === "ENUM") {
                    sql += "(" + sqlExpressionService.createStringArray($scope.setEnumValues) + ")";
                }
        Severity: Minor
        Found in app/scripts/window/controllers/edit_column_dialog_controller.js and 1 other location - About 55 mins to fix
        app/scripts/window/controllers/add_column_dialog_controller.js on lines 89..91

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

        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

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

                if (!$scope.allowNull) {
                    sql += "NOT NULL ";
                } else if ($scope.type == 'TIMESTAMP' && $scope.allowNull) {
                    sql += "NULL ";
                }
        Severity: Minor
        Found in app/scripts/window/controllers/edit_column_dialog_controller.js and 1 other location - About 50 mins to fix
        app/scripts/window/controllers/add_column_dialog_controller.js on lines 108..112

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

        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

        There are no issues that match your filters.

        Category
        Status