Showing 36 of 99 total issues
File actions.js
has 430 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable consistent-return */
import _ from 'lodash';
import DefaultHandler, { order } from './default';
import log from '../../logger';
import { areArraysEquals } from '../../utils';
Function calcChanges
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
export function calcChanges(assets, existing, identifiers = [ 'id', 'name' ]) {
// Calculate the changes required between two sets of assets.
const update = [];
let del = [ ...existing ];
let create = [ ...assets ];
- 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 pagedManager
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
function pagedManager(client, manager) {
return new Proxy(manager, {
get: function(target, name, receiver) {
if (name === 'getAll') {
return async function(...args) {
- 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 processChanges
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
async processChanges(assets, changes) {
if (!changes) {
changes = await this.calcChanges(assets);
}
Function calcChanges
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function calcChanges(assets, existing, identifiers = [ 'id', 'name' ]) {
// Calculate the changes required between two sets of assets.
const update = [];
let del = [ ...existing ];
let create = [ ...assets ];
Function pagedManager
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function pagedManager(client, manager) {
return new Proxy(manager, {
get: function(target, name, receiver) {
if (name === 'getAll') {
return async function(...args) {
Function get
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
get: function(target, name, receiver) {
if (name === 'getAll') {
return async function(...args) {
// If the function was called with object params and paginate (entity) then handle pagination
if (args[0] && typeof args[0] === 'object' && args[0].paginate) {
Function getType
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getType() {
if (this.existing) {
return this.existing;
}
Function calcChanges
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
async calcChanges(actionsAssets, existing) {
// Calculate the changes required between two sets of assets.
const update = [];
let del = [ ...existing ];
const create = [];
Function processChanges
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
@order('70')
async processChanges(assets) {
const { organizations } = assets;
// Do nothing if not set
if (!organizations) return;
Function calcChanges
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
async calcChanges(assets, includeExcluded = false) {
let { rules } = assets;
const excludedRules = (assets.exclude && assets.exclude.rules) || [];
Function processChanges
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
@order('60')
async processChanges(assets) {
const { clientGrants } = assets;
// Do nothing if not set
Function processChanges
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
@order('60')
async processChanges(assets) {
// eslint-disable-next-line prefer-destructuring
const actions = assets.actions;
Function processChanges
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
async processChanges(assets) {
const { emailProvider } = assets;
// Do nothing if not set
if (!emailProvider) 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 getType
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getType() {
if (this.existing) {
return this.existing;
}
Function updateOrganization
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
async updateOrganization(org, organizations) {
const { connections: existingConnections } = await organizations.find((orgToUpdate) => orgToUpdate.name === org.name);
const params = { id: org.id };
const { connections } = org;
Function getType
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
async getType() {
if (this.existing) {
return this.existing;
}
- 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 processChanges
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
@order('60')
async processChanges(assets) {
const { clientGrants } = assets;
// Do nothing if not set
- 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 getVersionById
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async getVersionById(actionId, deployedVersion) {
// in case client version does not support actionVersions
if (typeof this.client.actions.getVersions !== 'function') {
return null;
}
- 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 calcDeployedVersionChanges
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async calcDeployedVersionChanges(actionId, actionAsset, existingVersion) {
const create = [];
if (actionAsset.deployed) {
const versionToCreate = {
- 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"