streetmix/streetmix

View on GitHub

Showing 110 of 370 total issues

Function ElevationControl has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

function ElevationControl ({ position, segment, forceEnable = false }) {
  const isSubscriber = useSelector((state) => state.user.isSubscriber)
  const dispatch = useDispatch()
  const intl = useIntl()

Severity: Minor
Found in assets/scripts/info_bubble/ElevationControl.jsx - 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 drawSegmentImage has 12 arguments (exceeds 4 allowed). Consider refactoring.
Open

  id,
  ctx,
  sx = 0,
  sy = 0,
  sw,
Severity: Major
Found in assets/scripts/segments/view.js - About 1 hr to fix

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

  render () {
    const { segment, enableAnalytics = true, capacitySource } = this.props

    const segmentInfo = getSegmentInfo(segment.type)

Severity: Minor
Found in assets/scripts/segments/Segment.jsx - 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 componentDidUpdate has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  componentDidUpdate (prevProps, prevState) {
    if (prevProps.street.width !== this.props.street.width) {
      // We are permitted one setState in componentDidUpdate if
      // it's inside of a condition, like it is now.
      this.handleStreetResize()
Severity: Minor
Found in assets/scripts/app/StreetView.jsx - 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 updateUnits has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export function updateUnits (newUnits) {
  let fromUndo
  const street = store.getState().street
  if (street.units === newUnits) {
    return
Severity: Minor
Found in assets/scripts/users/localization.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 getMenuPosition has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

function getMenuPosition (
  el: HTMLElement | null, // menu container element
  menuItemNode?: HTMLElement, // menu content element
  contentDirection: 'ltr' | 'rtl' = 'ltr',
  alignOpposite = false // whether element is right-aligned
Severity: Minor
Found in assets/scripts/menubar/menus/Menu.tsx - 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 drawBuilding has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

  ctx,
  variant,
  floors,
  position,
  totalWidth,
Severity: Major
Found in assets/scripts/segments/buildings.js - About 1 hr to fix

Function drawSegmentContents has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

  ctx,
  type,
  variantString,
  actualWidth,
  offsetLeft,
Severity: Major
Found in assets/scripts/segments/view.js - About 1 hr to fix

Function onGlobalKeyDown has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

function onGlobalKeyDown (event) {
  const toExecute = []
  const key = event.key

  // There is a bug in Chrome where events can be fired with an
Severity: Minor
Found in assets/scripts/app/keypress.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 parseStringForUnits has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Confirmed

function parseStringForUnits (widthInput: string, units: UnitsSetting): number {
  if (widthInput.includes('-')) {
    widthInput = widthInput.replace(/-/g, '') // Dashes would mean negative in the parseFloat
  }

Severity: Minor
Found in assets/scripts/util/width_units.ts - 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 drawStreetThumbnail has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export function drawStreetThumbnail (
  ctx,
  street,
  {
    width,
Severity: Minor
Found in assets/scripts/streets/thumbnail.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 getRandomObjects has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export function getRandomObjects (
  pool,
  maxWidth,
  randSeed = 9123984, // self defined randSeed if one is not provided
  minSpacing,
Severity: Minor
Found in assets/scripts/segments/scatter.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 ProfileSettings has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function ProfileSettings (props) {
  const displayNameInputRef = useRef()
  const user = useSelector((state) => state.user.signInData?.details)
  const [displayNameValue, setDisplayNameValue] = useState(
    user.displayName || user.id
Severity: Minor
Found in assets/scripts/dialogs/Settings/ProfileSettings.jsx - 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 WhatsNewDialog has 102 lines of code (exceeds 100 allowed). Consider refactoring.
Open

const WhatsNewDialog = () => {
  const locale = useSelector((state) => state.locale.locale)
  const [state, setSubmitState] = useState('LOADING')
  const [content, setContent] = useState(null)
  const [scrollShade, setScrollShade] = useState(false)
Severity: Major
Found in assets/scripts/dialogs/WhatsNewDialog.jsx - About 1 hr to fix

Function getRandomObjects has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

  pool,
  maxWidth,
  randSeed = 9123984, // self defined randSeed if one is not provided
  minSpacing,
  maxSpacing,
Severity: Major
Found in assets/scripts/segments/scatter.js - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

    if (
      (item.shiftKey === event.shiftKey || item.shiftKey === 'optional') &&
      (item.altKey === event.altKey || item.altKey === 'optional') &&
      (item.metaKey === event.metaKey ||
        item.metaKey === event.ctrlKey ||
Severity: Major
Found in assets/scripts/app/keypress.js - About 1 hr to fix

Function drawSky has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

  ctx,
  street,
  width,
  height,
  dpi,
Severity: Major
Found in assets/scripts/streets/thumbnail.js - About 1 hr to fix

Function unpackServerStreetData has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export function unpackServerStreetData (
  transmission,
  id,
  namespacedId,
  checkIfNeedsToBeRemixed
Severity: Minor
Found in assets/scripts/streets/xhr.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 handleSegmentCanvasDrop has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function handleSegmentCanvasDrop (draggedItem, type) {
  // `oldDraggingState` can be `null` or undefined, if so, bail
  if (!oldDraggingState) return

  const { segmentBeforeEl, segmentAfterEl, draggedSegment } = oldDraggingState
Severity: Minor
Found in assets/scripts/segments/drag_and_drop.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 ToastContainer has a Cognitive Complexity of 9 (exceeds 5 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)
Severity: Minor
Found in assets/scripts/ui/Toasts/ToastContainer.tsx - 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

Severity
Category
Status
Source
Language