Showing 54 of 91 total issues
Function configureStore
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export default function configureStore(initialState, history) {
let middleware = [noopMiddleware, thunk, promiseMiddleware ];
// Installs hooks that always keep react-router and redux
// store in sync
const reactRouterReduxMiddleware = routerMiddleware(history);
- 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 indexView
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
exports.indexView = (req, res, next) => {
let compiled_app_module_path = path.resolve('public', 'assets', 'scrape.server.js');
if(config.isProd || config.isCI) {
compiled_app_module_path = path.resolve('public', 'server-assets', 'scrape.server.js');
}
- 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 preRenderMiddleware
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export default function preRenderMiddleware(dispatch, components, params, req) {
let promises = [];
try {
const needs = components.reduce( (prev, current) => {
if(!current) {
- 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 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"