linitix/nzero-push

View on GitHub

Showing 11 of 52 total issues

File requests_manager.js has 432 lines of code (exceeds 250 allowed). Consider refactoring.
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");
Severity: Minor
Found in lib/common/requests_manager.js - About 6 hrs to fix

    Function devices has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    RequestsManager.prototype.devices = function (page, perPage, callback) {
      var self     = this;
      var finished = false;
      var data     = [];
    
    
    Severity: Minor
    Found in lib/common/requests_manager.js - About 1 hr to fix

      Function channels has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      RequestsManager.prototype.channels = function (page, perPage, callback) {
        var self     = this;
        var finished = false;
        var data     = [];
      
      
      Severity: Minor
      Found in lib/common/requests_manager.js - About 1 hr to fix

        Function exports has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = function (platform, deviceTokens, notification, callback, self) {
          var platformErrors,
              deviceTokenErrors,
              iosMacosNotificationErrors,
              safariNotificationErrors,
        Severity: Minor
        Found in lib/endpoints/notify_endpoint.js - About 1 hr to fix

          Function registerDeviceTokensForChannels has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          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));
          Severity: Minor
          Found in lib/endpoints/register_endpoint.js - About 1 hr to fix

            Function exports has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            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

              module.exports = function (deviceTokens, channels, callback, self) {
                var deviceTokensErrors,
                    channelsErrors;
                var data = {
                  replaced   : [],
              Severity: Minor
              Found in lib/endpoints/replace_channel_subscriptions_for_devices_endpoint.js - About 1 hr to fix

                Function executeRequest has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function executeRequest(requestOptions, callback) {
                  debug("Executing request \"" + requestOptions.url + "\" ...");
                
                  request(requestOptions, function (err, res, body) {
                    if ( err )
                Severity: Minor
                Found in lib/common/requests_manager.js - About 1 hr to fix

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

                  module.exports = function (platform, deviceTokens, notification, callback, self) {
                    var platformErrors,
                        deviceTokenErrors,
                        iosMacosNotificationErrors,
                        safariNotificationErrors,
                  Severity: Minor
                  Found in lib/endpoints/notify_endpoint.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 exports has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  module.exports = function (platform, deviceTokens, notification, callback, self) {
                  Severity: Minor
                  Found in lib/endpoints/notify_endpoint.js - About 35 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return callback(new InvalidPayloadError("Invalid Safari notification object", safariNotificationErrors));
                    Severity: Major
                    Found in lib/endpoints/notify_endpoint.js - About 30 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language