notifme/notifme-sdk

View on GitHub

Showing 333 of 333 total issues

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

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

            export type VoiceProviderType = {
              type: 'logger'
            } | {
              type: 'custom',
              id: string,
            Severity: Major
            Found in src/models/provider-voice.js and 1 other location - About 1 hr to fix
            src/models/provider-whatsapp.js on lines 5..15

            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 71.

            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 2 locations. Consider refactoring.
            Open

            export type WhatsappProviderType = {
              type: 'logger'
            } | {
              type: 'custom',
              id: string,
            Severity: Major
            Found in src/models/provider-whatsapp.js and 1 other location - About 1 hr to fix
            src/models/provider-voice.js on lines 5..15

            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 71.

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

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

                      const response = await fetch(url, {
                        method: 'POST',
                        headers: {
                          'X-Ovh-Timestamp': timestamp,
                          'X-Ovh-Signature': this.signRequest('POST', url, reqBody, timestamp),
                  Severity: Major
                  Found in src/providers/sms/ovh.js and 1 other location - About 1 hr to fix
                  lib/providers/sms/ovh.js on lines 94..106

                  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 70.

                  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 2 locations. Consider refactoring.
                  Open

                                return (0, _request["default"])(url, {
                                  method: 'POST',
                                  headers: {
                                    'X-Ovh-Timestamp': timestamp,
                                    'X-Ovh-Signature': this.signRequest('POST', url, reqBody, timestamp),
                  Severity: Major
                  Found in lib/providers/sms/ovh.js and 1 other location - About 1 hr to fix
                  src/providers/sms/ovh.js on lines 54..66

                  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 70.

                  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 send has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    async send (request: VoiceRequestType): Promise<string> {
                      const {
                        from,
                        to,
                        url,
                  Severity: Minor
                  Found in src/providers/voice/twilio.js - About 1 hr to fix

                    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
                              Severity
                              Category
                              Status
                              Source
                              Language