Showing 6 of 23 total issues
File utils.js
has 398 lines of code (exceeds 250 allowed). Consider refactoring. Open
const _ = require('lodash');
const Bodybuilder = require('bodybuilder');
const { getConfig } = require('./config');
const moment = require('moment');
const DATE_FORMAT = 'YYYY-MM-DD';
- Create a ticketCreate a ticket
Function getConfig
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getConfig() {
const filterMappings = {
"nested": {
"license": {
"path": "permissions.licenses",
- Create a ticketCreate a ticket
Function getFlattenedMappingPropertiesByType
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function getFlattenedMappingPropertiesByType(mapping) {
let props = {};
const _recurseMappingTree = (mappingTree, pathArr) => {
if (mappingTree["properties"]) {
- Read upRead up
- Create a ticketCreate a ticket
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 _addIncludeExclude
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function _addIncludeExclude ({ body, queryParams }) {
let include = queryParams.include || null;
let exclude = queryParams.exclude || null;
let _source = {};
const _enforceArray = (obj) => {
- Read upRead up
- Create a ticketCreate a ticket
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 omitPrivateKeys
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function omitPrivateKeys (collection) {
const omitFn = (value) => {
if (value && typeof value === 'object') {
Object.keys(value).forEach((key) => {
if (key[0] === '_') {
- Read upRead up
- Create a ticketCreate a ticket
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 _addRangeFilter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function _addRangeFilter ({ body, field, lteRange, gteRange }) {
let ranges = {};
if(lteRange) {
try {
- Read upRead up
- Create a ticketCreate a ticket
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"