Showing 5 of 29 total issues
Function getApiRoutes
has 176 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function getApiRoutes(config, router) {
const logger = new Logger({ name: 'routes.index', level: config.LOGGER_LEVEL });
const adapter = new ElasticsearchAdapter({ hosts: config.ES_HOST, logger: Logger, mappings, settings });
- Create a ticketCreate a ticket
File utils.js
has 330 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
const _ = require('lodash');
const fs = require('fs');
const git = require("git-rev");
const pkg = require("../package.json");
const Jsonfile = require("jsonfile");
- Create a ticketCreate a ticket
Function getFlattenedMappingPropertiesByType
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
static 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 constructor
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor(config) {
if(!config || !config.name) {
config = {
name: this.DEFAULT_LOGGER_NAME
};
- Create a ticketCreate a ticket
Function omitPrivateKeys
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
static 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"