aviabird/travel-app

View on GitHub

Showing 26 of 47 total issues

Function reducer has 96 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function reducer(state = initialState, action: Action): State {
  switch (action.type) {
    case userAuthActions.LOGIN_SUCCESS: {
      return Object.assign({}, state, {
        user: action.payload,
Severity: Major
Found in src/app/reducers/user.reducer.ts - About 3 hrs to fix

    Function reducer has 93 lines of code (exceeds 25 allowed). Consider refactoring.
    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
    Severity: Major
    Found in src/app/reducers/trips.reducer.ts - About 3 hrs to fix

      Function reducer has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      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])
      Severity: Minor
      Found in src/app/reducers/comments.reducer.ts - About 1 hr to fix

        Function exports has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = function (config) {
          config.set({
            basePath: '',
            frameworks: ['jasmine', 'angular-cli'],
            plugins: [
        Severity: Minor
        Found in karma.conf.js - About 1 hr to fix

          Function update_user_profile_media has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private update_user_profile_media(data, mediaType) {
              const headers = new Headers({
                'Content-Type': 'application/json',
                'Authorization': this.auth_token
              })
          Severity: Minor
          Found in src/app/services/cloudinary-integration.service.ts - About 1 hr to fix

            Function reducer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            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
            Severity: Minor
            Found in src/app/reducers/trips.reducer.ts - About 35 mins to fix

            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

                validate(c: AbstractControl): { [key: string]: any } {
                    // self value
                    let v = c.value;
            
                    // control vlaue
            Severity: Minor
            Found in src/app/Validators/equal-validator.directive.ts - About 35 mins to fix

            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 Object.assign({}, state, {
                    selected_user: Object.assign({}, state.selected_user, {
                      pictures: action.payload
                    })
                  })
            Severity: Major
            Found in src/app/reducers/user.reducer.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return state;
              Severity: Major
              Found in src/app/reducers/trips.reducer.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return Object.assign({}, state, {
                        selected_user: Object.assign({}, state.selected_user, {
                          tripIds: trip_ids
                        })
                      })
                Severity: Major
                Found in src/app/reducers/user.reducer.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        return Object.assign({}, state, {
                          selected_user: Object.assign({}, state.selected_user, {
                            following: action.payload
                          })
                        })
                  Severity: Major
                  Found in src/app/reducers/user.reducer.ts - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                          return state;
                    Severity: Major
                    Found in src/app/reducers/user.reducer.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return Object.assign({}, state, {
                              selected_user: Object.assign({}, state.selected_user, {
                                followers: action.payload
                              })
                            })
                      Severity: Major
                      Found in src/app/reducers/user.reducer.ts - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                              return Object.assign({}, state, {
                                user: action.payload
                              })
                        Severity: Major
                        Found in src/app/reducers/user.reducer.ts - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                return Object.assign({}, state, {
                                  tripIds: [...state.tripIds, trip.id],
                                  entities: Object.assign({}, state.entities, newTrip)
                                })
                          Severity: Major
                          Found in src/app/reducers/trips.reducer.ts - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    return Object.assign({}, state, {
                                      entities: trips
                                    })
                            Severity: Major
                            Found in src/app/reducers/trips.reducer.ts - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                    return Object.assign({}, state, {
                                      selected_user: {}
                                    })
                              Severity: Major
                              Found in src/app/reducers/user.reducer.ts - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                      return Object.assign({}, state, {
                                        selected_user: Object.assign({}, state.selected_user, {
                                          user: action.payload
                                        })
                                      })
                                Severity: Major
                                Found in src/app/reducers/user.reducer.ts - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                        return Object.assign({}, state, {
                                          selectedTripId: null
                                        })
                                  Severity: Major
                                  Found in src/app/reducers/trips.reducer.ts - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                          return Object.assign({}, state, {
                                            user: action.payload,
                                            auth: true
                                          })
                                    Severity: Major
                                    Found in src/app/reducers/user.reducer.ts - About 30 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language