fbi-cde/crime-data-frontend

View on GitHub

Showing 48 of 242 total issues

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

  render() {
    const { mapShown } = this.state
    const { region, states } = this.props
    const toggles = [
      { disabled: !mapShown, type: 'table' },
Severity: Major
Found in src/pages/About.js - About 1 day to fix

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

      render() {
        const {
          colors,
          crime,
          mutedColors,
    Severity: Major
    Found in src/components/agency/AgencyChart.js - About 7 hrs to fix

      File About.js has 371 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import React from 'react'
      import Helmet from 'react-helmet'
      import { Link } from 'react-router'
      import { connect } from 'react-redux'
      import reduceEntries from 'reduce-entries'
      Severity: Minor
      Found in src/pages/About.js - About 4 hrs to fix

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

          render() {
            /* eslint-disable */
            const {
              coordinates,
              place,
        Severity: Major
        Found in src/components/PlaceThumbnail.js - About 4 hrs to fix

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

            render() {
              const {
                crime,
                colors,
                places,
          Severity: Major
          Found in src/components/trend/TrendChart.js - About 3 hrs to fix

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

              render() {
                const {
                  colors,
                  id,
                  keys,
            Severity: Major
            Found in src/components/nibrs/NibrsStackedBar.js - About 3 hrs to fix

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

                render() {
                  const {
                    data,
                    id,
                    noun,
              Severity: Major
              Found in src/components/nibrs/NibrsTableWithBars.js - About 3 hrs to fix

                Function fetchData has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                Open

                const fetchData = () => (dispatch, getState) => {
                  const { filters, region, states } = getState()
                  if (region.loaded && states.loaded) {
                    filters.placeId = getPlaceId(filters, region.region, states.states)
                    if (filters.placeType === 'state') {
                Severity: Minor
                Found in src/actions/composite.js - About 3 hrs 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 a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                Open

                  render() {
                    const { data, year, until } = this.props
                    const id = snakeCase(data.ui_text)
                
                    const { isCounts } = this.state
                Severity: Minor
                Found in src/components/graph/BarChart.js - About 3 hrs 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 83 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  render() {
                    const { actions, agencies, filters, params, region, states } = this.props
                
                    const { pageType } = params
                    const { place, placeType } = getPlaceInfo(params)
                Severity: Major
                Found in src/pages/Explorer.js - About 3 hrs to fix

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

                    render() {
                      const { data, margin, noun, size, title, xLabel } = this.props
                      const { hover } = this.state
                  
                      const id = slugify(`histogram-${title}`)
                  Severity: Major
                  Found in src/components/nibrs/NibrsHistogram.js - About 3 hrs to fix

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

                      render() {
                        const { files, sampleFile, title, fileType, link } = this.props
                        let data
                        if (sampleFile === '/files/pe_employee_data_small.json') {
                          data = peCsv
                    Severity: Major
                    Found in src/components/downloads/DownloadFilesTable.js - About 3 hrs to fix

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

                        render() {
                          const { location } = this.props
                          const { isOpen } = this.state
                      
                          return (
                      Severity: Major
                      Found in src/components/Header.js - About 3 hrs to fix

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

                          render() {
                            const { colors, changeColorOnHover, mapClick, place, stateView, states, region } = this.props
                            const { hover } = this.state
                            const svgDataWithNames = svgData.map(s => ({
                              ...s,
                        Severity: Major
                        Found in src/components/UsaMap.js - About 2 hrs to fix

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

                            render() {
                              const { data } = this.props
                              const { search, hasSelection, showResults } = this.state
                          
                              // get unique set of counties (for result grouping)
                          Severity: Major
                          Found in src/components/agency/AgencySearch.js - About 2 hrs to fix

                            File NibrsContainer.js has 269 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import startCase from 'lodash.startcase'
                            import PropTypes from 'prop-types'
                            import React from 'react'
                            import { connect } from 'react-redux'
                            
                            
                            Severity: Minor
                            Found in src/containers/NibrsContainer.js - About 2 hrs to fix

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

                              export const calculateRates = (summaries, placeType) => {
                                const nonOffenseKeys = ['caveats', 'population', 'state_abbr', 'year']
                                let places
                                if (placeType !== 'region') {
                                  places = Object.keys(summaries).map(place => {
                              Severity: Major
                              Found in src/util/summary.js - About 2 hrs to fix

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

                                  render() {
                                    const { colors, keys, data, size, title } = this.props
                                    const { hover } = this.state
                                
                                    const { height, width } = size
                                Severity: Major
                                Found in src/components/nibrs/NibrsDonut.js - About 2 hrs to fix

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

                                    render() {
                                      const { title } = this.props
                                      const details = downloadDetails.find(e => e.title === title)
                                      if (!details) return <div>TBD</div>
                                      return (
                                  Severity: Major
                                  Found in src/components/downloads/DownloadDetailsAccordionBody.js - About 2 hrs to fix

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

                                      render() {
                                        const isBtnDisabled = !(this.state.place && this.state.year)
                                        const nibrsYears = this.getYearRange(this.state.place)
                                    
                                        return (
                                    Severity: Major
                                    Found in src/components/downloads/DownloadBulkNibrs.js - About 2 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language