Showing 124 of 263 total issues
Function perform
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.perform = () => {
collectionModel = integrationInfo.collection;
const {
field: collectionFieldName,
embeddedPath,
Function collection
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
exports.collection = (name, opts) => {
if (_.isEmpty(Schemas.schemas) && opts.modelsDir) {
logger.error(`Cannot customize your collection named "${name}" properly. Did you call the "collection" method in the /forest directory?`);
return;
}
- 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 CSVExporter
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function CSVExporter(params, response, modelName, recordsExporter) {
const { configStore } = inject();
function getValueForAttribute(record, attribute) {
let value;
- 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 getResponse
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
async getResponse(action, hook, fields, request, changedField = null) {
const fieldsForUser = this.getFieldsForUser(fields);
if (typeof hook !== 'function') throw new Error('hook must be a function');
- 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 validateOptions
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
validateOptions() {
const options = this.lianaOptions;
if (!options) {
throw new Error('Liana options cannot be null.');
Function createCollections
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.createCollections = (Implementation, apimap, collectionAndFieldName) => {
const collectionName = collectionAndFieldName.split('.')[0];
const collectionDisplayName = _.capitalize(collectionName);
// jshint camelcase: false
Function perform
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.perform = () => {
collectionModel = integrationInfo.collection;
const {
field: collectionFieldName,
embeddedPath,
Function perform
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.perform = () => {
collectionModel = integrationInfo.collection;
const {
field: collectionFieldName,
embeddedPath,
Function get
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.get = async (request, response, next) => {
let promise = null;
function getAssociationModel(schema, associationName) {
const field = _.find(schema.fields, { field: associationName });
Function IntegrationChecker
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
function IntegrationChecker(opts, Implementation) {
const modules = [
new CloseIo(opts, Implementation),
new Intercom(opts, Implementation),
new Layer(opts, Implementation),
Function CSVExporter
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
function CSVExporter(params, response, modelName, recordsExporter) {
const { configStore } = inject();
function getValueForAttribute(record, attribute) {
let value;
Function serializeInvoices
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
function serializeInvoices(invoices, collectionName, meta) {
function getCustomerAttributes() {
if (!invoices.length) { return []; }
const schema = Schemas.schemas[collectionName];
Function MixpanelEventsGetter
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function MixpanelEventsGetter(Implementation, params, options, integrationInfo) {
const MixpanelExport = options.integrations.mixpanel.mixpanel;
const panel = new MixpanelExport({
api_key: options.integrations.mixpanel.apiKey,
api_secret: options.integrations.mixpanel.apiSecret,
Function getRoleIdsAllowedToApprove
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async getRoleIdsAllowedToApprove(
recordsCounterParams: RecordsCounterParams,
customActionName: string,
collectionName: string,
filterForCaller: GenericPlainTree,
Function _ensureRecordIdsInScope
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
_ensureRecordIdsInScope() {
return async (request, response, next) => {
try {
const { primaryKeys, isVirtual } = Schemas.schemas[this.collectionName];
Function Routes
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function Routes(app, model, Implementation, options) {
const { modelsManager } = inject();
const modelName = Implementation.getModelName(model);
let integrationInfo;
Function serializePayments
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function serializePayments(payments, collectionName, meta) {
function getCustomerAttributes() {
if (!payments.length) { return []; }
const schema = Schemas.schemas[collectionName];
- 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 injectSmartFieldValue
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function injectSmartFieldValue(field) {
const fieldWasRequested = isRequestedField(requestedField || modelName, field.field);
if (record && field.isVirtual && (field.get || field.value)) {
if (fieldsPerModel && !fieldWasRequested) {
Function SourceGetter
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function SourceGetter(Implementation, params, opts, integrationInfo) {
const stripe = opts.integrations.stripe.stripe(opts.integrations.stripe.apiKey);
let collectionModel = null;
function getSource(customerId, objectId) {
Function sort
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
sort(apimap) {
try {
apimap = ApimapSorter._reorderKeysBasic(apimap);
apimap.data = ApimapSorter._sortArrayOfObjects(apimap.data);