Showing 124 of 261 total issues
Function InvoicesGetter
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function InvoicesGetter(Implementation, params, opts, integrationInfo) {
const stripe = opts.integrations.stripe.stripe(opts.integrations.stripe.apiKey);
let collectionModel = null;
function hasPagination() {
- 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 SubscriptionsGetter
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function SubscriptionsGetter(Implementation, params, opts, integrationInfo) {
const stripe = opts.integrations.stripe.stripe(opts.integrations.stripe.apiKey);
let collectionModel = null;
function hasPagination() {
- 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 doesTriggerCustomActionRequiresApproval
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async doesTriggerCustomActionRequiresApproval(
userId: string | number,
customActionName: string,
collectionName: string,
filterForCaller: GenericPlainTree,
Function perform
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.perform = () => {
if (integrationInfo) {
app.get(
path.generate(`${modelName}_closeio_leads/:leadId`, opts),
auth.ensureAuthenticated,
Function validateField
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
validateField(field, actionName) {
if (!field || Array.isArray(field) || typeof field !== 'object') throw new Error(`Field inside fields array on the smart action "${actionName}" must be an object.`);
const {
field: fieldName,
Function assertCanTriggerCustomAction
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async assertCanTriggerCustomAction({
user: { id: userId },
collectionName,
customActionName,
filterForCaller,
Function ResourceSerializer
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Implementation,
model,
records,
integrator,
meta,
Function handleResult
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
handleResult(result) {
if (!result) return;
if ([200, 202, 204].includes(result.status)) {
if (result.body && result.body.warning) {
- 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 serializeConversations
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function serializeConversations(conversations, collectionName, meta) {
function mapConversation(conversation) {
// jshint camelcase: false
conversation.id = conversation.id.replace('layer:///conversations/', '');
conversation.createdAt = conversation.created_at;
- 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 AttributesGetter
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function AttributesGetter(Implementation, params, opts, mappingValue) {
const Intercom = opts.integrations.intercom.intercom;
const intercom = new Intercom.Client(opts.integrations.intercom.credentials);
this.perform = async () => {
- 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 prettyPrint
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const prettyPrint = (json, indentation = '') => {
let result = '';
if (_.isArray(json)) {
result += '[';
- 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 IpWhitelistDeserializer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function IpWhitelistDeserializer(data) {
this.perform = () =>
P.try(() => ({
useIpWhitelist: data.attributes.use_ip_whitelist,
rules: data.attributes.rules.map((rule) => {
- 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 exports
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports = function Associations(app, model, Implementation, integrator, opts) {
Function SmartFieldsValuesInjector
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
record,
modelName,
fieldsPerModel,
depth = 0,
requestedField = null,
Function ResourceDeserializer
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function ResourceDeserializer(Implementation, model, params, withRelationships, opts) {
Function authenticationCallback
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
async function authenticationCallback(context, options, request, response, next) {
Function ConversationsGetter
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function ConversationsGetter(Implementation, params, opts, mappingValue) {
const Intercom = opts.integrations.intercom.intercom;
const intercom = new Intercom.Client(opts.integrations.intercom.credentials);
function hasPagination() {
- 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 sort
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
sort(apimap) {
try {
apimap = ApimapSorter._reorderKeysBasic(apimap);
apimap.data = ApimapSorter._sortArrayOfObjects(apimap.data);
- 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
Avoid too many return
statements within this function. Open
return reject(new VError(error, 'Forest server request error'));
Avoid too many return
statements within this function. Open
return reject(new Error(errorMessages.SERVER_TRANSACTION.UNEXPECTED, error));