Showing 332 of 806 total issues
Function processMode
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function processMode () {
setServerContacted(true)
switch (mode) {
case MODES.ERROR:
- Create a ticketCreate a ticket
Function drawSegmentNamesAndWidths
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
function drawSegmentNamesAndWidths (
ctx,
street,
dpi,
multiplier,
- Create a ticketCreate a ticket
Function del
has a Cognitive Complexity of 16 (exceeds 5 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
- 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 del
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export async function del (req, res) {
if (!req.auth) {
res.status(401).end()
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 errorReceiveStreet
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function errorReceiveStreet (error) {
const data = error.response.data
const mode = getMode()
if (
mode === MODES.CONTINUE ||
- 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 InfoBubbleHeader
has a Cognitive Complexity of 16 (exceeds 5 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)
- 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 del
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function del (req, res) {
if (!req.params.street_id) {
res.status(400).json({ status: 400, msg: 'Please provide street ID.' })
return
}
- Create a ticketCreate a ticket
Function StreetMetaGeotag
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
function StreetMetaGeotag (): React.ReactElement | null {
const street = useSelector((state) => state.street)
const editable = useSelector(
(state) => !state.app.readOnly && state.flags.GEOTAG.value
)
- Create a ticketCreate a ticket
Function loadSignIn
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function loadSignIn () {
const signInCookie = Cookies.get(SIGN_IN_TOKEN_COOKIE)
const refreshCookie = Cookies.get(REFRESH_TOKEN_COOKIE)
const userIdCookie = Cookies.get(USER_ID_COOKIE)
- Create a ticketCreate a ticket
Function initCoil
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function initCoil () {
// Run this if browser has the monetization plugin installed. Logged-in
// users will automatically get subscription benefits regardless of any
// connected monetization providers
if (document.monetization) {
- Create a ticketCreate a ticket
Function drawScatteredSprites
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function drawScatteredSprites (
sprites,
ctx,
width,
offsetLeft,
- Create a ticketCreate a ticket
Function handleChangeMenuSelection
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
const handleChangeMenuSelection = (value: string): void => {
setEditing(false)
const { units, width, occupiedWidth } = street
const selection = Number.parseFloat(value)
- Create a ticketCreate a ticket
Function recalculateWidth
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function recalculateWidth (street) {
// Determine occupied and remaining width
const occupiedWidth = calculateOccupiedWidth(street.segments)
const remainingWidth = calculateRemainingWidth(street.width, occupiedWidth)
const units = street.units
- Create a ticketCreate a ticket
Function put
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function put (req, res) {
let body
try {
body = req.body
} catch (e) {
- Create a ticketCreate a ticket
Function SentimentSurveyContainer
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function SentimentSurveyContainer (props) {
const [isVisible, setVisible] = useState(false)
const [isDismissed, setDismissed] = useState(false)
const [streetId, setStreetId] = useState(null)
const street = useSelector((state) => state.street)
- Create a ticketCreate a ticket
Function UndoRedo
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function UndoRedo (): React.ReactElement {
const undoPosition = useSelector((state) => state.history.position)
const undoStack = useSelector((state) => state.history.stack)
const [source, target] = useSingleton()
const dispatch = useDispatch()
- Create a ticketCreate a ticket
Function hover
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
hover (props, monitor, component) {
if (!monitor.canDrop()) return
const dragIndex = monitor.getItem().dataNo
const hoverIndex = props.dataNo
- 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 incrementSegmentWidth
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export const incrementSegmentWidth = (
dataNo,
add,
precise,
origWidth,
- 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 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const type = this.state.type
// Set class names
const classNames = ['info-bubble']
- Create a ticketCreate a ticket
Function FeatureFlagDialog
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function FeatureFlagDialog (props) {
const flags = useSelector((state) => state.flags)
const dispatch = useDispatch()
function renderFlagList () {
- Create a ticketCreate a ticket