Showing 36 of 276 total issues
Function reducer
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
const reducer = (state: BasketType = new Map(), action: ActionType): BasketType => {
switch (action.type) {
case ADD_TO_BASKET: {
const { payload: item } = action;
const { id } = item;
Function giftsReducer
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function giftsReducer(state = initialGifts, action) {
switch (action.type) {
case TYPES.OPEN_GIFT_MODAL:
return Object.assign({}, state, { giftModalOpen: true });
Function giftSetReducer
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function giftSetReducer(state = giftSet, action) {
switch (action.type) {
case TYPES.LOAD_GIFT_SET_REQUEST:
return Object.assign({}, state, { loading: true });
Function exports
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
module.exports = ({ express, secure }) => {
const router = new express.Router();
router
.route('/')
- 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 exports
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
module.exports = ({ express, secure }) => {
const router = new express.Router();
router
.route('/')
- 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 render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { isAuthenticated, user, children, width } = this.props;
const { navDrawerOpen } = this.state;
let docked = false;
Function createGiftSet
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
wrap(function* createGiftSet(req, res) {
req.checkBody('giver').notEmpty();
req.checkBody('giver.forename').notEmpty();
req.checkBody('giver.surname').notEmpty();
req.checkBody('giver.email').isEmail();
Function giftSetReducer
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function giftSetReducer(state = giftSets, action) {
switch (action.type) {
case TYPES.LOAD_GIFT_SETS_REQUEST:
return Object.assign({}, state, { loading: true });
Function authReducer
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function authReducer(state = auth, action) {
switch (action.type) {
case TYPES.LOGIN_REQUEST:
return Object.assign({}, state, { saving: true });
Function resetPassword
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
wrap(function* resetPassword(req, res) {
req.checkBody('token').equals(req.params.token);
req.checkBody('password', MINIMUM_PASSWORD_MESSAGE).isLength({ min: MINIMUM_PASSWORD_LENGTH });
req.checkBody('confirmPassword').equals(req.body.confirmPassword);
Function authenticate
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
wrap(function* authenticate(req, res) {
req.checkBody('email').isEmail();
req.checkBody('password').notEmpty();
const errors = req.validationErrors();
Function exports
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
module.exports = ({ express, secure }) => {
const router = new express.Router();
router
.route('/')
- 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 reducer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const reducer = (state: BasketType = new Map(), action: ActionType): BasketType => {
switch (action.type) {
case ADD_TO_BASKET: {
const { payload: item } = action;
const { id } = item;
- 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 createErrorNotifications
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const createErrorNotifications = ({ payload }): NotificationType | Array<NotificationType> => {
const notifications = [];
if (payload.response && payload.response.body && (payload.response.body.message || payload.response.body.errors)) {
if (payload.response.body.message) {
- 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 move
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function move({ sourceId, targetId, data }) {
const items = [...data];
const sourceIndex = items.findIndex(o => o.id === sourceId);
const targetIndex = items.findIndex(o => o.id === targetId);
const movingUp = sourceIndex > targetIndex;
- 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 exports
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
module.exports = ({ express }) => {
const router = new express.Router();
router
.route('/:token')
- 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"