Showing 78 of 148 total issues
File tripitem.stories.jsx
has 573 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from 'react'
import { storiesOf } from '@storybook/react'
import { View } from 'react-native'
import { TripItem } from '../js/views/station/TripItemV2.jsx'
Function render
has 194 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { desktopLayout, stations, currentCity } = this.state
let twitterAcc
if (currentCity.prefix === 'nz-akl') {
twitterAcc = (
Function render
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
let loading
let content
const { trips, error, html, routes } = this.state
Function Settings
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Settings = () => {
const [credits, setCredits] = useState(false)
return (
<View style={styles.wrapper}>
<Header title={t('settings.title')} />
Function getIconName
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
Open
export const getIconName = (region, routeType, context, stopName) => {
if (region === 'au-syd') {
// TODO!
return 'normal-default'
}
- Read upRead up
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 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { match } = this.props
const { loading, error, errorMessage, lineMetadata, showAll } = this.state
let content = null
File Index.jsx
has 331 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from 'react'
import PropTypes from 'prop-types'
import { withRouter } from 'react-router-dom'
import { vars } from '../../styles.js'
File Station.jsx
has 317 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { withRouter } from 'react-router'
import { View, StyleSheet } from 'react-native'
Function render
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
if (deferredPrompt !== null) {
return null
}
const userAgent = window.navigator.userAgent.toLowerCase()
Function Feedback
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Feedback = () => {
const [contact, setContact] = useState('')
const [message, setMessage] = useState('')
const [loading, setLoading] = useState(false)
const [submitted, setSubmitted] = useState(false)
Function render
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { region } = this.props.match.params
const stop = this.props.match.params.station
const regionStop = `${region}|${stop}`
Function render
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
let subtitleStyle
let subtitleElement
File LineStopsRoute.jsx
has 290 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React, { useState } from 'react'
import { Text, View, StyleSheet, TouchableOpacity } from 'react-native'
import { vars } from '../../../styles.js'
import UiStore from '../../../stores/UiStore.js'
Function render
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { loading, error, groups, icons, meta, groupShow } = this.state
return (
<View style={styles.wrapper}>
<Header title={t('lines.title')} subtitle={meta.longName || ''} />
Function getNextText
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
Open
const getNextText = (times, hideVerb = false, amphersand = 'also') => {
const time = times[0]
const time2 = times[1]
let combinedMinutes = false
- Read upRead up
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
File TripItemV2.jsx
has 283 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from 'react'
import { View, Text, StyleSheet, TouchableOpacity } from 'react-native-web'
import { vars } from '../../styles.js'
import { getTime } from '../../helpers/date.js'
Function add
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
add(type, data, props = {}) {
const map = UiStore.state.basemap
if (type === 'geojson') {
map.addSource(this.id, {
type: 'geojson',
Function Guidebook
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Guidebook = () => {
const location = useLocation()
const [html, setHtml] = useState('')
const [cityName, setCityName] = useState('')
const [error, setError] = useState('')
Function fetchPage
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const fetchPage = async location => {
const url = `${guidebookEndpoint}/${location.substring('/guide/'.length)}`
if (!navigator.onLine) {
const err = new Error()
Function render
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { match } = this.props
const {
error,
errorMessage,