Showing 332 of 806 total issues
Function show
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
show: function (force) {
if (infoBubble.suppressed) {
window.setTimeout(infoBubble.show, 100)
return
}
- Create a ticketCreate a ticket
Function getLabel
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getLabel (): React.ReactElement | string {
let id
let defaultMessage = ''
// Return label if provided
- Create a ticketCreate a ticket
Function processUrl
has 44 lines of code (exceeds 25 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
- Create a ticketCreate a ticket
Function registerKeypress
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function registerKeypress (commands, options, callback) {
// Defaults
// For shiftKey, metaKey, and altKey, specifies what it should
// match on the event object reported by the browser. For instance,
// if event.metaKey is false, it means the command must be executed
- Create a ticketCreate a ticket
Function componentDidUpdate
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
componentDidUpdate (prevProps, prevState) {
const { street, position, buildingWidth } = this.props
const { variant, height } = this.state
const lastOverflow = prevProps.street.remainingWidth < 0
- Create a ticketCreate a ticket
Function Gallery
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Gallery (): React.ReactElement {
const { visible, instant } = useSelector((state) => state.gallery)
const dispatch = useDispatch()
const hide = useCallback(() => {
void dispatch(closeGallery())
- Create a ticketCreate a ticket
Function renderVariantsSelection
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
function renderVariantsSelection (): Array<React.ReactElement | null> {
const variantEls = []
switch (type) {
case INFO_BUBBLE_TYPE_SEGMENT: {
- Create a ticketCreate a ticket
Function HomepageFeatures
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function HomepageFeatures() {
return (
<div className="row margin-vert--lg">
<div className="col col--4 col--offset-2" style={{ marginBottom: "1em" }}>
<div
- Create a ticketCreate a ticket
Function get
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
export async function get (req, res) {
// Flag error if user ID is not provided
const userId = req.params.user_id
const handleError = function (error) {
- 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 GalleryStreetItem
has a Cognitive Complexity of 14 (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 StreetNameplateContainer
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function StreetNameplateContainer (props) {
const isVisible = useSelector((state) => !state.ui.welcomePanelVisible)
const isEditable = useSelector(
(state) => !state.app.readOnly && state.flags.EDIT_STREET_NAME.value
)
- 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 NotificationBar
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function NotificationBar ({
notification = {}
}: NotificationBarProps): React.ReactElement | null {
const locale = useSelector((state) => state.locale)
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 SponsorBanner
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
function SponsorBanner (): React.ReactElement | null {
const isSubscriber = useSelector((state) => state.user.isSubscriber)
// Subscribers don't see sponsor banners
if (isSubscriber) return null
- Create a ticketCreate a ticket
Function handleSegmentResizeStart
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
function handleSegmentResizeStart (event) {
let x, y
if (app.readOnly) {
return
}
- Create a ticketCreate a ticket
Function handleAuth0TwitterSignIn
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
const handleAuth0TwitterSignIn = async function (credentials) {
try {
const user = await User.findOne({
where: { id: credentials.screenName }
})
- Create a ticketCreate a ticket
Function LocationPopup
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
const LocationPopup = (props) => {
const {
label,
position,
isEditable = false,
- Create a ticketCreate a ticket
Function ResizeGuides
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ResizeGuides (): React.ReactElement | null {
const isVisible = useSelector(({ ui }) => ui.resizeGuidesVisible)
const segmentId = useSelector(({ ui }) => ui.activeSegment)
const segment: Segment | null = useSelector(({ street }) =>
segmentId !== null ? street.segments[segmentId] : null
- Create a ticketCreate a ticket
Function put
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function put (req, res) {
const authUser = req.auth || {}
const { id, comment } = req.body
if (!authUser.sub) {
- Create a ticketCreate a ticket
Function get
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function get (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 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