hybridgroup/cylon-beaglebone

View on GitHub

Showing 8 of 27 total issues

File beaglebone.js has 283 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Cylonjs Beaglebone adaptor
 * http://cylonjs.com
 *
 * Copyright (c) 2013-2014 The Hybrid Group
Severity: Minor
Found in lib/beaglebone.js - About 2 hrs to fix

    Function connect has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    PwmPin.prototype.connect = function() {
      var am33xx;
    
      this.on("error", function(err) {
        err.count = ++this.errCount;
    Severity: Minor
    Found in lib/pwm-pin.js - About 1 hr to fix

      Function _muxPin has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      Beaglebone.prototype._muxPin = function(type, args) {
        var pin, gpioPinNum;
      
        switch (type) {
          case "pwm":
      Severity: Minor
      Found in lib/beaglebone.js - About 1 hr to fix

        Function pwmWrite has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        Beaglebone.prototype.pwmWrite = function(pin, scaledDuty, freq, pw, event, cb) {
        Severity: Minor
        Found in lib/beaglebone.js - About 45 mins to fix

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

          Beaglebone.prototype._pwmWrite = function(pinNum, period, duty, eName, cb) {
          Severity: Minor
          Found in lib/beaglebone.js - About 35 mins to fix

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

            Beaglebone.prototype.servoWrite = function(pin, scaledDuty, freq, pw, cb) {
            Severity: Minor
            Found in lib/beaglebone.js - About 35 mins to fix

              Function work has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                work: function(my) {
                  my.blinkm.stopScript();
              
                  my.blinkm.getFirmware(function(err, version) {
                    if (err) { console.error(err); }
              Severity: Minor
              Found in examples/blinkm/blinkm.js - About 35 mins 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 connect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              PwmPin.prototype.connect = function() {
                var am33xx;
              
                this.on("error", function(err) {
                  err.count = ++this.errCount;
              Severity: Minor
              Found in lib/pwm-pin.js - About 25 mins 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