Showing 156 of 190 total issues
Avoid too many return
statements within this function. Open
return
Function useLoadExtraCityContent
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const useLoadExtraCityContent = <T extends object>({
cityCode,
languageCode,
createEndpoint,
load,
- 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 sendRequest
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const sendRequest = async (signal: SignalType): Promise<void> => {
try {
const { jpalTrackingCode, jpalTrackingEnabled } = await appSettings.loadSettings()
if (buildConfig().featureFlags.jpalTracking && jpalTrackingEnabled && jpalTrackingCode) {
- 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 TransparentHeader
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const TransparentHeader = ({ navigation, route }: TransparentHeaderProps): ReactElement | null => {
const { t } = useTranslation('layout')
const showSnackbar = useSnackbar()
const shareUrl = (route.params as { shareUrl: string } | undefined)?.shareUrl
- 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 preparePois
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const preparePois = ({ pois: allPois, params }: PreparePoisProps): PreparePoisReturn => {
const { slug, multipoi, currentlyOpen, poiCategoryId } = params
const poi = allPois.find(it => it.slug === slug)
const filteredPois = allPois
- 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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
_addChildren(category: CategoryModel, depth: number): void {
this._categories.push(category)
if (depth === 0) {
this._resourceCache[category.path] = {}
- 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 Tile
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const Tile = ({ tile }: TileProps): ReactElement => {
const imageRef = useRef<HTMLImageElement>(null)
const fetchImageWithCaching = (): void => {
if (tile.thumbnail) {
- 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 Helmet
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const Helmet = ({
pageTitle,
metaDescription,
languageChangePaths,
cityModel,
- 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 toFormattedString
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
toFormattedString(locale: string, short = false): string {
const dayFormat = short ? 'D' : 'DDD'
const format = this.allDay ? dayFormat : `${dayFormat} t`
const localizedStartDate = this.startDate.setLocale(locale).toFormat(format)
const localizedEndDate = this.endDate.setLocale(locale)
- 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 formatDevelopmentNotes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const formatDevelopmentNotes = (params: { notes: NoteType[]; language: string; platforms: string[] }) => {
const { notes, language, platforms } = params
const emptyNotesMap = {
common: [] as NoteType[],
android: [] as NoteType[],
- 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 handleAllowedIframeSources
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const handleAllowedIframeSources = (
iframe: HTMLIFrameElement,
externalSourcePermissions: ExternalSourcePermissions,
storedIframeSource: string,
t: TFunction,
- 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 tryToResolve
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
func tryToResolve() {
if (currentFetchCount() != expectedFetchCount) {
return;
}
- 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 PoiDetails
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const PoiDetails = ({ poi, language, distance }: PoiDetailsProps): ReactElement => {
const { t } = useTranslation('pois')
const thumbnail = poi.thumbnail ?? PoiThumbnailPlaceholderLarge
const {
title,
- 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 Chat
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const Chat = ({ messages, submitMessage, hasError, isLoading }: ChatProps): ReactElement => {
const { t } = useTranslation('chat')
const [textInput, setTextInput] = useState<string>('')
const { height: deviceHeight } = useWindowDimensions()
const chatInputContainerHeight = dimensions.getChatInputContainerHeight(messages)
- 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 News
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const News = ({
news,
loadMore,
newsId,
languageCode,
- 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 CityContentToolbar
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const CityContentToolbar = (props: CityContentToolbarProps) => {
const { viewportSmall } = useWindowDimensions()
const {
feedbackTarget,
children,
- 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"