notifme/notifme-sdk

View on GitHub

Showing 162 of 333 total issues

Function factory has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function factory(_ref) {
  var type = _ref.type,
    config = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
  switch (type) {
    // Development
Severity: Minor
Found in lib/providers/sms/index.js - About 1 hr to fix

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

      async send (request: SmsRequestType): Promise<string> {
        const { from, to, text, type, ttl, messageClass } =
          request.customize ? (await request.customize(this.id, request)) : request
        const response = await fetch('https://rest.nexmo.com/sms/json', {
          method: 'POST',
    Severity: Minor
    Found in src/providers/sms/nexmo.js - About 1 hr to fix

      Function channel has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            acc[channel] = _this.providers[channel].length > 0 ? strategies[channel](_this.providers[channel]) : ( /*#__PURE__*/function () {
              var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(request) {
                var provider;
                return _regenerator["default"].wrap(function _callee$(_context) {
                  while (1) switch (_context.prev = _context.next) {
      Severity: Minor
      Found in lib/sender.js - About 1 hr to fix

        Function _callee$ has 28 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:
                  _providers = (0, _toArray2["default"])(providers), current = _providers[0], others = _providers.slice(1);
                  _context.prev = 1;
        Severity: Minor
        Found in lib/strategies/providers/fallback.js - About 1 hr to fix

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

                  return _regenerator["default"].wrap(function _callee2$(_context2) {
                    while (1) switch (_context2.prev = _context2.next) {
                      case 0:
                        _context2.next = 2;
                        return this.sendOnEachChannel(request);
          Severity: Minor
          Found in lib/sender.js - About 1 hr to fix

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

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

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

                async send (request: SmsRequestType): Promise<string> {
                  const { from, text, to, type, ttl, messageClass } = request.customize ? (await request.customize(this.id, request)) : request
                  const params = {
                    flash: messageClass === 0 ? 1 : 0,
                    from,
              Severity: Minor
              Found in src/providers/sms/seven.js - About 1 hr to fix

                Function _callee$ has 27 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: Minor
                Found in lib/providers/webpush/gcm.js - About 1 hr to fix

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

                    async send (request: SmsRequestType): Promise<string> {
                      const { id, userId, from, to, text, type, nature } =
                        request.customize ? (await request.customize(this.id, request)) : request
                      const response = await fetch('https://api.callr.com/rest/v1.1/sms', {
                        method: 'POST',
                  Severity: Minor
                  Found in src/providers/sms/callr.js - About 1 hr to fix

                    Function _callee$ has 27 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: Minor
                    Found in lib/providers/email/sendmail.js - About 1 hr to fix

                      Function _callee$ has 27 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: Minor
                      Found in lib/providers/email/smtp.js - About 1 hr to fix

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

                          async send (request: SmsRequestType): Promise<string> {
                            const { id, to, text, type, ttl } = request.customize ? (await request.customize(this.id, request)) : request
                            const response = await fetch('https://platform.clickatell.com/messages', {
                              method: 'POST',
                              headers: {
                        Severity: Minor
                        Found in src/providers/sms/clickatell.js - About 1 hr to fix

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

                          function factory(_ref) {
                            var type = _ref.type,
                              config = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
                            switch (type) {
                              // Development
                          Severity: Minor
                          Found in lib/providers/email/index.js - About 1 hr to fix

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

                                              return _regenerator["default"].wrap(function _callee3$(_context3) {
                                                while (1) switch (_context3.prev = _context3.next) {
                                                  case 0:
                                                    _context3.prev = 0;
                                                    _context3.t0 = _objectSpread;
                            Severity: Minor
                            Found in lib/sender.js - About 1 hr to fix

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

                                async send (request: SmsRequestType): Promise<string> {
                                  const { id, to, text, type, ttl } = request.customize ? (await request.customize(this.id, request)) : request
                                  const response = await fetch('https://platform.clickatell.com/messages', {
                                    method: 'POST',
                                    headers: {
                              Severity: Minor
                              Found in src/providers/sms/clickatell.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 _objectSpread has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                              function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
                              Severity: Minor
                              Found in lib/providers/push/notificationCatcher.js - About 45 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 send has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                async send (request: SmsRequestType): Promise<string> {
                                  const { from, to, text } = request.customize ? (await request.customize(this.id, request)) : request
                                  const response = await fetch('https://api.infobip.com/sms/1/text/single', {
                                    method: 'POST',
                                    headers: {
                              Severity: Minor
                              Found in src/providers/sms/infobip.js - About 45 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 send has a Cognitive Complexity of 8 (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 response = await fetch('https://api.sparkpost.com/api/v1/transmissions', {
                                    method: 'POST',
                              Severity: Minor
                              Found in src/providers/email/sparkpost.js - About 45 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 _objectSpread has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                              function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
                              Severity: Minor
                              Found in lib/providers/whatsapp/infobip.js - About 45 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 _objectSpread has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                              function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
                              Severity: Minor
                              Found in lib/providers/email/mandrill.js - About 45 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