notifme/notifme-sdk

View on GitHub

Showing 333 of 333 total issues

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 _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 _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

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

              addHeaders (credentials, datetime) {
                this.request.headers['X-Amz-Date'] = datetime
                if (credentials.sessionToken) {
                  this.request.headers['x-amz-security-token'] = credentials.sessionToken
                }
            Severity: Major
            Found in src/util/aws/v4.js and 1 other location - About 1 hr to fix
            lib/util/aws/v4.js on lines 45..50

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 57.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                value: function addHeaders(credentials, datetime) {
                  this.request.headers['X-Amz-Date'] = datetime;
                  if (credentials.sessionToken) {
                    this.request.headers['x-amz-security-token'] = credentials.sessionToken;
                  }
            Severity: Major
            Found in lib/util/aws/v4.js and 1 other location - About 1 hr to fix
            src/util/aws/v4.js on lines 29..34

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 57.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            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 _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 _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 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 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

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                      function rotate<T> (arr: T[], forward): T[] { // /!\ mute array, the mutation is "the state"
                        if (forward) {
                          arr.push(arr.shift())
                        } else {
                          arr.unshift(arr.pop())
                      Severity: Major
                      Found in src/strategies/providers/roundrobin.js and 1 other location - About 1 hr to fix
                      lib/strategies/providers/roundrobin.js on lines 12..20

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 56.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 3 locations. Consider refactoring.
                      Open

                              var _ref, id, userId, from, replyTo, subject, html, text, headers, to, cc, bcc, attachments, response, responseBody, _responseBody$errors, firstError, message;
                      Severity: Major
                      Found in lib/providers/email/sparkpost.js and 2 other locations - About 1 hr to fix
                      lib/providers/sms/ovh.js on lines 54..54
                      lib/providers/whatsapp/infobip.js on lines 42..42

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 56.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 4 locations. Consider refactoring.
                      Open

                                  case 38:
                                    responseBody = _context.sent;
                                    if (!response.ok) {
                                      _context.next = 43;
                                      break;
                      Severity: Major
                      Found in lib/providers/email/mailgun.js and 3 other locations - About 1 hr to fix
                      lib/providers/sms/callr.js on lines 90..96
                      lib/providers/sms/twilio.js on lines 74..80
                      lib/providers/voice/twilio.js on lines 90..96

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 56.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 3 locations. Consider refactoring.
                      Open

                              var _ref2, from, to, type, messageId, text, mediaUrl, templateName, templateData, rest, payload, response, responseBody, _ref3, _ref4, message, error, _message;
                      Severity: Major
                      Found in lib/providers/whatsapp/infobip.js and 2 other locations - About 1 hr to fix
                      lib/providers/email/sparkpost.js on lines 37..37
                      lib/providers/sms/ovh.js on lines 54..54

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 56.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 4 locations. Consider refactoring.
                      Open

                                  case 20:
                                    responseBody = _context.sent;
                                    if (!response.ok) {
                                      _context.next = 25;
                                      break;
                      Severity: Major
                      Found in lib/providers/sms/callr.js and 3 other locations - About 1 hr to fix
                      lib/providers/email/mailgun.js on lines 103..109
                      lib/providers/sms/twilio.js on lines 74..80
                      lib/providers/voice/twilio.js on lines 90..96

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 56.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 4 locations. Consider refactoring.
                      Open

                                  case 22:
                                    responseBody = _context.sent;
                                    if (!response.ok) {
                                      _context.next = 27;
                                      break;
                      Severity: Major
                      Found in lib/providers/sms/twilio.js and 3 other locations - About 1 hr to fix
                      lib/providers/email/mailgun.js on lines 103..109
                      lib/providers/sms/callr.js on lines 90..96
                      lib/providers/voice/twilio.js on lines 90..96

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 56.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 3 locations. Consider refactoring.
                      Open

                              var _this$credentials2, appKey, consumerKey, account, host, timestamp, _ref2, from, to, text, type, ttl, messageClass, body, reqBody, url, response, responseBody;
                      Severity: Major
                      Found in lib/providers/sms/ovh.js and 2 other locations - About 1 hr to fix
                      lib/providers/email/sparkpost.js on lines 37..37
                      lib/providers/whatsapp/infobip.js on lines 42..42

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 56.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 4 locations. Consider refactoring.
                      Open

                                  case 38:
                                    responseBody = _context.sent;
                                    if (!response.ok) {
                                      _context.next = 43;
                                      break;
                      Severity: Major
                      Found in lib/providers/voice/twilio.js and 3 other locations - About 1 hr to fix
                      lib/providers/email/mailgun.js on lines 103..109
                      lib/providers/sms/callr.js on lines 90..96
                      lib/providers/sms/twilio.js on lines 74..80

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 56.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Severity
                      Category
                      Status
                      Source
                      Language