Showing 390 of 2,206 total issues
Function e
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function e(e, t, n, r) {
var o = this;
this.dispatchFetch = function() {
return wt(o, void 0, void 0, (function() {
return bt(this, (function(e) {
Function getSigningKey
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
}, e.prototype.getSigningKey = function(e, t, n, r) {
return function(e, t, n, r, o) {
return be(void 0, void 0, void 0, (function() {
var i,
s,
Function generateLinks
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const generateLinks = (service, env, domain) => {
const output = [];
const {
frontPage,
Function getDestination
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const getDestination = (platform, statsDestination) => {
const destinationIDs = {
DEFAULT: 596068,
DEFAULT_TEST: 596068,
NEWS_PS: 598285,
Function 430
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
430: function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}),
Function useOptimizelyScrollDepth
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const useOptimizelyScrollDepth = () => {
const { isAmp } = useContext(RequestContext);
const { optimizely } = useContext(OptimizelyContext);
const [scrollDepth, setScrollDepth] = useState(0);
const [scrollTwentyFive, setScrollTwentyFive] = useState(false);
File index.tsx
has 255 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/** @jsx jsx */
/* @jsxFrag React.Fragment */
import { jsx } from '@emotion/react';
import React, { useContext, useEffect, useRef, useState } from 'react';
Function listItems
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const listItems = files.map((fileData: FileData, index: number) => {
const { file } = fileData;
const key = `${index}-${file.name}`;
const thumbnailSrc = thumbnailState[index];
const isThumbnailSvg = thumbnailSrc?.startsWith('data:image/svg');
Function webpackFinal
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
webpackFinal: async (config, options) => {
const babelOptions = await options.presets.apply('babel', {}, options);
const typescriptOptions = await options.presets.apply(
'typescript',
{},
Function fetchPageData
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
const fetchPageData = async ({
path,
timeout,
shouldLogFetchTime = !onClient(),
agent,
- 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 exports
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
module.exports = ({
resolvePath,
IS_PROD,
START_DEV_SERVER,
IS_PROD_PROFILE,
- 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 useConsentBanner
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const useConsentBanner = (
isUK = false,
showCookieBannerBasedOnCountry = true,
) => {
const [{ showPrivacyBanner, showCookieBanner }, dispatch] = useReducer(
Function isValidFiles
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const isValidFiles: (data: FieldData) => FieldData = (data: FieldData) => {
const { value: files, required, wasInvalid, fileTypes, min, max } = data;
const MAX_PAYLOAD_SIZE = 1288490189;
const RESERVED_FORM_DATA_SIZE = 10000;
// we're making the assumption that each file chooser field is only allowed the max payload size less some for data (estimated maximum size ever needed)
Function 668
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
668: function(e, t, n) {
"use strict";
n.r(t),
n.d(t, {
fromUtf8: function() {
Function render
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { clientSideEnvVariables, css, helmet, ids, isApp, isLite } =
this.props;
const htmlAttrs = helmet.htmlAttributes.toComponent();
Function customRender
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const customRender = (
ui: ReactElement,
options?: Omit<RenderOptions, 'wrapper'> & Omit<Props, 'children'>,
) => {
const {
Function getServerSideProps
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const getServerSideProps: GetServerSideProps = async context => {
context.res.setHeader(
'Cache-Control',
'public, stale-if-error=300, stale-while-revalidate=120, max-age=30',
);
Function A
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
A = function(e, t) {
if ("object" == typeof e && (t = e, e = i), !(this instanceof A))
return new A(e, t).getResult();
var n = e || (void 0 !== o && o.navigator && o.navigator.userAgent ? o.navigator.userAgent : ""),
r = t ? E.extend(T, t) : T;
Function collectResults
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const collectResults = async (link, service, type) => {
await fetchWithCert(link).then(response => {
if (response.ok) {
response.json().then(json => {
const jsondata = 'data' in json ? json.data : json;
Function LiteSiteCta
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const LiteSiteCta = () => {
const { dir, translations } = useContext(ServiceContext);
const { canonicalLink } = useContext(RequestContext);
const isRtl = dir === 'rtl';
const { liteSite = defaultTranslations } = translations;