streetmix/streetmix

View on GitHub

Showing 332 of 806 total issues

Function remixStreet has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function remixStreet () {
  let dontAddSuffix
  if (app.readOnly) {
    return
  }
Severity: Minor
Found in client/src/streets/remix.js - About 1 hr to fix

Function drawWatermark has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function drawWatermark (ctx, dpi, invert = false) {
  const text = formatMessage(
    'export.watermark',
    'Made with {streetmixWordmark}',
    {
Severity: Minor
Found in client/src/streets/thumbnail.js - About 1 hr to fix

Function get has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export async function get (req, res) {
  const query = req.query

  if (!req.auth?.sub) {
    res.status(401).json({ status: 401, msg: 'Please provide user ID.' })
Severity: Minor
Found in app/resources/services/images.js - About 1 hr to fix

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

function GalleryStreetItem (
  props: GalleryStreetItemProps
): React.ReactElement | null {
  const {
    street,
Severity: Minor
Found in client/src/gallery/GalleryStreetItem.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 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
    }
Severity: Minor
Found in client/src/info_bubble/info_bubble.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 ElevationControl has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

function ElevationControl ({
  position,
  segment,
  forceEnable = false
}: ElevationControlProps): React.ReactElement {
Severity: Minor
Found in client/src/info_bubble/InfoBubbleControls/ElevationControl.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 patch has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export async function patch (req, res) {
  let body
  try {
    body = req.body
  } catch (e) {
Severity: Minor
Found in app/resources/v1/users.js - About 1 hr to fix

Function render has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render () {
    return (
      <>
        <section
          id="street-section-outer"
Severity: Minor
Found in client/src/app/StreetView.jsx - About 1 hr to fix

Function UnitSettings has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function UnitSettings (): React.ReactElement {
  const units = useSelector((state) => state.settings.units)
  const dispatch = useDispatch()
  const intl = useIntl()

Severity: Minor
Found in client/src/dialogs/Settings/UnitSettings.tsx - About 1 hr to fix

Function getStreetImage has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function getStreetImage (
  street,
  transparentSky,
  segmentNamesAndWidths,
  streetName,
Severity: Minor
Found in client/src/streets/image.js - About 1 hr to fix

Function SkyContainer has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function SkyContainer (props: SkyContainerProps): React.ReactElement {
  const { scrollPos = 0 } = props
  const skybox: string = useSelector(
    (state) => state.street.skybox || DEFAULT_SKYBOX
  )
Severity: Minor
Found in client/src/sky/SkyBox/SkyBox.tsx - About 1 hr to fix

Function drawSegmentImage has 12 arguments (exceeds 4 allowed). Consider refactoring.
Open

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

Function drawScatteredSprites has 12 arguments (exceeds 4 allowed). Consider refactoring.
Open

  sprites,
  ctx,
  width,
  offsetLeft,
  groundLevel,
Severity: Major
Found in client/src/segments/scatter.js - About 1 hr to fix

Function get has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Confirmed

export async function get (req, res) {
  let results

  try {
    results = await Street.findOne({
Severity: Minor
Found in app/resources/v1/geo.js - About 1 hr to fix

Function updateUnits has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function updateUnits (newUnits) {
  let fromUndo
  const street = store.getState().street
  if (street.units === newUnits) {
    return
Severity: Minor
Found in client/src/users/localization.js - About 1 hr to fix

Function addUserConnection has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function addUserConnection (account, profile) {
  const identities = account.identities
  const identity = {
    provider: profile.provider,
    user_id: profile.id,
Severity: Minor
Found in app/resources/services/integrations/helpers.js - About 1 hr to fix

Function drawClouds has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function drawClouds (ctx, width, height, dpi, sky) {
  // Handle cloud opacity
  ctx.save()
  ctx.globalAlpha = sky.cloudOpacity ?? 1

Severity: Minor
Found in client/src/streets/thumbnail.js - About 1 hr to fix

Function hover has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  hover (props, monitor, component) {
    if (!monitor.canDrop()) return

    const dragIndex = monitor.getItem().dataNo
    const hoverIndex = props.dataNo
Severity: Minor
Found in client/src/segments/drag_and_drop.js - About 1 hr to fix

Function CapacitySources has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function CapacitySources (): React.ReactElement {
  const source = useSelector(
    (state) => state.street?.capacitySource ?? DEFAULT_CAPACITY_SOURCE
  )
  const dispatch = useDispatch()
Severity: Minor
Found in client/src/dialogs/Analytics/CapacitySources.tsx - About 1 hr to fix

Function drawStreetNameplate has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function drawStreetNameplate (ctx, street, width, dpi) {
  let text = street.name || formatMessage('street.default-name', 'Unnamed St')

  ctx.textAlign = 'center'
  ctx.textBaseline = 'center'
Severity: Minor
Found in client/src/streets/thumbnail.js - About 1 hr to fix
Severity
Category
Status
Source
Language