Showing 110 of 370 total issues
File authentication.js
has 295 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Cookies from 'js-cookie'
import { jwtDecode } from 'jwt-decode'
import * as Sentry from '@sentry/browser'
import USER_ROLES from '../../../app/data/user_roles'
- Create a ticketCreate a ticket
Function deregisterKeypress
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
export function deregisterKeypress (commands, callback) {
const commandObj = processCommands(commands)
// Process each command input
for (const key in commandObj) {
- 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"
Further reading
Function processUrl
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
export function processUrl () {
// Get current pathname. The pathname will contain an initial `/` followed
// by the path of the URL. The root pathname should always be `/`. It may
// be possible for the URL to contain a trailing slash, but we don't want
// that, so remove it, if present. This will cause the root pathname to be
- 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"
Further reading
File AboutDialog.jsx
has 274 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* About Streetmix (dialog box)
*
* Renders the "About" dialog box.
*
- Create a ticketCreate a ticket
Function onEverythingLoaded
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function onEverythingLoaded () {
if (getMode() === MODES.NEW_STREET_COPY_LAST) {
fetchLastStreet()
}
- 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"
Further reading
File GeotagDialog.jsx
has 262 lines of code (exceeds 250 allowed). Consider refactoring. Confirmed
/* 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
File StreetView.jsx
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* StreetView.jsx
*
* Renders the street view.
*
- Create a ticketCreate a ticket
Function drawBuilding
has 129 lines of code (exceeds 100 allowed). Consider refactoring. Open
export function drawBuilding (
ctx,
variant,
floors,
position,
- Create a ticketCreate a ticket
Function errorReceiveStreet
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function errorReceiveStreet (error) {
const data = error.response.data
const mode = getMode()
if (
mode === MODES.CONTINUE ||
- 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"
Further reading
Function ToastContainer
has 127 lines of code (exceeds 100 allowed). Consider refactoring. Open
function ToastContainer (): React.ReactElement {
const config = TOAST_SPRING_CONFIG
const [refMap] = useState(() => new WeakMap())
const [cancelMap] = useState(() => new WeakMap())
const toasts = useSelector((state) => state.toasts)
- Create a ticketCreate a ticket
Function GalleryStreetItem
has 123 lines of code (exceeds 100 allowed). Consider refactoring. Open
function GalleryStreetItem (
props: GalleryStreetItemProps
): React.ReactElement | null {
const {
street,
- Create a ticketCreate a ticket
Function incrementSegmentWidth
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export const incrementSegmentWidth = (
dataNo,
add,
precise,
origWidth,
- 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"
Further reading
Function hover
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
hover (props, monitor, component) {
if (!monitor.canDrop()) return
const dragIndex = monitor.getItem().dataNo
const hoverIndex = props.dataNo
- 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"
Further reading
Function Scrollable
has 119 lines of code (exceeds 100 allowed). Consider refactoring. Open
const WrappedScrollable = forwardRef(function Scrollable (
props: ScrollableProps,
ref: React.Ref<HTMLDivElement>
): React.ReactElement {
const {
- Create a ticketCreate a ticket
Function StreetNameplateContainer
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Confirmed
function StreetNameplateContainer (props) {
const isVisible = useSelector((state) => !state.ui.welcomePanelVisible)
const isEditable = useSelector(
(state) => !state.app.readOnly && state.flags.EDIT_STREET_NAME.value
)
- 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"
Further reading
Function NotificationBar
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function NotificationBar ({
notification = {}
}: NotificationBarProps): React.ReactElement | null {
const locale = useSelector((state) => state.locale)
const {
- 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"
Further reading
Function GalleryStreetItem
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function GalleryStreetItem (
props: GalleryStreetItemProps
): React.ReactElement | null {
const {
street,
- 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"
Further reading
Function doDropHeuristics
has 118 lines of code (exceeds 100 allowed). Consider refactoring. Open
function doDropHeuristics (draggedItem, draggedItemType) {
// Automatically figure out width
const street = store.getState().street
const { variantString, type, actualWidth } = draggedItem
- Create a ticketCreate a ticket
Function BuildingHeightControl
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function BuildingHeightControl ({ position }) {
const units = useSelector((state) => state.street.units)
// Get the appropriate building data based on which side of street it's on
const variant = useSelector((state) =>
- 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"
Further reading
Function show
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
show: function (force) {
if (infoBubble.suppressed) {
window.setTimeout(infoBubble.show, 100)
return
}
- 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"