Showing 124 of 263 total issues
Function serializePayments
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function serializePayments(payments, collectionName, meta) {
function getCustomerAttributes() {
if (!payments.length) { return []; }
const schema = Schemas.schemas[collectionName];
Function setSmartFieldValue
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setSmartFieldValue(record, field, modelName) {
if (field.value) {
logger.warn(`DEPRECATION WARNING: Smart Fields "value" method is deprecated. Please use "get" method in your collection ${modelName} instead.`);
}
Function extractAttributes
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function extractAttributes() {
let { attributes } = params.data;
if (params.data.attributes) {
attributes[schema.idField] = params.data.attributes[schema.idField]
|| params.data.id;
Function perform
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.perform = () => {
const collectionFieldName = integrationInfo.field;
const collectionModel = integrationInfo.collection;
return Implementation.Mixpanel.getUser(collectionModel, params.recordId)
Function serializeMixpanelEvents
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function serializeMixpanelEvents(events, collectionName, meta, options) {
events = events.map((event) => {
const MAP_PROPERTIES = {
$city: 'city',
$region: 'region',
Function AttributesGetter
has 32 lines of code (exceeds 25 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 () => {
Function validateLayoutElement
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
static validateLayoutElement(element) {
if (!validLayoutComponents.includes(element.component)) throw new Error(`${element.component} is not a valid component. Valid components are ${validLayoutComponents.join(' or ')}`);
if (element.component === 'Page') {
if (!Array.isArray(element.elements)) {
throw new Error('Page components must contain an array of fields or layout elements in property \'elements\'');
- 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 generateAndSendSchema
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
async function generateAndSendSchema(envSecret) {
const collections = _.values(Schemas.schemas);
configStore.integrator.defineCollections(collections);
collections
- 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 parseCondition
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const parseCondition = async (condition, formatCondition, modelSchema) => {
if (_.isEmpty(condition)) { throw new InvalidFiltersFormat('Empty condition in filter'); }
if (!_.isObject(condition)) { throw new InvalidFiltersFormat('Condition cannot be a raw value'); }
if (_.isArray(condition)) { throw new InvalidFiltersFormat('Filters cannot be a raw array'); }
if (!_.isString(condition.field) || !_.isString(condition.operator)
- 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 cleanActions
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
cleanActions(actions) {
actions = actions.filter((action) => action.name);
actions.forEach((action) => {
if (action.global) {
this.logger.warn(`REMOVED OPTION: The support for Smart Action "global" option is now removed. Please set "type: 'global'" instead of "global: true" for the "${action.name}" Smart Action.`);
Function InvoicesGetter
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function InvoicesGetter(Implementation, params, opts, integrationInfo) {
const stripe = opts.integrations.stripe.stripe(opts.integrations.stripe.apiKey);
let collectionModel = null;
function getInvoice(invoiceId) {
Function ConversationsGetter
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ConversationsGetter(Implementation, params, opts, integrationInfo) {
let collectionModel = null;
function getConversations(user) {
return new P(((resolve, reject) => {
Function PaymentsGetter
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function PaymentsGetter(Implementation, params, opts, integrationInfo) {
const stripe = opts.integrations.stripe.stripe(opts.integrations.stripe.apiKey);
let collectionModel = null;
function getCharge(paymentId) {
Function perform
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.perform = async () => {
try {
const contactQueryResponse = await ContactGetter
.getContact(intercom, Implementation, mappingValue, params.recordId);
Function cleanFields
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
static cleanFields(fields) {
fields = fields.filter((field) => field.field);
fields.forEach((field) => {
if (field.defaultValue === undefined) {
field.defaultValue = null;
Function SubscriptionGetter
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function SubscriptionGetter(Implementation, params, opts, integrationInfo) {
const stripe = opts.integrations.stripe.stripe(opts.integrations.stripe.apiKey);
function getSubscription(subscriptionId) {
return new P((resolve, reject) => {
Function Associations
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function Associations(app, model, Implementation, integrator, opts) {
const { modelsManager } = inject();
const modelName = Implementation.getModelName(model);
const schema = Schemas.schemas[modelName];
- 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 ResourceDeserializer
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function ResourceDeserializer(Implementation, model, params, withRelationships, opts) {
if (!opts) { opts = {}; }
const schema = Schemas.schemas[Implementation.getModelName(model)];
function extractAttributes() {
- 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 SourcesGetter
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function SourcesGetter(Implementation, params, opts, integrationInfo) {
const stripe = opts.integrations.stripe.stripe(opts.integrations.stripe.apiKey);
function hasPagination() {
return params.page;
- 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 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"