hybridgroup/cylon

View on GitHub

Showing 35 of 35 total issues

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

        if ((Math.abs(hand.palmNormal[2]) > DIRECTION_THRESHOLD)) {
          if (hand.palmNormal[2] > 0) {
            value = Math.abs(
              Math.round(hand.palmNormal[2] * 10 + DIRECTION_THRESHOLD) *
              DIRECTION_SPEED_FACTOR
Severity: Major
Found in examples/leap_ardrone/leap_ardrone.js and 1 other location - About 7 hrs to fix
examples/leap_ardrone/leap_ardrone.js on lines 145..163

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

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 (Math.abs(hand.palmNormal[0]) > DIRECTION_THRESHOLD) {
          if (hand.palmNormal[0] > 0) {
            value = Math.abs(
              Math.round(hand.palmNormal[0] * 10 + DIRECTION_THRESHOLD) *
              DIRECTION_SPEED_FACTOR
Severity: Major
Found in examples/leap_ardrone/leap_ardrone.js and 1 other location - About 7 hrs to fix
examples/leap_ardrone/leap_ardrone.js on lines 124..142

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

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 work has 107 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  work: function(my) {
    my.keyboard.on("right", my.drone.rightFlip);
    my.keyboard.on("left", my.drone.leftFlip);
    my.keyboard.on("up", my.drone.frontFlip);
    my.keyboard.on("down", my.drone.backFlip);
Severity: Major
Found in examples/leap_ardrone/leap_ardrone.js - About 4 hrs to fix

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

      robot.on("ready", function() {
        robot.born();
    
        robot.sphero.on("collision", function() {
          robot.contacts += 1;
    Severity: Major
    Found in examples/conway_sphero/fluent-conway_sphero.js and 1 other location - About 4 hrs to fix
    examples/conway_sphero/conway_sphero.js on lines 29..45

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

    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

        work: function(my) {
          my.born();
    
          my.sphero.on("collision", function() {
            my.contacts += 1;
    Severity: Major
    Found in examples/conway_sphero/conway_sphero.js and 1 other location - About 4 hrs to fix
    examples/conway_sphero/fluent-conway_sphero.js on lines 75..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 117.

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

      connections: {
        sfcon: {
          adaptor: "force",
          sfuser: process.env.SF_USERNAME,
          sfpass: process.env.SF_SECURITY_TOKEN,
    Severity: Major
    Found in examples/salesforce/salesforce.js and 2 other locations - About 2 hrs to fix
    examples/sf-sphero/sf-sphero.js on lines 8..19
    examples/sphero-pebble-sf/sphero-pebble-sf.js on lines 32..43

    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

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

      connections: {
        sfcon: {
          adaptor: "force",
          sfuser: process.env.SF_USERNAME,
          sfpass: process.env.SF_SECURITY_TOKEN,
    Severity: Major
    Found in examples/sf-sphero/sf-sphero.js and 2 other locations - About 2 hrs to fix
    examples/salesforce/salesforce.js on lines 6..17
    examples/sphero-pebble-sf/sphero-pebble-sf.js on lines 32..43

    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

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

      connections: {
        sfcon: {
          adaptor: "force",
          sfuser: process.env.SF_USERNAME,
          sfpass: process.env.SF_SECURITY_TOKEN,
    Severity: Major
    Found in examples/sphero-pebble-sf/sphero-pebble-sf.js and 2 other locations - About 2 hrs to fix
    examples/salesforce/salesforce.js on lines 6..17
    examples/sf-sphero/sf-sphero.js on lines 8..19

    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

    Function extend has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    function extend(base, source) {
      var isArray = Array.isArray(source);
    
      if (base == null) {
        base = isArray ? [] : {};
    Severity: Minor
    Found in lib/utils/helpers.js - About 1 hr 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

      ["connection", "device"].map(function(key) {
        var single = hasProp(opts, key),
            plural = hasProp(opts, key + "s");
    
        if (single && !plural) {
    Severity: Major
    Found in lib/validator.js and 1 other location - About 1 hr to fix
    lib/validator.js on lines 31..42

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

    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

    checks.singleObjectSyntax = function(opts, key) {
      var single = hasProp(opts, key),
          plural = hasProp(opts, key + "s");
    
      if (single && !plural) {
    Severity: Major
    Found in lib/validator.js and 1 other location - About 1 hr to fix
    lib/validator.js on lines 45..56

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

    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 Robot has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var Robot = module.exports = function Robot(opts) {
      Utils.classCallCheck(this, Robot);
    
      opts = opts || {};
    
    
    Severity: Minor
    Found in lib/robot.js - About 1 hr to fix

      Function Robot has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      var Robot = module.exports = function Robot(opts) {
        Utils.classCallCheck(this, Robot);
      
        opts = opts || {};
      
      
      Severity: Minor
      Found in lib/robot.js - About 1 hr 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 work has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

        work: function(my) {
          my.keyboard.on("right", my.drone.rightFlip);
          my.keyboard.on("left", my.drone.leftFlip);
          my.keyboard.on("up", my.drone.frontFlip);
          my.keyboard.on("down", my.drone.backFlip);
      Severity: Minor
      Found in examples/leap_ardrone/leap_ardrone.js - About 1 hr 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 install has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports.install = function() {
        /**
         * Multiplies a number by 60000 to convert minutes
         * to milliseconds
         *
      Severity: Minor
      Found in lib/utils/monkey-patches.js - About 1 hr to fix

        Function work has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          work: function(my) {
            var max = 0;
            var changingColor = false;
        
            my.sphero.setDataStreaming(["velocity"], { n: 40, m: 1, pcnt: 0 });
        Severity: Minor
        Found in examples/sphero_shakeometer/sphero_shakeometer.js - About 1 hr to fix

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

          module.exports = function Initializer(type, opts) {
            var mod;
          
            mod = Registry.findBy(type, opts[type]);
          
          
          Severity: Minor
          Found in lib/initializer.js - About 1 hr to fix

            Function start has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            Robot.prototype.start = function(callback) {
              if (this.running) {
                return this;
              }
            
            
            Severity: Minor
            Found in lib/robot.js - About 1 hr to fix

              Function reduce has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              function reduce(collection, iteratee, accumulator, thisVal) {
                var isArray = H.isArray(collection);
              
                if (!isArray && !H.isObjectLoose(collection)) {
                  return null;
              Severity: Minor
              Found in lib/utils/helpers.js - About 1 hr 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 create has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              api.create = function create(Server, opts) {
                // if only passed options (or nothing), assume HTTP server
                if (Server == null || _.isObject(Server) && !_.isFunction(Server)) {
                  opts = Server;
                  Server = "http";
              Severity: Minor
              Found in lib/api.js - About 1 hr 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

              Severity
              Category
              Status
              Source
              Language