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
}
- Create a ticketCreate a ticket
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}',
{
- Create a ticketCreate a ticket
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.' })
- Create a ticketCreate a ticket
Function GalleryStreetItem
has a Cognitive Complexity of 13 (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 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"
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 {
- 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 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) {
- Create a ticketCreate a ticket
Function render
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
return (
<>
<section
id="street-section-outer"
- Create a ticketCreate a ticket
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()
- Create a ticketCreate a ticket
Function getStreetImage
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function getStreetImage (
street,
transparentSky,
segmentNamesAndWidths,
streetName,
- Create a ticketCreate a ticket
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
)
- Create a ticketCreate a ticket
Function drawSegmentImage
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
id,
ctx,
sx = 0,
sy = 0,
sw,
- Create a ticketCreate a ticket
Function drawScatteredSprites
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
sprites,
ctx,
width,
offsetLeft,
groundLevel,
- Create a ticketCreate a ticket
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({
- Create a ticketCreate a ticket
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
- Create a ticketCreate a ticket
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,
- Create a ticketCreate a ticket
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
- Create a ticketCreate a ticket
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
- Create a ticketCreate a ticket
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()
- Create a ticketCreate a ticket
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'
- Create a ticketCreate a ticket