Showing 26 of 47 total issues
Function reducer
has 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function reducer(state = initialState, action: Action): State {
switch (action.type) {
case userAuthActions.LOGIN_SUCCESS: {
return Object.assign({}, state, {
user: action.payload,
Function reducer
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function reducer(state = initialState, action: Action): State {
switch (action.type) {
// TODO: CS: Refactor these return objects also make sure this
// is consistent in other reducers too.
// https://www.pivotaltracker.com/story/show/136717477
Function reducer
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function reducer(state = initialState, action: comment.Actions): State {
switch(action.type) {
case comment.ActionTypes.LOAD_COMMENTS_SUCCESS: {
const comments = <Comment[]>action.payload;
const newComments = comments.filter(comment => !state.entities[comment.id])
Function exports
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', 'angular-cli'],
plugins: [
Function update_user_profile_media
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private update_user_profile_media(data, mediaType) {
const headers = new Headers({
'Content-Type': 'application/json',
'Authorization': this.auth_token
})
Function reducer
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
export function reducer(state = initialState, action: Action): State {
switch (action.type) {
// TODO: CS: Refactor these return objects also make sure this
// is consistent in other reducers too.
// https://www.pivotaltracker.com/story/show/136717477
- 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 validate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
validate(c: AbstractControl): { [key: string]: any } {
// self value
let v = c.value;
// control vlaue
- 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 Object.assign({}, state, {
selected_user: Object.assign({}, state.selected_user, {
pictures: action.payload
})
})
Avoid too many return
statements within this function. Open
Open
return state;
Avoid too many return
statements within this function. Open
Open
return Object.assign({}, state, {
selected_user: Object.assign({}, state.selected_user, {
tripIds: trip_ids
})
})
Avoid too many return
statements within this function. Open
Open
return Object.assign({}, state, {
selected_user: Object.assign({}, state.selected_user, {
following: action.payload
})
})
Avoid too many return
statements within this function. Open
Open
return state;
Avoid too many return
statements within this function. Open
Open
return Object.assign({}, state, {
selected_user: Object.assign({}, state.selected_user, {
followers: action.payload
})
})
Avoid too many return
statements within this function. Open
Open
return Object.assign({}, state, {
user: action.payload
})
Avoid too many return
statements within this function. Open
Open
return Object.assign({}, state, {
tripIds: [...state.tripIds, trip.id],
entities: Object.assign({}, state.entities, newTrip)
})
Avoid too many return
statements within this function. Open
Open
return Object.assign({}, state, {
entities: trips
})
Avoid too many return
statements within this function. Open
Open
return Object.assign({}, state, {
selected_user: {}
})
Avoid too many return
statements within this function. Open
Open
return Object.assign({}, state, {
selected_user: Object.assign({}, state.selected_user, {
user: action.payload
})
})
Avoid too many return
statements within this function. Open
Open
return Object.assign({}, state, {
selectedTripId: null
})
Avoid too many return
statements within this function. Open
Open
return Object.assign({}, state, {
user: action.payload,
auth: true
})