Showing 88 of 559 total issues
Function modifiers
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
static get modifiers() {
return {
orderDescending(builder) {
builder.orderBy('createdAt', 'desc');
},
Function updateWatchVariables
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updateWatchVariables(isAuthenticated = false) {
watch.authenticated = isAuthenticated;
watch.loginFn = keycloak.login;
watch.login = keycloak.login;
watch.createLoginUrl = keycloak.createLoginUrl;
Function createSubmission
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
async createSubmission(obj, user) {
if (!obj) {
throw Error(`${this._constants.TITLE} Submission cannot be created without data`);
}
Function searchSubmissions
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
async searchSubmissions(params) {
if (params && params.tiny) {
const submissions = await this._models.SubmissionSearchView.query()
.modify('filterVersion', params.version)
.modify('filterConfirmationId', params.confirmationId)
Function constructor
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(slug, controller, models) {
this._resourceAccess = `comfort-${slug}`;
this._controller = controller;
this._models = models;
this._routes = require('express').Router();
Function modifiers
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
static get modifiers() {
return {
orderDescending(builder) {
builder.orderBy('createdAt', 'desc');
},
- 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 modifiers
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
static get modifiers() {
return {
orderDescending(builder) {
builder.orderBy('createdAt', 'desc');
},
- 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 modifiers
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
static get modifiers () {
return {
filterActive(query, value) {
if (value !== undefined) {
query.where('active', value);
- 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 modifiers
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
static get modifiers () {
return {
filterActive(query, value) {
if (value !== undefined) {
query.where('active', value);
Function searchSubmissions
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
async searchSubmissions(params) {
const tiny = data => {
if (!data || !Array.isArray(data) || !data.length) {
return [];
}
Function relationMappings
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
static get relationMappings() {
return {
survey: {
relation: Model.HasOneRelation,
modelClass: this.Survey,
Function createSubmission
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
async createSubmission(obj, user) {
if (!obj) {
throw Error(`${this._constants.TITLE} Submission cannot be created without data`);
}
Function current
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
async current(tiny) {
let form;
let version;
if (tiny) {
Function current
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
async current(tiny){
let form;
let version;
if (tiny) {
Function searchSubmissions
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
async searchSubmissions(params) {
if (params && params.tiny) {
const submissions = await this._models.SubmissionSearchView.query()
.modify('filterVersion', params.version)
.modify('filterConfirmationId', params.confirmationId)
Function current
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
async current(tiny) {
let form;
let version;
if (tiny) {
Function updateSubmission
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
async updateSubmission(submissionId, obj, user) {
// update: location, contacts, business
if (!obj) {
throw Error(`${this._constants.TITLE} Submission cannot be updated without data`);
}
- 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
Avoid deeply nested control flow statements. Open
if (includeUserRoles) {
ur.roles = await this._kcAdminClient.users.listClientRoleMappings({ id: ur.id, clientUniqueId: id });
}
Function assertOptions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function assertOptions(options) {
const { config, init, onReady, onInitError } = options;
if (typeof config !== 'string' && !_isObject(config)) {
return { hasError: true, error: `'config' option must be a string or an object. Found: '${config}'` };
}
- 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 hasResourceRoles
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
hasResourceRoles: (_state, getters) => (resource, roles) => {
if (!getters.authenticated) return false;
if (!roles.length) return true; // No roles to check against
if (getters.resourceAccess && getters.resourceAccess[resource]) {
- 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"