Showing 420 of 2,646 total issues
Function xmlNodeToBlock
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const xmlNodeToBlock = (node, attributes) => {
if (!is(Object, node)) return undefined;
if (node.type === 'text') {
return fragment(node.text, attributes);
- 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 getImageBlock
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const getImageBlock = (type, blockData, isAmp) => {
const supportedImageTypes = ['idt2'];
const imageData = blockData[type];
- 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 NielsenAnalytics
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const NielsenAnalytics = () => {
const { service, isAmp, pathname } = useContext(RequestContext);
// nielsenAnalytics toggle only set up as local toggle at the moment...
const { enabled } = useToggle('nielsenAnalytics');
- 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 getPageData
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const getPageData = (url, service, variant, pageType) => {
const env = Cypress.env('APP_ENV');
let pageBody;
const isBffFetch = pageType === 'articles';
- 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 FrostedGlassPromo
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const FrostedGlassPromo = ({
image,
children,
footer = null,
url,
- 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 getBootstrapSrc
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const getBootstrapSrc = (queryString: string, useLegacy = false) => {
const adsTestScript =
'https://gn-web-assets.api.bbc.com/ngas/latest/test/dotcom-bootstrap.js';
const adsLegacyTestScript =
'https://gn-web-assets.api.bbc.com/ngas/latest/test/dotcom-bootstrap-legacy.js';
- 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 pruneInvisible
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const pruneInvisible = (_state: StateType) => {
const state = clone(_state);
state.result = state.result.filter((page, index) => {
if (!page.visibility) {
// if an element is being filtered out, we need to remember we did this
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
const Header = ({
showLiveLabel,
title,
description,
imageUrl,
- 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 OnDemandTvPage
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const OnDemandTvPage = ({ pageData, mediaIsAvailable, MediaError }) => {
const {
language,
headline,
shortSynopsis,
- 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 buildSettings
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const buildSettings = ({
blocks,
counterName,
statsDestination,
producer,
- 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 getCert
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const getCert = async () => {
const caPath = process.env.CA_PATH || '/etc/pki/tls/certs/ca-bundle.crt';
const certChainPath =
process.env.CERT_CHAIN_PATH || '/etc/pki/tls/certs/client.crt';
const keyPath = process.env.KEY_PATH || '/etc/pki/tls/private/client.key';
- 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 OEmbedLoader
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const OEmbedLoader = ({ oembed }: OEmbedProps) => {
const { isAmp, canonicalLink } = useContext(RequestContext);
const { translations } = useContext(ServiceContext);
const { html, provider_name, oEmbedType, parameters, url } = oembed;
const isVDJEmbed = oEmbedType === 'vdj-embed';
- 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 Text
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const Text = ({
lang = 'en-GB',
id,
children,
offScreenText,
- 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 TopStoriesItem
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
({ item, ariaLabelledBy, eventTrackingData = null }, viewRef) => {
const { script } = useContext(ServiceContext);
if (!item || isEmpty(item)) return null;
- 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 getConfig
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const getConfig = ({
isAmp,
platform,
pageType,
brandName,
- 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 MetadataContainer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const MetadataContainer = ({
title,
socialHeadline,
lang,
twitterHandle,
- 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 MediaAssetPage
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const MediaAssetPage = ({ pageData }) => {
const { brandName, showRelatedTopics } = useContext(ServiceContext);
const { canonicalLink, isAmp } = useContext(RequestContext);
const isLegacyMediaAssetPage = () => canonicalLink.split('/').length > 7;
- 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 testsThatNeverRunDuringSmokeTestingForCanonicalOnly
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const testsThatNeverRunDuringSmokeTestingForCanonicalOnly = () => {
// TODO: Re-enable these and check for consent banner
describe.skip('Social Embed', () => {
// This test specifically covers an edge case where more than one tweet is
// included in a Story and twitter needs to be prompted to render the tweet
- 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 ImageWithCaption
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const ImageWithCaption = ({
blocks,
className,
position = [1],
sizes,
- 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 LivePage
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const LivePage = ({ pageData }: ComponentProps) => {
const { lang, translations, defaultImage, brandName } =
useContext(ServiceContext);
const { canonicalNonUkLink } = useContext(RequestContext);
const {
- 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"