fbi-cde/crime-data-frontend

View on GitHub

Showing 176 of 242 total issues

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

  render() {
    const { places, summaries, region, states, filters } = this.props
    const placeName = lookupDisplayName(filters, region.regions, states.states)
    const isReady = !summaries.loading

Severity: Major
Found in src/containers/TrendContainer.js - About 2 hrs to fix

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

      render() {
        const { actions, agencies, filters, params, region, states } = this.props
    
        const { pageType } = params
        const { place, placeType } = getPlaceInfo(params)
    Severity: Minor
    Found in src/pages/Explorer.js - About 2 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 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      render() {
        const { error } = this.state
        const { ariaControls, since, until } = this.props
    
        return (
    Severity: Major
    Found in src/components/TimePeriodFilter.js - About 2 hrs to fix

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

        render() {
          const { crime } = this.props
          const { caveats, links } = content.crimes[crime]
      
          return (
      Severity: Major
      Found in src/components/AboutTheData.js - About 2 hrs to fix

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

          render() {
            const { error } = this.state
        
            return (
              <div>
        Severity: Minor
        Found in src/components/Glossary.js - About 1 hr to fix

          Function offenderDemo has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const offenderDemo = data => {
            const {
              offenderAgeNum,
              offenderEthnicity,
              offenderRaceCode,
          Severity: Minor
          Found in src/util/nibrs.js - About 1 hr to fix

            Function render has a Cognitive Complexity of 13 (exceeds 5 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: Minor
            Found in src/components/downloads/DownloadFilesTable.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 XAxis has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

            const XAxis = ({ active, tickCt, tickSizeOuter, height, scale, showLine }) => {
              const range = scale.range()
              const [range0, range1, k] = [range[0] + 0.5, range[range.length - 1] + 0.5, 1]
              const domain = `M${range0},${k * tickSizeOuter}V0.5H${range1}V${k *
                tickSizeOuter}`
            Severity: Minor
            Found in src/components/XAxis.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 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              render() {
                const {
                  agency,
                  isAgency,
                  policeEmployment,
            Severity: Minor
            Found in src/containers/PoliceEmploymentContainer.js - About 1 hr to fix

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

                render() {
                  const {
                    ariaControls,
                    className,
                    onFocus,
              Severity: Minor
              Found in src/components/LocationSelect.js - About 1 hr to fix

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

                  render() {
                    /* eslint-disable */
                    const {
                      coordinates,
                      place,
                Severity: Minor
                Found in src/components/PlaceThumbnail.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 victimDemo has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const victimDemo = data => {
                  const { victimAgeNum, victimEthnicity, victimRaceCode, victimSexCode } = data
                
                  return {
                    title: 'Victim demographics',
                Severity: Minor
                Found in src/util/nibrs.js - About 1 hr to fix

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

                  export const fetchUcrParticipation = filters => dispatch => {
                    dispatch(fetchingUcrParticipation())
                    const params = { size: 100 }
                  
                    const { place, placeType, placeId } = filters
                  Severity: Minor
                  Found in src/actions/participation.js - About 1 hr to fix

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

                      render() {
                        const { data, size, yMax } = this.props
                        const { svgParentWidth } = this.state
                        const { margin } = size
                        const width = svgParentWidth || size.width
                    Severity: Minor
                    Found in src/components/Sparkline.js - About 1 hr to fix

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

                      const participationCsvLink = (place, type, states, participation) => {
                        if (type === 'agency') return []
                        if (type === 'region') return []
                      
                        const clickHander = () => {
                      Severity: Minor
                      Found in src/components/UcrResourcesList.js - About 1 hr to fix

                        Function validateFilter has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                        const validateFilter = filters => {
                          const newFilters = { ...filters }
                          if (filters.page === null) {
                            newFilters.page = defaults.page
                            newFilters.pageType = defaults.pageType
                        Severity: Minor
                        Found in src/util/filter.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 ExplorerHeaderContainer has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                        const ExplorerHeaderContainer = ({
                          agencies,
                          agency,
                          coordinates,
                          isAgency,
                        Severity: Minor
                        Found in src/containers/ExplorerHeaderContainer.js - About 55 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 NibrsCard has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                        const NibrsCard = ({ crime, data, place, placeType, since, title, until }) => {
                          const charts = data.map((d, i) => {
                            const props = {
                              key: i,
                              id: slugify(d.title || title).replace(/['’]/g, ''),
                        Severity: Minor
                        Found in src/components/nibrs/NibrsCard.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 filterByYear has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export const filterByYear = (summaries, since, until) => {
                          const places = Object.keys(summaries).map(place => {
                            const filtered = summaries[place].filter(y => {
                              const { year } = y
                              if (since && until && +year >= since && +year <= until) return true
                        Severity: Minor
                        Found in src/util/summary.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 fetchLeoka has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export const fetchLeoka = params => dispatch => {
                          dispatch(fetchingLeoka())
                        
                          const { placeType, place, placeId } = params
                        
                        
                        Severity: Minor
                        Found in src/actions/leoka.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

                        Severity
                        Category
                        Status
                        Source
                        Language