Showing 35 of 94 total issues
Function start
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function start(Wrapped) {
class Start extends Component {
static propTypes = {
intl: PropTypes.object.isRequired,
Function updateList
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function updateList(
list,
ItemRecord,
idProp,
args
Function render
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function render(req, res, next) {
const memoryHistory = createMemoryHistory(req.originalUrl);
const store = configureStore({
initialState: createRequestInitialState(req),
platformMiddleware: [routerMiddleware(memoryHistory)]
Function render
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { fields, online } = this.props;
return (
<div className="offline-page">
Function todosReducer
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function todosReducer(state = new InitialState, action) {
switch (action.type) {
case actions.ADD_HUNDRED_TODOS: {
const todos = action.payload.reduce((todos, json) =>
Function errorHandler
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
export default function errorHandler(err, req, res, next) { // eslint-disable-line no-unused-vars
const errorDetails = err.stack || err;
console.error('Yay', errorDetails);
- 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
Open
return list.delete(index).insert(getInsertIndex(), list.get(index));
Avoid too many return
statements within this function. Open
Open
return List(val).map(item => new ItemRecord(item));
Avoid too many return
statements within this function. Open
Open
if (index === -1) return list;
Avoid too many return
statements within this function. Open
Open
return state;
Avoid too many return
statements within this function. Open
Open
if (index === -1) return list;
Avoid too many return
statements within this function. Open
Open
return state.updateIn(['map', todo.id, 'completed'], value => !value);
Avoid too many return
statements within this function. Open
Open
return state.update('map', map => map.delete(id));
Avoid too many return
statements within this function. Open
Open
return list.delete(index);
Avoid too many return
statements within this function. Open
Open
return list;