Showing 88 of 559 total issues
Function init
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function init(config, watch, options) {
const ctor = sanitizeConfig(config);
const keycloak = Keycloak(ctor);
watch.$once('ready', function (cb) {
Function relationMappings
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static get relationMappings() {
return {
attestation: {
relation: Model.HasOneRelation,
modelClass: this.Attestation,
Function up
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.up = function(knex) {
return Promise.resolve()
.then(() => knex.schema.createTable(`${PREFIX}_form`, table => {
table.uuid('formId').references('formId').inTable('form').notNullable().primary();
table.string('description');
File minesOperatorScreeningForm.js
has 259 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import moment from 'moment';
import commonFormService from '@/services/commonFormService';
import { FormNames } from '@/utils/constants';
import { SampleData, RandomCities } from './sampleData.js';
Function install
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
install: function (Vue, params = {}) {
if (installed) return;
installed = true;
const defaultParams = {
File agriSeafoodOpScreeningForm.js
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import moment from 'moment';
import commonFormService from '@/services/commonFormService';
import { FormNames } from '@/utils/constants';
import { SampleData, RandomCities } from './sampleData.js';
File farmOpScreeningForm.js
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import moment from 'moment';
import commonFormService from '@/services/commonFormService';
import { FormNames } from '@/utils/constants';
import { SampleData, RandomCities } from './sampleData.js';
File forestrySectorOpScreeningForm.js
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import moment from 'moment';
import commonFormService from '@/services/commonFormService';
import { FormNames } from '@/utils/constants';
import { SampleData, RandomCities } from './sampleData.js';
Function getClient
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
async getClient(id, includeRoles = false, includeUsers = false, includeUserRoles = false) {
try {
// TEMP: refresh loop was DOSing SSO
await this._auth();
- 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 dataService.js
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
const log = require('npmlog');
const Problem = require('api-problem');
const { transaction } = require('objection');
class DataService {
Function relationMappings
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static get relationMappings() {
return {
attestation: {
relation: Model.HasOneRelation,
modelClass: this.Attestation,
Function up
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.up = function(knex) {
return Promise.resolve()
.then(() => knex.schema.createTable(`${PREFIX}_form`, table => {
table.uuid('formId').references('formId').inTable('form').notNullable().primary();
table.string('description');
Function up
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.up = function(knex) {
return knex(`${PREFIX}_version_status_code`).del()
.then(() => {
return knex(`${PREFIX}_status_code`).del();
})
Function updateSubmission
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async updateSubmission(submissionId, obj, user) {
// update: location, contacts, business
if (!obj) {
throw Error(`${this._constants.TITLE} Submission cannot be updated without data`);
}
Function constructor
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor(slug, dataService) {
super();
this._controller = new Controller(dataService);
this._resourceAccess = `comfort-${slug}`;
Function up
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.up = function (knex) {
return Promise.resolve()
.then(() => knex.schema.raw(`create view ${FARM_PREFIX}_submission_search_vw
("submissionId", "createdAt", deleted, "formVersionId", "confirmationId", "operationType", "assignedTo",
"statusCode", "statusDate", name, city, "operationTypeDisplay", "statusDisplay")
Function down
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.down = function(knex) {
return Promise.resolve()
.then(() => {
return knex(`${PREFIX}_settings`).del();
})
Function down
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.down = function(knex) {
return Promise.resolve()
.then(() => {
return knex(`${PREFIX}_settings`).del();
})
Function down
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.down = function(knex) {
return Promise.resolve()
.then(() => {
return knex(`${PREFIX}_settings`).del();
})
Function update
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async update(obj, user) {
if (!obj) {
throw Error(`${this._constants.TITLE} cannot be updated without data`);
}