notifme/notifme-sdk

View on GitHub

Showing 333 of 333 total issues

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

  constructor ({ apiUsername, apiPassword }: Object) {
    this.apiKey = Buffer.from(`${apiUsername}:${apiPassword}`).toString('base64')
  }
Severity: Major
Found in src/providers/sms/46elks.js and 2 other locations - About 1 hr to fix
src/providers/sms/callr.js on lines 10..12
src/providers/sms/infobip.js on lines 10..12

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

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

  constructor ({ login, password }: Object) {
    this.apiKey = Buffer.from(`${login}:${password}`).toString('base64')
  }
Severity: Major
Found in src/providers/sms/callr.js and 2 other locations - About 1 hr to fix
src/providers/sms/46elks.js on lines 11..13
src/providers/sms/infobip.js on lines 10..12

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

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

  constructor ({ username, password }: Object) {
    this.apiKey = Buffer.from(`${username}:${password}`).toString('base64')
  }
Severity: Major
Found in src/providers/sms/infobip.js and 2 other locations - About 1 hr to fix
src/providers/sms/46elks.js on lines 11..13
src/providers/sms/callr.js on lines 10..12

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

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

    const { id, userId, from, to, text, type, nature } =
      request.customize ? (await request.customize(this.id, request)) : request
Severity: Major
Found in src/providers/sms/callr.js and 1 other location - About 1 hr to fix
src/providers/email/notificationCatcher.js on lines 8..9

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

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

    const { to, from, html, text, subject, replyTo, attachments } =
      request.customize ? (await request.customize(this.id, request)) : request
Severity: Major
Found in src/providers/email/notificationCatcher.js and 1 other location - About 1 hr to fix
src/providers/sms/callr.js on lines 18..19

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

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

  hexEncodedBodyHash () {
    const request = this.request
    if (request.headers['X-Amz-Content-Sha256']) {
      return request.headers['X-Amz-Content-Sha256']
    } else {
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 154..161

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

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

    value: function hexEncodedBodyHash() {
      var request = this.request;
      if (request.headers['X-Amz-Content-Sha256']) {
        return request.headers['X-Amz-Content-Sha256'];
      } else {
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 138..145

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

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

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

                                if (message.status.groupId === 1) {
                                  return message.messageId
                                } else {
                                  const error = message.status
                                  throw new Error(Object.keys(error).map((key) => `${key}: ${error[key]}`).join(', '))
                          Severity: Major
                          Found in src/providers/sms/infobip.js and 1 other location - About 1 hr to fix
                          src/providers/sms/callr.js on lines 40..45

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

                          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