Showing 124 of 263 total issues
Function Checker
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
function Checker(opts, Implementation) {
const { modelsManager } = inject();
let integrationValid = false;
function hasIntegration() {
- 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 Checker
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
function Checker(opts, Implementation) {
const { modelsManager } = inject();
let integrationValid = false;
function hasIntegration() {
- 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 Checker
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Checker(opts, Implementation) {
const { modelsManager } = inject();
let integrationValid = false;
function hasIntegration() {
Function createCollections
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.createCollections = (Implementation, apimap, collectionAndFieldName, options) => {
const { modelsManager } = inject();
const model = modelsManager.getModels()[collectionAndFieldName.split('.')[0]];
const modelName = Implementation.getModelName(model);
const collectionDisplayName = _.capitalize(modelName);
Function Checker
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Checker(opts, Implementation) {
const { modelsManager } = inject();
let integrationValid = false;
function hasIntegration() {
Function Routes
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function Routes(app, model, Implementation, opts) {
const { modelsManager } = inject();
const modelName = Implementation.getModelName(model);
let integrationInfo;
Function Checker
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Checker(options, Implementation) {
const { modelsManager } = inject();
let integrationValid = false;
function hasIntegration() {
Function SmartFieldsValuesInjector
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
function SmartFieldsValuesInjector(
record,
modelName,
fieldsPerModel,
depth = 0,
Function serializeSubscriptions
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
function serializeSubscriptions(subscriptions, collectionName, meta) {
function getCustomerAttributes() {
if (!subscriptions.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
File action-authorization.ts
has 309 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {
ForestAdminClient,
} from '@forestadmin/forestadmin-client';
import hashObject from 'object-hash';
import BadRequestError from '../../utils/errors/bad-request-error';
Function generateAndSendSchema
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function generateAndSendSchema(envSecret) {
const collections = _.values(Schemas.schemas);
configStore.integrator.defineCollections(collections);
collections
Function errorHandler
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
function errorHandler({ logger } = {}) {
/**
* @param {any} error
* @param {import('express').Request} request
* @param {import('express').Response} response
- 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 ConversationsGetter
has 78 lines of code (exceeds 25 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() {
Function SourcesGetter
has 77 lines of code (exceeds 25 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;
Function PaymentsGetter
has 77 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 hasPagination() {
Function InvoicesGetter
has 76 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 hasPagination() {
Function SubscriptionsGetter
has 76 lines of code (exceeds 25 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() {
Function getWithLiveQuery
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.getWithLiveQuery = async (request, response, next) => {
try {
const { query, contextVariables } = await chartHandler.getQueryForChart({
userId: request.user.id,
renderingId: request.user.renderingId,
Function perform
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.perform = () => {
if (integrationInfo) {
app.get(
path.generate(`${modelName}_stripe_payments`, opts),
auth.ensureAuthenticated,
Function Routes
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function Routes(app, model, Implementation, options) {
const modelName = Implementation.getModelName(model);
let integrationInfo;
if (options.integrations && options.integrations.intercom) {