notifme/notifme-sdk

View on GitHub

Showing 162 of 333 total issues

Function _callee$ has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        return _regenerator["default"].wrap(function _callee$(_context) {
          while (1) switch (_context.prev = _context.next) {
            case 0:
              if (!request.customize) {
                _context.next = 6;
Severity: Major
Found in lib/providers/sms/nexmo.js - About 2 hrs to fix

    Function _callee$ has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            return _regenerator["default"].wrap(function _callee$(_context) {
              while (1) switch (_context.prev = _context.next) {
                case 0:
                  if (!request.customize) {
                    _context.next = 6;
    Severity: Major
    Found in lib/providers/sms/callr.js - About 2 hrs to fix

      Function value has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          value: (function () {
            var _send = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(request) {
              var _ref2, from, to, text, response, responseBody;
              return _regenerator["default"].wrap(function _callee$(_context) {
                while (1) switch (_context.prev = _context.next) {
      Severity: Major
      Found in lib/providers/sms/46elks.js - About 2 hrs to fix

        Function value has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            value: (function () {
              var _send = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(request) {
                var _ref2, from, to, text, ttl, form, response, responseBody;
                return _regenerator["default"].wrap(function _callee$(_context) {
                  while (1) switch (_context.prev = _context.next) {
        Severity: Major
        Found in lib/providers/sms/twilio.js - About 2 hrs to fix

          Function _callee has 57 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                var _send = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(request) {
                  var _ref2, from, to, text, response, responseBody;
                  return _regenerator["default"].wrap(function _callee$(_context) {
                    while (1) switch (_context.prev = _context.next) {
                      case 0:
          Severity: Major
          Found in lib/providers/sms/46elks.js - About 2 hrs to fix

            Function _callee has 54 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  var _send = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(request) {
                    var _ref2, from, to, text, ttl, form, response, responseBody;
                    return _regenerator["default"].wrap(function _callee$(_context) {
                      while (1) switch (_context.prev = _context.next) {
                        case 0:
            Severity: Major
            Found in lib/providers/sms/twilio.js - About 2 hrs to fix

              Function _callee$ has 54 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      return _regenerator["default"].wrap(function _callee$(_context) {
                        while (1) switch (_context.prev = _context.next) {
                          case 0:
                            if (!request.customize) {
                              _context.next = 6;
              Severity: Major
              Found in lib/providers/sms/46elks.js - About 2 hrs to fix

                Function _callee$ has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        return _regenerator["default"].wrap(function _callee$(_context) {
                          while (1) switch (_context.prev = _context.next) {
                            case 0:
                              if (!request.customize) {
                                _context.next = 6;
                Severity: Major
                Found in lib/providers/sms/twilio.js - About 2 hrs to fix

                  Function value has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      value: function () {
                        var _send = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(request) {
                          var _ref, webhookUrl, rest, apiRequest, response, responseText;
                          return _regenerator["default"].wrap(function _callee$(_context) {
                            while (1) switch (_context.prev = _context.next) {
                  Severity: Minor
                  Found in lib/providers/slack/slack.js - About 1 hr to fix

                    Function value has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        value: function () {
                          var _sendOnEachChannel = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(request) {
                            var _this2 = this;
                            return _regenerator["default"].wrap(function _callee4$(_context4) {
                              while (1) switch (_context4.prev = _context4.next) {
                    Severity: Minor
                    Found in lib/sender.js - About 1 hr to fix

                      Function send has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        async send (request: EmailRequestType): Promise<string> {
                          const { id, userId, from, replyTo, subject, html, text, headers, to, cc, bcc, attachments } =
                            request.customize ? (await request.customize(this.id, request)) : request
                          const response = await fetch('https://mandrillapp.com/api/1.0/messages/send.json', {
                            method: 'POST',
                      Severity: Minor
                      Found in src/providers/email/mandrill.js - About 1 hr to fix

                        Function mergeWithDefaultConfig has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                        Open

                          mergeWithDefaultConfig ({ channels, ...rest }: OptionsType) {
                            return {
                              useNotificationCatcher: false,
                              ...rest,
                              channels: rest.useNotificationCatcher
                        Severity: Minor
                        Found in src/index.js - About 1 hr 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 value has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            value: function () {
                              var _send = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(request) {
                                var _ref, to, from, html, text, subject, replyTo, attachments;
                                return _regenerator["default"].wrap(function _callee$(_context) {
                                  while (1) switch (_context.prev = _context.next) {
                        Severity: Minor
                        Found in lib/providers/email/notificationCatcher.js - About 1 hr to fix

                          Function send has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            async send (request: EmailRequestType): Promise<string> {
                              const { id, userId, from, replyTo, subject, html, text, headers, to, cc, bcc, attachments } =
                                request.customize ? (await request.customize(this.id, request)) : request
                              const response = await fetch('https://api.sparkpost.com/api/v1/transmissions', {
                                method: 'POST',
                          Severity: Minor
                          Found in src/providers/email/sparkpost.js - About 1 hr to fix

                            Function value has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                value: function () {
                                  var _send = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(request) {
                                    var _ref, from, to, text, rest;
                                    return _regenerator["default"].wrap(function _callee$(_context) {
                                      while (1) switch (_context.prev = _context.next) {
                            Severity: Minor
                            Found in lib/providers/whatsapp/notificationCatcher.js - About 1 hr to fix

                              Function mergeWithDefaultConfig has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                mergeWithDefaultConfig ({ channels, ...rest }: OptionsType) {
                                  return {
                                    useNotificationCatcher: false,
                                    ...rest,
                                    channels: rest.useNotificationCatcher
                              Severity: Minor
                              Found in src/index.js - About 1 hr to fix

                                Function _callee has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                      var _send = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(request) {
                                        var _ref, webhookUrl, rest, apiRequest, response, responseText;
                                        return _regenerator["default"].wrap(function _callee$(_context) {
                                          while (1) switch (_context.prev = _context.next) {
                                            case 0:
                                Severity: Minor
                                Found in lib/providers/slack/slack.js - About 1 hr to fix

                                  Function _callee4 has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                        var _sendOnEachChannel = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(request) {
                                          var _this2 = this;
                                          return _regenerator["default"].wrap(function _callee4$(_context4) {
                                            while (1) switch (_context4.prev = _context4.next) {
                                              case 0:
                                  Severity: Minor
                                  Found in lib/sender.js - About 1 hr to fix

                                    Function send has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                      async send (request: EmailRequestType): Promise<string> {
                                        const { id, userId, from, replyTo, subject, html, text, headers, to, cc, bcc, attachments } =
                                          request.customize ? (await request.customize(this.id, request)) : request
                                        const generatedId = id || crypto.randomBytes(16).toString('hex')
                                        const response = await fetch('https://api.sendgrid.com/v3/mail/send', {
                                    Severity: Minor
                                    Found in src/providers/email/sendgrid.js - About 1 hr 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 value has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        value: function () {
                                          var _send = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(request) {
                                            var _ref, registrationToken, title, rest;
                                            return _regenerator["default"].wrap(function _callee$(_context) {
                                              while (1) switch (_context.prev = _context.next) {
                                    Severity: Minor
                                    Found in lib/providers/push/notificationCatcher.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language