client/src/dialogs/GeotagDialog.jsx
Function GeotagDialog
has 169 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function GeotagDialog () {
// this kinda goofy props object is a result of refactoring
// some legacy code. definetly worth refactoring further in the future
// if it causes other problems or confusion
const props = {
- Create a ticketCreate a ticket
File GeotagDialog.jsx
has 262 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/* global L */
import React, { useState } from 'react'
import PropTypes from 'prop-types'
import { useSelector, useDispatch, batch } from 'react-redux'
import { useIntl } from 'react-intl'
- Create a ticketCreate a ticket
Function getInitialState
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function getInitialState (props) {
// Determine initial map center, and what to display
let mapCenter, zoom, markerLocation, label
// If street has a location object, use its position and data
- Create a ticketCreate a ticket
Function GeotagDialog
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
function GeotagDialog () {
// this kinda goofy props object is a result of refactoring
// some legacy code. definetly worth refactoring further in the future
// if it causes other problems or confusion
const props = {
- Read upRead up
- Create a ticketCreate a ticket
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"