Showing 163 of 193 total issues
Function getNavigationItems
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getNavigationItems = (): Array<ReactElement> => {
const isNewsVisible = buildConfig().featureFlags.newsStream && (localNewsEnabled || tunewsEnabled)
const isEventsVisible = eventsEnabled
const isPoisVisible = buildConfig().featureFlags.pois && poisEnabled
const isOffersVisible = offersEnabled
File PinchPanImage.tsx
has 269 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { ReactElement } from 'react'
import { Animated, Image, ImageErrorEventData, NativeSyntheticEvent } from 'react-native'
import {
PanGestureHandler,
PinchGestureHandler,
Function CityContentHeader
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
const CityContentHeader = ({
cityModel,
languageCode,
languageChangePaths,
route,
- 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 CityContentSwitcher
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
const CityContentSwitcher = ({ languageCode }: CityContentSwitcherProps): ReactElement => {
// This component is only opened when there is a cityCode in the route
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const cityCode = useParams().cityCode!
const { data: city, error, loading } = useLoadFromEndpoint(createCityEndpoint, cmsApiBaseUrl, { city: cityCode })
- 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 _addChildren
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
_addChildren(category: CategoryModel, depth: number): void {
this._categories.push(category)
if (depth === 0) {
this._resourceCache[category.path] = {}
Function createTrackingEndpoint
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
const createTrackingEndpoint = (url: string = JPAL_TRACKING_ENDPOINT_URL): TrackingEndpointType => {
const request = async (signal: SignalType) => {
const pageType = signal.name === OPEN_PAGE_SIGNAL_NAME ? signal.pageType : undefined
const signalUrl =
signal.name !== SEND_FEEDBACK_SIGNAL_NAME &&
Function buildAll
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildAll(): {
path: string
event: EventModel
resources: PageResourceCacheStateType
}[] {
Function navigate
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
const navigate = <T extends RoutesType>(
routeInformation: RouteInformationType,
navigation: NavigationProps<T>,
appCityCode: string | null,
appLanguageCode: string,
- 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 MapView
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
const MapView = ({
boundingBox,
features,
selectedFeature,
iconPosition,
- 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 EventsPage
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
const EventsPage = ({ city, pathname, languageCode, cityCode }: CityRouteProps): ReactElement | null => {
const previousPathname = usePreviousProp({ prop: pathname })
const { eventId } = useParams()
const { t } = useTranslation('events')
const navigate = useNavigate()
- 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 retry
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
const retry = async <T>(
componentImport: () => Promise<{ default: ComponentType<T> }>,
retriesLeft = DEFAULT_RETRIES,
interval = DEFAULT_INTERVAL,
): Promise<{ default: ComponentType<T> }> => {
- 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 navigateToDeepLink
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
const navigateToDeepLink = <T extends RoutesType>({
url,
navigation,
navigateTo,
showSnackbar,
- 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 useLoadTuNews
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
const useLoadTuNews = ({ language }: ParamsType): TuNewsReturnType => {
const [page, setPage] = useState<number>(FIRST_PAGE_INDEX)
const [data, setData] = useState<TunewsModel[] | null>(null)
const [availableLanguages, setAvailableLanguages] = useState<LanguageModel[] | null>(null)
const [error, setError] = useState<Error | null>(null)
- 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 request
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
async request(params: P, overrideUrl?: string): Promise<Payload<T>> {
if (this.errorOverride) {
throw this.errorOverride
}
Function request
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
const request = async (signal: SignalType) => {
const pageType = signal.name === OPEN_PAGE_SIGNAL_NAME ? signal.pageType : undefined
const signalUrl =
signal.name !== SEND_FEEDBACK_SIGNAL_NAME &&
signal.name !== RESUME_SIGNAL_NAME &&
Method fetchAsync
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
private fun fetchAsync(sourceUrl: String, targetFilePath: String, callback: FetchedCallback) {
val targetFile = File(targetFilePath)
if (targetFile.exists()) {
callback.alreadyExists(sourceUrl, targetFile)
return
File Tooltip.tsx
has 256 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { ReactElement, ReactNode, useCallback, useEffect, useState } from 'react'
import styled, { css } from 'styled-components'
import dimensions from '../constants/dimensions'
Function LoadingErrorHandler
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
const LoadingErrorHandler = ({
children,
loading,
refresh,
error,
- 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 loadPois
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
async loadPois(context: DatabaseContext): Promise<Array<PoiModel>> {
const path = this.getContentPath('pois', context)
const mapPoisJson = (json: ContentPoiJsonType[]) =>
json.map(jsonObject => {
const jsonLocation = jsonObject.location
Function writeJsonFromCsv
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
const writeJsonFromCsv = (translations: string, toPath: string, sourceLanguage: string) => {
fs.readdir(translations, (err, files) => {
if (err) {
throw err
}