Showing 25 of 144 total issues
File packet.spec.js
has 643 lines of code (exceeds 250 allowed). Consider refactoring. Open
"use strict";
var Packet = lib("packet"),
utils = lib("utils");
Function sphero
has 246 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function sphero(device) {
// Sphero Virtual Device Address = 0x02
var command = device.command.bind(device, 0x02);
/**
Function custom
has 198 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function custom(device) {
function mergeMasks(id, mask, remove) {
if (remove) {
mask = utils.xor32bit(mask);
return device.ds[id] & mask;
File sphero.spec.js
has 440 lines of code (exceeds 250 allowed). Consider refactoring. Open
"use strict";
var Sphero = lib("sphero");
var Packet = lib("packet"),
File sphero.spec.js
has 439 lines of code (exceeds 250 allowed). Consider refactoring. Open
"use strict";
var mutator = lib("devices/sphero");
describe("Sphero", function() {
File custom.spec.js
has 346 lines of code (exceeds 250 allowed). Consider refactoring. Open
"use strict";
var mutator = lib("devices/custom"),
utils = lib("utils");
Function custom
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function custom(device) {
function mergeMasks(id, mask, remove) {
if (remove) {
mask = utils.xor32bit(mask);
return device.ds[id] & mask;
- Read upRead up
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 core
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function core(device) {
// Core Virtual Device Address = 0x00
var command = device.command.bind(device, 0x00);
/**
File packet.js
has 281 lines of code (exceeds 250 allowed). Consider refactoring. Open
"use strict";
var inherits = require("util").inherits,
EventEmitter = require("events").EventEmitter;
File ble.js
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
"use strict";
var util = require("util"),
EventEmitter = require("events").EventEmitter;
File sphero.js
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
"use strict";
var utils = require("../utils"),
commands = require("../commands/sphero");
Function connect
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Sphero.prototype.connect = function(callback) {
var self = this,
connection = this.connection,
packet = this.packet;
Function connect
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Sphero.prototype.connect = function(callback) {
var self = this,
connection = this.connection,
packet = this.packet;
- Read upRead up
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 _parseField
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Packet.prototype._parseField = function(field, data, pData) {
var pField;
var width;
data = data.slice(field.from, field.to);
Function _parseData
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Packet.prototype._parseData = function(parser, payload, ds) {
var data = payload.data,
pData, fields, field;
Function color
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
device.color = function(color, luminance, callback) {
var cb = callback;
switch (typeof color) {
case "number":
color = hexToRgb(color);
Function p
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
var p = new Promise(function (resolve, reject) {
connection.on("open", function() {
emit("open");
});
connection.on("close", emit("close"));
Function exports
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(grunt) {
grunt.registerTask("default", ["lint", "test"]);
grunt.registerTask("lint", "Lints code with ESLint", function() {
var lint = new ESLint(),
Function _parseData
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Packet.prototype._parseData = function(parser, payload, ds) {
var data = payload.data,
pData, fields, field;
- Read upRead up
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 parse
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Packet.prototype.parse = function(buffer) {
if (this.partialBuffer.length > 0) {
buffer = Buffer.concat(
[this.partialBuffer, buffer],
buffer.length + this.partialBuffer.length
- Read upRead up
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"