Showing 156 of 190 total issues
Function CityNotCooperating
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
const CityNotCooperating = (): ReactElement | null => {
const { t } = useTranslation('cityNotCooperating')
const [isCopied, setIsCopied] = useState<boolean>(false)
const template = buildConfig().featureFlags.cityNotCooperatingTemplate
const CityNotCooperatingIcon = buildConfigAssets().CityNotCooperatingIcon
Function checkCalendarsAndExportEvent
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const checkCalendarsAndExportEvent = async (): Promise<void> => {
const iosPermission = [PERMISSIONS.IOS.CALENDARS]
const androidPermissions = [PERMISSIONS.ANDROID.READ_CALENDAR, PERMISSIONS.ANDROID.WRITE_CALENDAR]
const permission = await requestMultiple(Platform.OS === 'ios' ? iosPermission : androidPermissions)
const permissionDenied = Object.values(permission).some(permission => ['limited', 'blocked'].includes(permission))
Function pathnameFromRouteInformation
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const pathnameFromRouteInformation = (routeInformation: NonNullableRouteInformationType): string => {
if (
routeInformation.route === JPAL_TRACKING_ROUTE ||
routeInformation.route === LICENSES_ROUTE ||
routeInformation.route === CONSENT_ROUTE
Function log
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const log = async (message: string, level: SeverityLevel = 'debug'): Promise<void> => {
try {
const Sentry = await loadSentry()
if (sentryEnabled()) {
Sentry.addBreadcrumb({ message, level })
Function moveReleaseNotes
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const moveReleaseNotes = async ({ newVersionName, deliverinoPrivateKey, owner, repo, branch }: Options) => {
const appOctokit = await authenticate({ deliverinoPrivateKey, owner, repo })
const {
data: { commit },
} = await appOctokit.repos.getBranch({ owner, repo, branch })
- 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 MobileBanner
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const MobileBanner = (): ReactElement | null => {
const { value, updateLocalStorageItem } = useLocalStorage<string | null>({ key: 'showBanner', initialValue: null })
const isVisible = !value || DateTime.fromISO(value).plus({ months: 3 }) < DateTime.now()
const [isInstalled] = useState<boolean>(false) // This is always false because we can't know if app is installed or not before running the deep-link
const { icons, appName, apps, hostName } = buildConfig()
- 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 loadWithCache
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const loadWithCache = async ({
showSnackbar,
forceUpdate = false,
}: {
forceUpdate?: boolean
- 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 writeMetadata
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const writeMetadata = (appName: string, storeName: string, overrideVersionName?: string) => {
if (storeName !== 'appstore' && storeName !== 'playstore') {
throw new Error(`Invalid store name ${storeName} passed!`)
}
Function onShare
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const onShare = async () => {
if (!shareUrl) {
// The share option should only be shown if there is a shareUrl
return
}
Function loadEvents
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
async loadEvents(context: DatabaseContext): Promise<Array<EventModel>> {
const path = this.getContentPath('events', context)
const mapEventsJson = (json: ContentEventJsonType[]) =>
json.map(jsonObject => {
const jsonDate = jsonObject.date
- 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 PoisPage
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const PoisPage = ({ cityCode, languageCode, city, pathname }: CityRouteProps): ReactElement | null => {
const params = useParams()
const slug = params.slug ? normalizePath(params.slug) : undefined
const { t } = useTranslation('pois')
- 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 DashboardNavigationTiles
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const DashboardNavigationTiles = ({
cityModel,
languageCode,
navigateTo,
}: DashboardNavigationTilesProps): ReactElement => {
- 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 Settings
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const Settings = ({ navigation }: SettingsProps): ReactElement => {
const { settings, updateSettings } = useAppContext()
const { cityCode, languageCode } = useContext(AppContext)
const showSnackbar = useSnackbar()
const { t } = useTranslation('settings')
- 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 parseReleaseNotes
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const parseReleaseNotes = ({ source, ios, android, web, production, language, appName }: ParseOptions): string => {
const platforms: string[] = [
android ? PLATFORM_ANDROID : undefined,
ios ? PLATFORM_IOS : undefined,
web ? PLATFORM_WEB : undefined,
- 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 useOnClickOutside
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const useOnClickOutside = (ref: { current: HTMLElement | null }, callback: () => void): void => {
useEffect(() => {
const isOutside = (target: EventTarget | null) =>
target instanceof Node && ref.current && !ref.current.contains(target)
- 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 TuNewsPage
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const TuNewsPage = ({ cityCode, languageCode, city }: CityRouteProps): ReactElement | null => {
const { t } = useTranslation('news')
const { viewportSmall } = useWindowDimensions()
const { data: tuNewsLanguages, error } = useLoadFromEndpoint(
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
const PoiDetails = ({ poi, distance, toolbar }: PoiDetailsProps): ReactElement => {
const navigate = useNavigate()
const { viewportSmall } = useWindowDimensions()
const theme = useTheme()
const { t } = useTranslation('pois')
- 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 submitMalteHelpForm
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const submitMalteHelpForm = async ({
pageTitle,
url,
cityCode,
malteHelpFormOffer,
- 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 a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
async request(params: P, overrideUrl?: string): Promise<Payload<T>> {
if (this.errorOverride) {
throw this.errorOverride
}
- 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 Header
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const Header = ({
actionItems = [],
kebabItems = [],
logoHref,
navigationItems = [],
- 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"