Showing 11 of 52 total issues
File requests_manager.js
has 432 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
var debug = require("debug")("RequestsManager");
var request = require("request");
var HTTPStatus = require("http-status");
var async = require("neo-async");
var linkHeaderParser = require("parse-link-header");
Function devices
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
RequestsManager.prototype.devices = function (page, perPage, callback) {
var self = this;
var finished = false;
var data = [];
Function channels
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
RequestsManager.prototype.channels = function (page, perPage, callback) {
var self = this;
var finished = false;
var data = [];
Function exports
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (platform, deviceTokens, notification, callback, self) {
var platformErrors,
deviceTokenErrors,
iosMacosNotificationErrors,
safariNotificationErrors,
Function registerDeviceTokensForChannels
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function registerDeviceTokensForChannels(deviceTokens, channels, callback, self) {
var channelsErrors = Utils.validateJSONWithSchema(channels, "channels", channelsSchema);
if ( channelsErrors )
return callback(new InvalidPayloadError("Channels must be an array with at least one item or unique items of type string", channelsErrors));
Function exports
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (deviceTokens, channels, callback, self) {
var deviceTokensErrors,
channelsErrors;
var data = {
appended : [],
Function exports
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (deviceTokens, channels, callback, self) {
var deviceTokensErrors,
channelsErrors;
var data = {
replaced : [],
Function executeRequest
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function executeRequest(requestOptions, callback) {
debug("Executing request \"" + requestOptions.url + "\" ...");
request(requestOptions, function (err, res, body) {
if ( err )
Function exports
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
module.exports = function (platform, deviceTokens, notification, callback, self) {
var platformErrors,
deviceTokenErrors,
iosMacosNotificationErrors,
safariNotificationErrors,
- 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 exports
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
module.exports = function (platform, deviceTokens, notification, callback, self) {
Avoid too many return
statements within this function. Open
Open
return callback(new InvalidPayloadError("Invalid Safari notification object", safariNotificationErrors));