notifme/notifme-sdk

View on GitHub

Showing 162 of 333 total issues

Function send has 43 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 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

    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, subscription, title, rest;
            return _regenerator["default"].wrap(function _callee$(_context) {
              while (1) switch (_context.prev = _context.next) {
    Severity: Minor
    Found in lib/providers/webpush/notificationCatcher.js - About 1 hr to fix

      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

        Function Logger has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var Logger = /*#__PURE__*/function () {
          function Logger() {
            (0, _classCallCheck2["default"])(this, Logger);
            this.innerLogger = _winston["default"].createLogger();
            this.configure({
        Severity: Minor
        Found in lib/util/logger.js - About 1 hr to fix

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

                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) {
                      case 0:
          Severity: Minor
          Found in lib/providers/email/notificationCatcher.js - About 1 hr to fix

            Function value has 41 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, rest, result;
                    return _regenerator["default"].wrap(function _callee$(_context) {
                      while (1) switch (_context.prev = _context.next) {
            Severity: Minor
            Found in lib/providers/push/adm.js - About 1 hr to fix

              Function value has 41 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, rest, result;
                      return _regenerator["default"].wrap(function _callee$(_context) {
                        while (1) switch (_context.prev = _context.next) {
              Severity: Minor
              Found in lib/providers/push/apn.js - About 1 hr to fix

                Function value has 41 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, text;
                        return _regenerator["default"].wrap(function _callee$(_context) {
                          while (1) switch (_context.prev = _context.next) {
                Severity: Minor
                Found in lib/providers/sms/notificationCatcher.js - About 1 hr to fix

                  Function value has 41 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, url;
                          return _regenerator["default"].wrap(function _callee$(_context) {
                            while (1) switch (_context.prev = _context.next) {
                  Severity: Minor
                  Found in lib/providers/voice/notificationCatcher.js - About 1 hr to fix

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

                      async send (request: EmailRequestType): Promise<string> {
                        if (
                          request.text &&
                          typeof request.text !== 'string' &&
                          !(request.text instanceof Buffer) &&
                    Severity: Minor
                    Found in src/providers/email/ses.js - About 1 hr to fix

                      Function _callee$ has 41 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/slack/slack.js - About 1 hr to fix

                        Function value has 41 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, rest, result;
                                return _regenerator["default"].wrap(function _callee$(_context) {
                                  while (1) switch (_context.prev = _context.next) {
                        Severity: Minor
                        Found in lib/providers/push/wns.js - About 1 hr to fix

                          Function value has 41 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, rest, result;
                                  return _regenerator["default"].wrap(function _callee$(_context) {
                                    while (1) switch (_context.prev = _context.next) {
                          Severity: Minor
                          Found in lib/providers/push/fcm.js - About 1 hr to fix

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

                                    return _regenerator["default"].wrap(function _callee4$(_context4) {
                                      while (1) switch (_context4.prev = _context4.next) {
                                        case 0:
                                          return _context4.abrupt("return", _promise["default"].all((0, _keys["default"])(request).filter(function (channel) {
                                            return _this2.channels.includes(channel);
                            Severity: Minor
                            Found in lib/sender.js - About 1 hr to fix

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

                                async send (request: SmsRequestType): Promise<string> {
                                  const { appKey, consumerKey, account, host } = this.credentials
                                  const timestamp = Math.round(Date.now() / 1000)
                              
                                  // Documentation: https://api.ovh.com/console/#/sms/%7BserviceName%7D/jobs#POST
                              Severity: Minor
                              Found in src/providers/sms/ovh.js - About 1 hr to fix

                                Function value has 40 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, text;
                                        return _regenerator["default"].wrap(function _callee$(_context) {
                                          while (1) switch (_context.prev = _context.next) {
                                Severity: Minor
                                Found in lib/providers/slack/notificationCatcher.js - About 1 hr to fix

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

                                        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) {
                                              case 0:
                                  Severity: Minor
                                  Found in lib/providers/whatsapp/notificationCatcher.js - About 1 hr to fix

                                    Function send has a Cognitive Complexity of 13 (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 form = new FormData()
                                        form.append('from', from)
                                    Severity: Minor
                                    Found in src/providers/email/mailgun.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 send has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                      async send (request: SmsRequestType): Promise<string> {
                                        const { appKey, consumerKey, account, host } = this.credentials
                                        const timestamp = Math.round(Date.now() / 1000)
                                    
                                        // Documentation: https://api.ovh.com/console/#/sms/%7BserviceName%7D/jobs#POST
                                    Severity: Minor
                                    Found in src/providers/sms/ovh.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 _callee$ has 39 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/notificationCatcher.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language