Showing 88 of 559 total issues
Avoid too many return
statements within this function. Open
return {
hasError: false,
error: null
};
Function verifyBoolean
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const verifyBoolean = (obj, param, result, errors) => {
if (obj[param]) {
if (isBoolean(obj[param])) {
result[param] = obj[param];
} else if (isString(obj[param]) && ['true','false'].includes(obj[param].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
Function updateSubmission
has a Cognitive Complexity of 6 (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
Function sendConfirmationEmail
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async sendConfirmationEmail(submission) {
try {
const settings = await this._dataService.readSettings('confirmationEmail');
if (settings && settings.enabled) {
if (!this._confirmationEmailBody) {
- 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 createSubmissionStatus
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async createSubmissionStatus(obj, submissionId, user) {
if (!obj) {
throw Error('Status cannot be created 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
Function submissionSearch
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const submissionSearch = (models) => {
return (req, res, next) => {
try {
const errors = [];
const result = new models.SubmissionSearch();
- 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 sendSubmissionEmail
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async sendSubmissionEmail(submission, to) {
try {
const settings = await this._dataService.readSettings('submissionEmail');
if (settings && settings.enabled) {
if (!this._submissionEmailBody) {
- 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 verifyBoolean
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const verifyBoolean = (obj, param, result, errors) => {
if (obj[param]) {
if (isBoolean(obj[param])) {
result[param] = obj[param];
} else if (isString(obj[param]) && ['true', 'false'].includes(obj[param].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"