juanmard/icestudio

View on GitHub
controllers/menu.js

Summary

Maintainability
F
5 days
Test Coverage

File menu.js has 981 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable camelcase */

angular
  .module('icestudio')
  .controller(
Severity: Major
Found in controllers/menu.js - About 2 days to fix

    Function _setProjectInformation has 126 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          function _setProjectInformation() {
            var values = getProjectInformation();
    
            var i;
            var content = [];
    Severity: Major
    Found in controllers/menu.js - About 5 hrs to fix

      Function about has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            $scope.about = function () {
              alerts.alert({
                icon: 'heart-o',
                title: 'Icestudio, visual editor for Verilog designs',
                body: $('#about')[0],
      Severity: Minor
      Found in controllers/menu.js - About 1 hr to fix

        Function _selectBoard has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              function _selectBoard(name) {
                let board = undefined;
                for (const val of common.boards) {
                  if (val.name === name) {
                    board = val;
        Severity: Minor
        Found in controllers/menu.js - About 1 hr to fix

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

                    onok: function () {
                      if (canCheckVersion) {
                        // checkForNewVersion
                        $.getJSON(
                          _package.repository.replace(
          Severity: Minor
          Found in controllers/menu.js - About 1 hr to fix

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

                  $scope.buildCode = function () {
                    if (common.isEditingSubmodule) {
                      alerts.alert({
                        icon: 'gear',
                        title: _tcStr('Building submodules is not supported yet'),
            Severity: Major
            Found in controllers/menu.js and 1 other location - About 4 hrs to fix
            controllers/menu.js on lines 950..971

            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

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

                  $scope.uploadCode = function () {
                    if (common.isEditingSubmodule) {
                      alerts.alert({
                        icon: 'rocket',
                        title: _tcStr('Uploading submodules is not supported yet'),
            Severity: Major
            Found in controllers/menu.js and 1 other location - About 4 hrs to fix
            controllers/menu.js on lines 930..948

            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

                  function _openWindow(url, title) {
                    $log.log(url);
                    return gui.Window.open(url, {
                      title: title,
                      focus: true,
            Severity: Major
            Found in controllers/menu.js and 1 other location - About 2 hrs to fix
            controllers/preferences.js on lines 207..220

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

            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 3 locations. Consider refactoring.
            Open

                      gui.Window.open('viewers/table/rules.html?rules=' + encRules, {
                        title: common.selectedBoard.info.label + ' - Rules',
                        focus: true,
                        // toolbar: false,
                        resizable: false,
            Severity: Major
            Found in controllers/menu.js and 2 other locations - About 1 hr to fix
            controllers/menu.js on lines 736..746
            controllers/menu.js on lines 766..776

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

            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 3 locations. Consider refactoring.
            Open

                      {
                        title: common.selectedBoard.info.label + ' - PCF',
                        focus: true,
                        //toolbar: false,
                        resizable: true,
            Severity: Major
            Found in controllers/menu.js and 2 other locations - About 1 hr to fix
            controllers/menu.js on lines 766..776
            controllers/menu.js on lines 806..816

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

            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 3 locations. Consider refactoring.
            Open

                      gui.Window.open('viewers/svg/pinout.html?board=' + board.name, {
                        title: common.selectedBoard.info.label + ' - Pinout',
                        focus: true,
                        //toolbar: false,
                        resizable: true,
            Severity: Major
            Found in controllers/menu.js and 2 other locations - About 1 hr to fix
            controllers/menu.js on lines 736..746
            controllers/menu.js on lines 806..816

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

            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