Showing 390 of 2,206 total issues

Function Header has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const Header = ({ brandRef, borderBottom, skipLink, scriptLink, linkId }) => {
  const [showConsentBanner, setShowConsentBanner] = useState(true);

  const handleBannerBlur = event => {
    const isRejectButton =
Severity: Minor
Found in src/app/legacy/containers/Header/index.jsx - About 25 mins to fix

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
Severity: Minor
Found in cypress/e2e/pages/storyPage/testsForCanonicalOnly.js - About 25 mins to fix

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,
Severity: Minor
Found in src/app/components/ImageWithCaption/index.tsx - About 25 mins to fix

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,
Severity: Minor
Found in ws-nextjs-app/pages/[service]/live/[id]/Header/index.tsx - About 25 mins to fix

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 {
Severity: Minor
Found in ws-nextjs-app/pages/[service]/live/[id]/LivePageLayout.tsx - About 25 mins to fix

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,
Severity: Minor
Found in src/app/components/LiveLabel/Text/index.tsx - About 25 mins to fix

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';
Severity: Minor
Found in src/app/components/Ad/Canonical/index.tsx - About 25 mins to fix

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 }: TopStoriesItemProps,
    viewRef,
  ) => {
    if (!item || Object.keys(item).length === 0) return null;

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,
Severity: Minor
Found in src/app/components/ChartbeatAnalytics/utils/index.ts - About 25 mins to fix

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,
}: OnDemandTVProps) => {
Severity: Minor
Found in src/app/pages/OnDemandTvPage/OnDemandTvPage.tsx - About 25 mins to fix

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

Severity
Category
Status
Source
Language