Showing 162 of 333 total issues
Function send
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
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', {
Function value
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
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) {
Function value
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
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) {
Function Logger
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var Logger = /*#__PURE__*/function () {
function Logger() {
(0, _classCallCheck2["default"])(this, Logger);
this.innerLogger = _winston["default"].createLogger();
this.configure({
Function _callee
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
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:
Function value
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
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) {
Function value
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
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) {
Function value
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
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) {
Function value
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
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) {
Function send
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async send (request: EmailRequestType): Promise<string> {
if (
request.text &&
typeof request.text !== 'string' &&
!(request.text instanceof Buffer) &&
Function _callee$
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
return _regenerator["default"].wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
if (!request.customize) {
_context.next = 6;
Function value
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
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) {
Function value
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
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) {
Function _callee4$
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
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);
Function send
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Function value
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
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) {
Function _callee
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
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:
Function send
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
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)
- Read upRead up
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
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
- Read upRead up
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
Open
return _regenerator["default"].wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
if (!request.customize) {
_context.next = 6;