juanmard/icestudio

View on GitHub

Showing 447 of 447 total issues

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

          if ((block.data.range || '') !== (portInfo.rangestr || '')) {
            var pins = getPins(portInfo);
            oldSize = block.data.pins ? block.data.pins.length : 1;
            oldSize = block.data.virtual ? 1 : oldSize;
            newSize = virtual ? 1 : pins ? pins.length : 1;
Severity: Major
Found in services/blocks.js and 1 other location - About 1 day to fix
services/blocks.js on lines 1491..1543

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

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

Function ICEpm has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring.
Open

var ICEpm = new (function () {
  'use strict';

  this.pluginDir = false;
  this.pluginUri = false;
Severity: Minor
Found in iceplugmanager.js - About 1 day to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

    chrome.serial.connect(
      this.devices[id].path,
      options,
      function (connectionInfo) {
        if (
Severity: Major
Found in plugins/icerok/js/SerialManager.js and 1 other location - About 1 day to fix
plugins/serial-term/js/main.js on lines 74..103

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

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

    chrome.serial.connect(
      this.devices[id].path,
      options,
      function (connectionInfo) {
        if (
Severity: Major
Found in plugins/serial-term/js/main.js and 1 other location - About 1 day to fix
plugins/icerok/js/SerialManager.js on lines 63..93

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

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

    this.editor.session.on('change', function (delta) {
      if (!self.updating) {
        // Check consecutive-change interval
        if (Date.now() - self.counter < undoGroupingInterval) {
          clearTimeout(self.timer);
Severity: Major
Found in graphics/joint.shapes.js and 2 other locations - About 1 day to fix
graphics/joint.shapes.js on lines 1646..1667
graphics/joint.shapes.js on lines 2387..2408

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

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

    this.editor.session.on('change', function (delta) {
      if (!self.updating) {
        // Check consecutive-change interval
        if (Date.now() - self.counter < undoGroupingInterval) {
          clearTimeout(self.timer);
Severity: Major
Found in graphics/joint.shapes.js and 2 other locations - About 1 day to fix
graphics/joint.shapes.js on lines 1646..1667
graphics/joint.shapes.js on lines 1940..1961

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

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

    this.editor.session.on('change', function (delta) {
      if (!self.updating) {
        // Check consecutive-change interval
        if (Date.now() - self.counter < undoGroupingInterval) {
          clearTimeout(self.timer);
Severity: Major
Found in graphics/joint.shapes.js and 2 other locations - About 1 day to fix
graphics/joint.shapes.js on lines 1940..1961
graphics/joint.shapes.js on lines 2387..2408

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

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

Function updateBifurcations has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
Open

  updateBifurcations: function () {
    'use strict';

    if (this._V.markerBifurcations) {
      var self = this;
Severity: Minor
Found in graphics/joint.shapes.js - About 1 day to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

File utils.js has 605 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

    Function exports has 211 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function (grunt) {
      'use strict';
    
      var platforms = [];
      var distCommands = [];
    Severity: Major
    Found in gruntfile.js - About 1 day to fix

      Function updateBox has 202 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        updateBox: function () {
          'use strict';
      
          var pendingTasks = [];
          var i, j, port, portDefault, tokId, paths, rects, dome, anotations;
      Severity: Major
      Found in graphics/joint.shapes.js - About 1 day to fix

        Function newBasicCode has 186 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function newBasicCode(callback, block) {
              var blockInstance = {
                id: null,
                data: {
                  code: '',
        Severity: Major
        Found in services/blocks.js - About 7 hrs to fix

          Function updateBox has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
          Open

            updateBox: function () {
              'use strict';
          
              var pendingTasks = [];
              var i, j, port, portDefault, tokId, paths, rects, dome, anotations;
          Severity: Minor
          Found in graphics/joint.shapes.js - About 7 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function updateBox has 182 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            updateBox: function () {
              'use strict';
          
              var pendingTasks = [];
              var i, j, port;
          Severity: Major
          Found in graphics/joint.shapes.js - About 7 hrs to fix

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

                      if (lin.type === 'basic.inputLabel') {
                        for (widx in graph.wires) {
                          vw = graph.wires[widx];
                          if (vw.target.block === lin.id) {
                            if (typeof vwiresLut[lin.data.name] === 'undefined') {
            Severity: Major
            Found in services/compiler.js and 1 other location - About 7 hrs to fix
            services/compiler.js on lines 238..254

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

            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

                      if (lin.type === 'basic.outputLabel') {
                        for (widx in graph.wires) {
                          vw = graph.wires[widx];
                          if (vw.source.block === lin.id) {
                            if (typeof vwiresLut[lin.data.name] === 'undefined') {
            Severity: Major
            Found in services/compiler.js and 1 other location - About 7 hrs to fix
            services/compiler.js on lines 222..237

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

            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

            Function getContent has 172 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function getContent(name, project) {
                  var i, j, w;
                  var content = [];
                  var graph = project.design.graph;
                  var connections = {
            Severity: Major
            Found in services/compiler.js - About 6 hrs to fix

              Function graphToCells has 161 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    function graphToCells(_graph, opt) {
                      // Options:
                      // - new: assign a new id to all the cells
                      // - reset: clear I/O blocks values
                      // - disabled: set disabled flag to the blocks
              Severity: Major
              Found in services/graph.js - About 6 hrs to fix

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

                    function loadBasicInput(instance, disabled) {
                      var data = instance.data;
                      var rightPorts = [
                        {
                          id: 'out',
                Severity: Major
                Found in services/blocks.js and 2 other locations - About 6 hrs to fix
                services/blocks.js on lines 815..836
                services/blocks.js on lines 838..858

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

                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

                    function loadBasicOutputLabel(instance, disabled) {
                      var data = instance.data;
                      var rightPorts = [
                        {
                          id: 'outlabel',
                Severity: Major
                Found in services/blocks.js and 2 other locations - About 6 hrs to fix
                services/blocks.js on lines 791..813
                services/blocks.js on lines 838..858

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

                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

                Severity
                Category
                Status
                Source
                Language