hybridgroup/cylon-i2c

View on GitHub

Showing 7 of 78 total issues

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

Bmp180.prototype.getRawPressure = function(mode, callback) {
  var self = this;

  var modeVal = parseInt(mode, 10);

Severity: Minor
Found in lib/bmp180.js - About 1 hr to fix

    Function calculatePressure has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Bmp180.prototype.calculatePressure = function(mode, rawPress, b5) {
      var x1 = 0,
          x2 = 0,
          x3 = 0,
          b3 = 0,
    Severity: Minor
    Found in lib/bmp180.js - About 1 hr to fix

      Function getRawTemp has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      Bmp180.prototype.getRawTemp = function(callback) {
        var self = this;
      
        this.connection.i2cWrite(
          self.address,
      Severity: Minor
      Found in lib/bmp180.js - About 1 hr to fix

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

          work: function(my) {
            every((1).seconds(), function() {
              my.bmp180.getAltitude(0, null, function(err, data) {
                if (err) { console.error("Error:", err); }
                console.log(data);
        Severity: Minor
        Found in examples/bmp180/bmp180.js - About 55 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 work has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

          work: function(my) {
            every((1).second(), function() {
              my.accel.getAccel(function(err, data) {
                if (err) { console.error(err); }
                console.log(data);
        Severity: Minor
        Found in examples/lsm303dlhc/lsm303dlhc.js - About 55 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 _writeBits has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        Mpu6050.prototype._writeBits = function(func, bit, bitLength, value, callback) {
        Severity: Minor
        Found in lib/mpu6050.js - About 35 mins to fix

          Function send_byte has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          PCA9544A.prototype.send_byte = function(register, byte, callback) {
            this.connection.i2cWrite(this.address, register, [byte],
              function(err) {
                if (typeof (callback) === "function") {
                  if (err) {
          Severity: Minor
          Found in lib/pca9544a.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