Showing 43 of 61 total issues
File validation.js
has 417 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
___ ___ ___ _ _ _ ___ ___
| __/ __| ___| _ \___ _ _ _ __ (_) |_ /_\ | _ \_ _|
| _|\__ \ / -_) _/ -_) '_| ' \| | _| / _ \| _/| |
Function getAllFileNames
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
function getAllFileNames() {
const allFilesNames = [];
if (apiSchema) {
- 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 routeRequest
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
const routeRequest = function(req, res){
const reqPath = `/${req.params[0]}`;
const reqMethod = req.method.toLowerCase();
- 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 basic.js
has 348 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
___ ___ ___ _ _ _ ___ ___
| __/ __| ___| _ \___ _ _ _ __ (_) |_ /_\ | _ \_ _|
| _|\__ \ / -_) _/ -_) '_| ' \| | _| / _ \| _/| |
Function postToBasic
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
function postToBasic(req, res, sch, body){
return new Promise(function (fulfill, reject){
const apiCallsObject = {
Function getBasicFields
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
function getBasicFields(fieldsToBasic, body, autoPopValues){
const postObjs = {}, requestsObj = {};
fieldsToBasic.forEach((field)=>{
const key = Object.keys(field)[0];
const whereToStore = field[key].store;
- 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 index.js
has 286 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
___ ___ ___ _ _ _ ___ ___
| __/ __| ___| _ \___ _ _ _ __ (_) |_ /_\ | _ \_ _|
| _|\__ \ / -_) _/ -_) '_| ' \| | _| / _ \| _/| |
Function getControlNumber
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getControlNumber = function(req, res, reqData){
const pathData = reqData.schema;
const fileTypes = {
'gud': 'guideDocumentation',
'arf': 'acknowledgementOfRiskForm',
Function postApplication
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
const postApplication = function(req, res, reqData){
const pathData = reqData.schema;
const body = util.getBody(req);
Function getBasicFields
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getBasicFields(fieldsToBasic, body, autoPopValues){
const postObjs = {}, requestsObj = {};
fieldsToBasic.forEach((field)=>{
const key = Object.keys(field)[0];
const whereToStore = field[key].store;
Function getFilesZip
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getFilesZip(controlNumber, dbFiles, res, callback){
const zipper = new s3zipper(config.getStoreConfig());
const filePath = `${controlNumber}`;
Function routeRequest
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
const routeRequest = function(req, res){
const reqPath = `/${req.params[0]}`;
const reqMethod = req.method.toLowerCase();
Function generateErrorMesage
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function generateErrorMesage(output){
let errorMessage = '';
const messages = [];
output.errorArray.forEach((error)=>{
Function buildGetResponse
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function buildGetResponse(cnData, applicationData, schemaData, jsonData, getSchema){
let key;
for (key in schemaData){
- 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 buildAutoPopulatedFields
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
function buildAutoPopulatedFields(fieldsToBuild, body){
const output = {};
fieldsToBuild.forEach((field)=>{
const key = Object.keys(field)[0];
const fieldMakeUp = [];
Function checkFieldLengths
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function checkFieldLengths(schema, input, processedFieldErrors, path){
const keys = Object.keys(schema);
keys.forEach((key)=>{
switch (key){
case 'allOf':
Function saveAndUploadFiles
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
function saveAndUploadFiles(req, res, possbileFiles, files, controlNumber, application, callback){
const asyncTasks = [];
possbileFiles.forEach((fileConstraints)=>{
Function getFieldsToStore
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getFieldsToStore(schema, fieldsToStore, path, saveLocation){
const keys = Object.keys(schema);
keys.forEach((key)=>{
switch (key){
case 'allOf':
Function validateFile
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function validateFile(uploadFile, validationConstraints, fileName){
const fileInfo = getFileInfo(uploadFile, validationConstraints);
const constraints = validationConstraints[fileName];
const regex = `(^${constraints.validExtensions.join('$|^')}$)`;
- 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 exports
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(sequelize, DataTypes) {
const applications = sequelize.define('applications', {
id: { type: DataTypes.UUID, primaryKey: true, defaultValue: DataTypes.UUIDV4 },
controlNumber: { type: DataTypes.STRING(50), field: 'control_number' },
formName: { type: DataTypes.STRING(100), field: 'form_name' },