Showing 189 of 190 total issues
Function NavigationBarScrollContainer
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
const NavigationBarScrollContainer = ({ children, activeIndex }: NavigationBarScrollContainerProps): ReactElement => {
const { width } = useWindowDimensions()
const [scrollPosition, setScrollPosition] = useState<number>(0)
const scrollToActiveItem = useCallback(
(ref: RefObject<HTMLDivElement>) => {
- 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
Avoid too many return
statements within this function. Open
Open
return constructPathname([LANDING_ROUTE, routeInformation.languageCode])
Avoid too many return
statements within this function. Open
Open
return
Avoid too many return
statements within this function. Open
Open
return <Layout>{children}</Layout>
Avoid too many return
statements within this function. Open
Open
return
Avoid too many return
statements within this function. Open
Open
return
Avoid too many return
statements within this function. Open
Open
return (
<CityContentLayout isLoading={false} {...locationLayoutParams}>
<Helmet pageTitle={pageTitle} languageChangePaths={languageChangePaths} cityModel={city} />
<NewsTabs
type={LOCAL_NEWS_TYPE}
Avoid too many return
statements within this function. Open
Open
return
Avoid too many return
statements within this function. Open
Open
return event1.title.localeCompare(event2.title)
Avoid too many return
statements within this function. Open
Open
return (
<AspectRatioImage
source={cachedSource}
resizeMode={resizeMode}
style={style}
Avoid too many return
statements within this function. Open
Open
return
Avoid too many return
statements within this function. Open
Open
return (
<CityContentLayout isLoading={false} {...locationLayoutParams}>
<Helmet pageTitle={pageTitle} languageChangePaths={languageChangePaths} cityModel={city} />
<Caption title={t('events')} />
<List noItemsMessage={t('currentlyNoEvents')} items={events} renderItem={renderEventListItem} />
Avoid too many return
statements within this function. Open
Open
return (
<CityContentLayout isLoading={false} {...locationLayoutParams}>
<Helmet
pageTitle={pageTitle}
metaDescription={metaDescription}
Avoid too many return
statements within this function. Open
Open
return
Avoid too many return
statements within this function. Open
Open
return (
<LayoutedScrollView refreshControl={<RefreshControl onRefresh={refresh} refreshing={false} />}>
{children}
</LayoutedScrollView>
)
Avoid too many return
statements within this function. Open
Open
return
Avoid too many return
statements within this function. Open
Open
return constructPathname([cityCode, languageCode, routeInformation.route, newsType, newsId?.toString()])
Avoid too many return
statements within this function. Open
Open
return ErrorCode.UnknownError
Avoid too many return
statements within this function. Open
Open
return
Avoid too many return
statements within this function. Open
Open
return (
<LayoutedScrollView refreshControl={<RefreshControl onRefresh={refresh} refreshing={false} />}>
<Failure buttonAction={buttonAction} code={errorCode} buttonLabel={buttonLabel} />
</LayoutedScrollView>
)