Showing 332 of 806 total issues
Function getSharingMessage
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
export function getSharingMessage (
street: StreetState,
user: UserState,
intl: IntlShape
): string {
- 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.tsx
has 274 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { memo } from 'react'
import { FormattedMessage } from 'react-intl'
import { useSelector } from '../store/hooks'
import ExternalLink from '../ui/ExternalLink'
- Create a ticketCreate a ticket
Function renderButton
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
function renderButton (
set: string,
selection: string
): React.ReactElement | null {
const icon = VARIANT_ICONS[set][selection]
- Create a ticketCreate a ticket
Function processCommands
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
function processCommands (commands) {
// If a string, force to one-element array, otherwise expect an array of strings
if (typeof commands === 'string') {
commands = new Array(commands)
}
- Create a ticketCreate a ticket
Function SkyPicker
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
function SkyPicker (): React.ReactElement {
const selected = useSelector(
(state) => state.street.skybox || DEFAULT_SKYBOX
)
const show = useSelector((state) => state.ui.toolboxVisible || false)
- Create a ticketCreate a ticket
Function FirstTimeExistingStreet
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
function FirstTimeExistingStreet (props) {
const street = useSelector((state) => state.street)
const { data: creatorProfile } = useGetUserQuery(street.creatorId)
function handleGoNewStreet (event) {
- 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
Function StreetMetaWidthContainer
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function StreetMetaWidthContainer (): React.ReactElement {
const street = useSelector((state) => state.street)
const editable = useSelector(
(state) => !state.app.readOnly && state.flags.EDIT_STREET_WIDTH.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 render
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const classNames = ['blocking-shield']
if (this.state.visible) {
classNames.push('visible')
- Create a ticketCreate a ticket
Function InfoBubbleHeader
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
function InfoBubbleHeader (props: InfoBubbleHeaderProps): React.ReactElement {
const { type, position } = props
const { locale, segmentInfo } = useSelector((state) => state.locale)
const street = useSelector((state) => state.street)
- Create a ticketCreate a ticket
Function initCoil
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
const initCoil = () => {
const authToken = btoa(
process.env.COIL_CLIENT_ID +
':' +
encodeURIComponent(process.env.COIL_CLIENT_SECRET)
- Create a ticketCreate a ticket
Function get
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function get (req, res) {
// Flag error if user ID is not provided
const userId = req.params.user_id
const handleError = function (error) {
- Create a ticketCreate a ticket
File GeotagDialog.jsx
has 262 lines of code (exceeds 250 allowed). Consider refactoring. 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 SocialLinks
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
function SocialLinks (): React.ReactElement {
return (
<ul className="social-links">
<li>
<a
- Create a ticketCreate a ticket
Function getSharingMessage
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function getSharingMessage (
street: StreetState,
user: UserState,
intl: IntlShape
): string {
- Create a ticketCreate a ticket
Function post
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function post (req, res) {
const authUser = req.auth || {}
if (!authUser.sub) {
res.status(401).json({ status: 401, msg: 'Please provide user ID.' })
- Create a ticketCreate a ticket
Function registerKeypresses
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function registerKeypresses () {
// In case anyone tries a save shortcut key out of reflex,
// we inform the user that it's not necessary.
registerKeypress('ctrl s', function () {
store.dispatch(
- Create a ticketCreate a ticket
File votes.js
has 259 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Sequelize from 'sequelize'
import { v4 as uuidv4 } from 'uuid'
import models from '../../db/models/index.js'
import logger from '../../lib/logger.js'
- Create a ticketCreate a ticket
Function SentimentSurveyDialog
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
function SentimentSurveyDialog (props) {
return (
<Dialog>
{(closeDialog) => (
<div className="sentiment-survey-about-dialog">
- 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