Showing 332 of 806 total issues
Function StreetMetaWidthContainer
has 82 lines of code (exceeds 25 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
)
- Create a ticketCreate a ticket
Function Scrollable
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
const WrappedScrollable = forwardRef(function Scrollable (
props: ScrollableProps,
ref: React.Ref<HTMLDivElement>
): React.ReactElement {
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 MenusContainer
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
function MenusContainer (): React.ReactElement {
const activeMenu = useSelector((state): string | null => state.menus)
const [activeMenuItemNode, setActiveMenuItemNode] = useState<
HTMLElement | undefined
>(undefined)
- Create a ticketCreate a ticket
File width_units.test.js
has 299 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { processWidthInput, prettifyWidth } from '../width_units'
import {
SETTINGS_UNITS_IMPERIAL,
SETTINGS_UNITS_METRIC
} from '../../users/constants'
- Create a ticketCreate a ticket
Function _signInLoaded
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
function _signInLoaded () {
loadSettings()
const street = store.getState().street
let mode = getMode()
- 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 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.json'
- Create a ticketCreate a ticket
Function Warnings
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Warnings = (props: WarningsProps): React.ReactElement | null => {
const { segment } = props
const messages = []
if (segment?.warnings === undefined) return null
- Create a ticketCreate a ticket
Function default
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default async function (req, res, next) {
const userId = req.params.user_id
const namespacedId = req.params.namespacedId
if (!userId || !namespacedId) {
- Create a ticketCreate a ticket
Function render
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { segment, enableAnalytics = true, capacitySource } = this.props
const segmentInfo = getSegmentInfo(segment.type)
- 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
File SaveAsImageDialog.jsx
has 288 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* Save as Image (dialog box)
*
* Handles interaction on the "Save as image" dialog box.
*
- Create a ticketCreate a ticket
Function get
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function get (req, res) {
// Flag error if user ID is not provided
if (!req.params.street_id) {
res.status(400).json({ status: 400, msg: 'Please provide a street id.' })
return
- Create a ticketCreate a ticket
Function get
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function get (req, res) {
// Flag error if user ID is not provided
if (!req.params.user_id) {
res.status(400).json({ status: 400, msg: 'Please provide user ID.' })
return
- Create a ticketCreate a ticket
Function del
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function del (req, res) {
if (!req.auth) {
res.status(401).end()
return
}
- Create a ticketCreate a ticket
Function DebugInfo
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
function DebugInfo (): React.ReactElement | null {
const panelEl = useRef<HTMLDivElement>(null)
const textareaEl = useRef<HTMLTextAreaElement>(null)
const [isVisible, setVisible] = useState(false)
const settings = useSelector((state) => state.settings)
- Create a ticketCreate a ticket
Function streetsToCSV
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function streetsToCSV (json) {
const SEGMENT_REPLACE_HEADER = '<segments>'
const streets = json.streets
const maxSegmentCount = streets.reduce((value, street) => {
- Create a ticketCreate a ticket
Function _signInLoaded
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _signInLoaded () {
loadSettings()
const street = store.getState().street
let mode = getMode()
- Create a ticketCreate a ticket
Function del
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function del (req, res) {
// Flag error if user ID is not provided
if (!req.params.user_id) {
res.status(400).json({ status: 400, msg: 'Please provide user ID.' })
return
- Create a ticketCreate a ticket
Function onEverythingLoaded
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
function onEverythingLoaded () {
if (getMode() === MODES.NEW_STREET_COPY_LAST) {
fetchLastStreet()
}
- Create a ticketCreate a ticket
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"