casey-chow/tigertrade

View on GitHub

Showing 48 of 168 total issues

Function render has 140 lines of code (exceeds 25 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: Major
Found in client/src/components/FilterBar.js - About 5 hrs to fix

    File FilterBar.js has 363 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React, { Component } from 'react';
    import PropTypes from 'prop-types';
    import { connect } from 'react-redux';
    import {
      withRouter,
    Severity: Minor
    Found in client/src/components/FilterBar.js - About 4 hrs to fix

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

        render() {
          const { listing, expanded } = this.props;
          const styles = ListingCard.styles;
      
          const favoriteButtonBackground = this.props.listing.isStarred ? grey300 : 'transparent';
      Severity: Major
      Found in client/src/components/ListingCard.js - About 4 hrs to fix

        Function build has 84 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function build(previousFileSizes) {
          console.log('Creating an optimized production build...');
          webpack(config).run((err, stats) => {
            if (err) {
              printErrors('Failed to compile.', [err]);
        Severity: Major
        Found in client/scripts/build.js - About 3 hrs to fix

          Function renderSidebarItems has 78 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            renderSidebarItems() {
              const styles = NavigationDrawer.styles;
              const currentMajorPath = this.props.location.pathname;
          
              return (
          Severity: Major
          Found in client/src/components/NavigationDrawer.js - About 3 hrs to fix

            File ListingCard.js has 287 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import React from 'react';
            import PropTypes from 'prop-types';
            import { connect } from 'react-redux';
            import {
              Link,
            Severity: Minor
            Found in client/src/components/ListingCard.js - About 2 hrs to fix

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

                render() {
                  const { handleSubmit, pristine, reset, submitting } = this.props;
                  const styles = ComposeForm.styles;
              
                  return (
              Severity: Major
              Found in client/src/components/ComposeForm.js - About 2 hrs to fix

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

                  render() {
                    const { seek, expanded } = this.props;
                    const styles = SeekCard.styles;
                
                    const boughtButtonBackground = this.props.seek.isActive ? 'transparent' : grey300;
                Severity: Major
                Found in client/src/components/SeekCard.js - About 2 hrs to fix

                  Function setupCompiler has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function setupCompiler(host, port, protocol) {
                    // "Compiler" is a low-level interface to Webpack.
                    // It lets us listen to some events and provide our own custom messages.
                    compiler = webpack(config, handleCompile);
                  
                  
                  Severity: Minor
                  Found in client/scripts/start.js - About 1 hr to fix

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

                      render() {
                        const styles = ComposeOverlay.styles;
                    
                        if (!this.props.currentUserLoading && !this.props.user.loggedIn) {
                          return <RedirectToCas />;
                    Severity: Minor
                    Found in client/src/components/ComposeOverlay.js - About 1 hr to fix

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

                        render() {
                          const { watch } = this.props;
                          const styles = WatchCard.styles;
                      
                          return (
                      Severity: Minor
                      Found in client/src/components/WatchCard.js - About 1 hr to fix

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

                          render() {
                            const { handleSubmit, pristine, reset, submitting } = this.props;
                            const styles = SeekComposeForm.styles;
                        
                            return (
                        Severity: Minor
                        Found in client/src/components/SeekComposeForm.js - About 1 hr to fix

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

                            render() {
                              const styles = ComposeOverlay.styles;
                          
                              if (!this.props.currentUserLoading && !this.props.user.loggedIn) {
                                return <RedirectToCas />;
                          Severity: Minor
                          Found in client/src/components/ComposeOverlay.js - About 1 hr 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 render has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            render() {
                              const styles = App.styles;
                          
                              return (
                                <div className="App">
                          Severity: Minor
                          Found in client/src/containers/App.js - About 1 hr to fix

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

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

                              Function parseQuery has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                              Open

                              export const parseQuery = ({ location, match }) => {
                                const queryStrings = parse(location.search);
                                const query = {
                                  query: queryStrings.query,
                                  minPrice: (queryStrings.minPrice === '' || queryStrings.minPrice === undefined) ? undefined : parseInt(queryStrings.minPrice, 10),
                              Severity: Minor
                              Found in client/src/helpers/query.js - About 1 hr 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 64 lines of code (exceeds 50 allowed). Consider refactoring.
                              Open

                              func ReadListings(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
                                  query := models.NewListingQuery()
                              
                                  // Get limit from params
                                  if limit, err := strconv.ParseUint(r.URL.Query().Get("limit"), 10, 64); err == nil && limit != 0 {
                              Severity: Minor
                              Found in server/listings.go - About 1 hr to fix

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

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

                                  Function mailSeller has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export function mailSeller(listing, data, successMessage) {
                                    return function (dispatch, getState) {
                                      dispatch({
                                        type: 'MAIL_SELLER_REQUEST',
                                        listing,
                                  Severity: Minor
                                  Found in client/src/actions/users.js - About 1 hr to fix

                                    Function buildListingQuery has 58 lines of code (exceeds 50 allowed). Consider refactoring.
                                    Open

                                    func buildListingQuery(query *ListingQuery) sq.SelectBuilder {
                                        stmt := psql.
                                            Select(
                                                "listings.key_id",
                                                "listings.creation_date",
                                    Severity: Minor
                                    Found in server/models/listings.go - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language