Showing 390 of 2,206 total issues
Function Promo
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Promo = () => {
const { podcastPromo, script, service, dir } = useContext(ServiceContext);
const { pageType, isLite } = useContext(RequestContext);
const {
File index.test.js
has 323 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import loggerMock from '#testHelpers/loggerMock'; // Must be imported before fetchPageData
import {
DATA_FETCH_ERROR,
DATA_REQUEST_RECEIVED,
DATA_RESPONSE_FROM_CACHE,
Function FormContextProvider
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
Open
export const FormContextProvider = ({
initialScreen = 'form',
fields,
children,
}: PropsWithChildren<{ initialScreen?: FormScreen; fields: Field[] }>) => {
- 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
File cookie.amp.jsx
has 319 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from 'react';
import { Helmet } from 'react-helmet';
import styled from '@emotion/styled';
import {
getDoublePica,
Function extractBundlesForPageType
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
extractBundlesForPageType: pageType => {
if (pageType === 'ArticlePage') {
return [
'modern.ArticlePage-31ecd969.31473c35.js',
'modern.commons-1111.js',
Function getServerSideProps
has 89 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',
);
File font-families.js
has 314 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/*
* BBC REITH
*/
const reithFallback = `Helvetica, Arial, sans-serif;`;
const reithSans = `font-family: ReithSans, ${reithFallback}`;
File index.test.jsx
has 314 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from 'react';
import {
isNull,
suppressPropWarnings,
} from '#psammead/psammead-test-helpers/src';
Function L
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
L = function(e, t) {
var n,
r,
o,
i,
Function kn
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
kn = function(e, t) {
var n,
r,
o,
i,
Function s
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
s = function(e, t) {
var n,
r,
o,
i,
Function O
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
O = function(e, t) {
var n,
r,
o,
i,
Function e
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function e() {
var e = this;
this.eventListener = function() {
0 === performance.getEntriesByType(Ct).length ? e.performanceNavigationEventHandlerTimingLevel1() : new PerformanceObserver((function(t) {
t.getEntries().forEach((function(t) {
Function lt
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
}, lt = function(e, t) {
var n,
r,
o,
i,
Function bt
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
}, bt = function(e, t) {
var n,
r,
o,
i,
Function C
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
C = function(e, t) {
var n,
r,
o,
i,
Function Se
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function Se(e, t) {
var n,
r,
o,
i,
Function d
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function d(e, t) {
var n,
r,
o,
i,
Function jn
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
jn = function(e, t) {
var n,
r,
o,
i,
File index.test.jsx
has 313 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from 'react';
import { render } from '../../../../components/react-testing-library-with-providers';
import Grid from '.';
import { ExampleParagraph, ExampleFigure, ExampleImage } from './testHelpers';