Showing 91 of 91 total issues
Avoid too many return
statements within this function. Open
return res.status(err.statusCode).sendMessage(err.message);
Avoid too many return
statements within this function. Open
return res.status(400).sendMessage(`validation.failed.${firstValidationField}`);
Avoid too many return
statements within this function. Open
return res.status(404).sendMessage('not_found');
Avoid too many return
statements within this function. Open
return res.status(400).sendMessage('cast_error', null,
{
model: err.model.modelName,
stringValue: err.stringValue,
kind: err.kind,
Avoid too many return
statements within this function. Open
return res.status(404).sendMessage(err.message || 'not_found');
Avoid too many return
statements within this function. Open
return res.status(500).sendMessage('internal_server_error');
Avoid too many return
statements within this function. Open
return res.send(oembedXml);
Avoid too many return
statements within this function. Open
return res.status(400).sendMessage(err.message || 'not_found');
Function logBrowserError
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
exports.logBrowserError = (body = {}, req) => {
if (config.isProd) {
const fileLogContents = { ...body };
//delete screenshot field for loggin in file
- 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 hanldeCallback
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const hanldeCallback = (req, res) => (err, json, body) => {
if(err) {
return res.status(500).json(err);
}
- 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 Message
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const Message = ({message, error, normal, warning, isFixed, className, removable, dispatch, action}) => {
const closeButton = removable && <span className={cx('btn-close', 'pull-right')} onClick = {(e) => {dispatch(action())}}>X</span>;
return (
- 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"