juanmard/icestudio

View on GitHub
services/project.js

Summary

Maintainability
F
4 days
Test Coverage

File project.js has 684 lines of code (exceeds 250 allowed). Consider refactoring.
Open

angular
  .module('icestudio')
  .service(
    'project',
    function (
Severity: Major
Found in services/project.js - About 1 day to fix

    Function load has 86 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          this.load = function (name, data) {
            var self = this;
            if (!checkVersion(data.version)) {
              return;
            }
    Severity: Major
    Found in services/project.js - About 3 hrs to fix

      Function convertTo10 has 77 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            function convertTo10(data, name) {
              var project = {
                version: '1.0',
                package: {
                  name: name || '',
      Severity: Major
      Found in services/project.js - About 3 hrs to fix

        Function save has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              this.save = function (filepath, callback) {
                var backupProject = false;
                var name = common.basename(filepath);
                if (common.isEditingSubmodule) {
                  backupProject = utils.clone(project);
        Severity: Major
        Found in services/project.js - About 2 hrs to fix

          Function _addBlockFile has 55 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                function _addBlockFile(self, orig, name, data, notify) {
                  function _importBlock() {
                    self.addBlock(block);
                    if (notify) {
                      alertify.success(
          Severity: Major
          Found in services/project.js - About 2 hrs to fix

            Function _load has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    function _load(reset, originalBoard) {
                      common.allDependencies = project.dependencies;
                      var opt = {reset: reset || false, disabled: false};
                      if (originalBoard !== undefined && originalBoard !== false) {
                        for (var i = 0; i < common.boards.length; i++) {
            Severity: Minor
            Found in services/project.js - About 1 hr to fix

              Function copyIncludedFiles has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    function copyIncludedFiles(files, origPath, destPath, callback) {
                      var success = true;
                      async.eachSeries(
                        files,
                        function (filename, next) {
              Severity: Minor
              Found in services/project.js - About 1 hr to fix

                Function pruneProject has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      function pruneProject(project) {
                        var _project = utils.clone(project);
                
                        _prune(_project);
                        for (var d in _project.dependencies) {
                Severity: Minor
                Found in services/project.js - About 1 hr to fix

                  Function _addBlockFile has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                        function _addBlockFile(self, orig, name, data, notify) {
                  Severity: Minor
                  Found in services/project.js - About 35 mins to fix

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

                            cells = _.sortBy(cells, function (cell) {
                              if (
                                cell.get('type') === 'ice.Constant' ||
                                cell.get('type') === 'ice.Memory'
                              ) {
                    Severity: Major
                    Found in services/project.js and 1 other location - About 2 hrs to fix
                    controllers/design.js on lines 82..89

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

                    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

                            cells = _.sortBy(cells, function (cell) {
                              if (
                                cell.get('type') === 'ice.Input' ||
                                cell.get('type') === 'ice.Output'
                              ) {
                    Severity: Major
                    Found in services/project.js and 1 other location - About 1 hr to fix
                    controllers/design.js on lines 91..98

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

                    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

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

                                  for (var o in block.data.ports.out) {
                                    outPorts.push({
                                      name: block.data.ports.out[o],
                                    });
                                  }
                    Severity: Major
                    Found in services/project.js and 1 other location - About 1 hr to fix
                    services/project.js on lines 336..340

                    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

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

                                  for (var i in block.data.ports.in) {
                                    inPorts.push({
                                      name: block.data.ports.in[i],
                                    });
                                  }
                    Severity: Major
                    Found in services/project.js and 1 other location - About 1 hr to fix
                    services/project.js on lines 343..347

                    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

                    There are no issues that match your filters.

                    Category
                    Status