casey-chow/tigertrade

View on GitHub

Showing 48 of 168 total issues

Function addMiddleware has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function addMiddleware(devServer) {
  // `proxy` lets you to specify a fallback server during development.
  // Every unrecognized request will be forwarded to it.
  var proxy = require(paths.appPackageJson).proxy;
  devServer.use(historyApiFallback({
Severity: Minor
Found in client/scripts/start.js - About 1 hr to fix

    Function postWatch has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function postWatch(watch, successMessage) {
      return function (dispatch, getState) {
        dispatch({
          type: 'POST_WATCH_REQUEST',
        });
    Severity: Minor
    Found in client/src/actions/watches.js - About 1 hr to fix

      Function postSeek has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function postSeek(seek, successMessage) {
        return function (dispatch, getState) {
          dispatch({
            type: 'POST_SEEK_REQUEST',
            seek,
      Severity: Minor
      Found in client/src/actions/seeks.js - About 1 hr to fix

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

          render() {
            const styles = ActionBar.styles;
        
            const Title = () => (
              <Link
        Severity: Minor
        Found in client/src/components/ActionBar.js - About 1 hr to fix

          Function deleteWatch has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function deleteWatch(watch, successMessage) {
            return function (dispatch, getState) {
              dispatch({
                type: 'DELETE_WATCH_REQUEST',
                watch,
          Severity: Minor
          Found in client/src/actions/watches.js - About 1 hr to fix

            Function render has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              render() {
                const rest = omit(this.props, 'user');
                const styles = LoggedInMenu.styles;
            
                return (
            Severity: Minor
            Found in client/src/components/LoggedInMenu.js - About 1 hr to fix

              Function postListing has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function postListing(listing, successMessage) {
                return function (dispatch, getState) {
                  dispatch({
                    type: 'POST_LISTING_REQUEST',
                  });
              Severity: Minor
              Found in client/src/actions/listings.js - About 1 hr to fix

                Function updateSeek has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function updateSeek(seek, successMessage) {
                  return function (dispatch, getState) {
                    dispatch({
                      type: 'UPDATE_SEEK_REQUEST',
                    });
                Severity: Minor
                Found in client/src/actions/seeks.js - About 1 hr to fix

                  Function updateListing has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function updateListing(listing, successMessage) {
                    return function (dispatch, getState) {
                      dispatch({
                        type: 'UPDATE_LISTING_REQUEST',
                      });
                  Severity: Minor
                  Found in client/src/actions/listings.js - About 1 hr to fix

                    Function render has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      render() {
                        const styles = SearchBar.styles;
                        const hintText = (this.props.displayMode === 'seeks')
                              ? (<span className="hint-text">What do you want to sell?</span>)
                              : (<span className="hint-text">What do you want to buy?</span>);
                    Severity: Minor
                    Found in client/src/components/SearchBar.js - About 1 hr to fix

                      Function render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                        render() {
                          const { listing, expanded } = this.props;
                          const styles = ListingCard.styles;
                      
                          const favoriteButtonBackground = this.props.listing.isStarred ? grey300 : 'transparent';
                      Severity: Minor
                      Found in client/src/components/ListingCard.js - About 45 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 contactPost has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      func contactPost(w http.ResponseWriter, r *http.Request, ps httprouter.Params,
                          read models.PostReader, posterTemplate models.MailTemplate, readerTemplate models.MailTemplate) {
                      Severity: Minor
                      Found in server/emails.go - About 45 mins to fix

                        Function setComposeState has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        export function setComposeState(show = false, isEdit = false, mode = 'listings', listing, seek) {
                        Severity: Minor
                        Found in client/src/actions/ui.js - About 35 mins to fix

                          Function CreatePhoto has 5 return statements (exceeds 4 allowed).
                          Open

                          func CreatePhoto(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
                              user := getUsername(r)
                              if user == "" {
                                  Error(w, http.StatusUnauthorized)
                                  return
                          Severity: Major
                          Found in server/photos.go - About 35 mins to fix

                            Function getExecResultCode has 5 return statements (exceeds 4 allowed).
                            Open

                            func getExecResultCode(result sql.Result, err error) (int, error) {
                                if err != nil {
                                    return http.StatusInternalServerError, err
                                }
                                numRows, err := result.RowsAffected()
                            Severity: Major
                            Found in server/models/helpers.go - About 35 mins to fix

                              Function contactPost has 5 return statements (exceeds 4 allowed).
                              Open

                              func contactPost(w http.ResponseWriter, r *http.Request, ps httprouter.Params,
                                  read models.PostReader, posterTemplate models.MailTemplate, readerTemplate models.MailTemplate) {
                              
                                  id := ps.ByName("id")
                              
                              
                              Severity: Major
                              Found in server/emails.go - About 35 mins to fix

                                Function ReadSeeks has 5 return statements (exceeds 4 allowed).
                                Open

                                func ReadSeeks(db *sql.DB, query *SeekQuery) ([]*Seek, int, error) {
                                    if query.UserID == 0 && query.OnlyMine {
                                        return nil, http.StatusUnauthorized, errors.New("unauthenticated user attempted to view profile data")
                                    }
                                
                                
                                Severity: Major
                                Found in server/models/seeks.go - About 35 mins to fix

                                  Function render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    render() {
                                      const { query, leftDrawerVisible, location } = this.props;
                                      const styles = FilterBar.styles;
                                      const isListing = location.pathname.startsWith('/listings');
                                      const isSeek = location.pathname.startsWith('/seeks');
                                  Severity: Minor
                                  Found in client/src/components/FilterBar.js - 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 componentWillReceiveProps has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    componentWillReceiveProps(nextProps) {
                                      if (this.props.listings.length > nextProps.listings.length) {
                                        this.setState({ openCardId: -1 });
                                      }
                                  
                                  
                                  Severity: Minor
                                  Found in client/src/components/ListingsList.js - 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 ReadListings has 5 return statements (exceeds 4 allowed).
                                  Open

                                  func ReadListings(db *sql.DB, query *ListingQuery) ([]*Listing, int, error) {
                                      if query.UserID == 0 && (query.OnlyStarred || query.OnlyMine) {
                                          return nil, http.StatusUnauthorized, errors.New("unauthenticated user attempted to view profile data")
                                      }
                                  
                                  
                                  Severity: Major
                                  Found in server/models/listings.go - About 35 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language