Showing 390 of 2,206 total issues

Function Grid has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  (
    {
      children,
      startOffset: gridStartOffset = {}, // alias this prop to prevent it rendering as an element attribute e.g. <div startoffset="[object Object]">
      dir = 'ltr',
Severity: Minor
Found in src/app/legacy/psammead/psammead-grid/src/index.jsx - About 35 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 HeaderContainer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const HeaderContainer = ({
  scriptSwitchId = '',
  renderScriptSwitch = true,
}) => {
  const { isAmp, isApp, pageType, isLite } = useContext(RequestContext);
Severity: Minor
Found in src/app/legacy/containers/Header/index.jsx - About 35 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 StyledList has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  ${({ dir }) =>
    `
      @media (min-width: ${GEL_GROUP_0_SCREEN_WIDTH_MIN}){
        margin-${dir === 'ltr' ? 'left' : 'right'}: ${GEL_SPACING};
        &:first-child {
Severity: Minor
Found in src/app/legacy/components/ScrollablePromo/PromoList/index.jsx - About 35 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 extractPlatform has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const extractPlatform = (query: Query): Platform | null => {
  let platform: Platform | null = null;

  // eslint-disable-next-line no-restricted-syntax
  for (const id of query ?? []) {
Severity: Minor
Found in src/app/routes/utils/parseAvRoute/index.ts - About 35 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 childrenFallback has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const childrenFallback = (
  item,
  dir,
  columnsGroup,
  marginsGroup,
Severity: Minor
Found in src/app/legacy/psammead/psammead-grid/src/index.jsx - About 35 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 extractAltText has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const extractAltText = blocks => {
  // eslint-disable-next-line no-restricted-syntax
  for (const block of blocks) {
    if (block.type === 'paragraph') {
      return block.model.text;
Severity: Minor
Found in src/app/legacy/containers/StoryPromo/index.jsx - About 35 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 providers has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const providers = (provider, isLive) =>
  ({
    instagram: {
      script: 'https://www.instagram.com/embed.js',
      styles: `
Severity: Minor
Found in src/app/legacy/psammead/psammead-social-embed/src/Canonical/index.jsx - About 35 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 getEllipsisVisibility has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const getEllipsisVisibility = (side: string, state: StateType) => {
  // If we pruned some pages on this side, we display an ellipsis on all devices
  const wasTruncated =
    side === 'left' ? state.pagesTruncatedOnLeft : state.pagesTruncatedOnRight;
  if (wasTruncated) return VISIBILITY.ALL;
Severity: Minor
Found in src/app/components/Pagination/buildBlocks.ts - About 35 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 OEmbedLoader has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const OEmbedLoader = ({ oembed }: OEmbedProps) => {
  const { isAmp, isLite, canonicalLink } = useContext(RequestContext);
  const { translations } = useContext(ServiceContext);

  if (isLite) return null;
Severity: Minor
Found in src/app/components/Embeds/OEmbed/index.tsx - About 35 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 getType has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const getType = (pageType: PageTypes | 'index', shorthand = false) => {
  switch (pageType) {
    case FRONT_PAGE:
    case 'index':
      return shorthand ? 'IDX' : 'Index';
Severity: Minor
Found in src/app/components/ChartbeatAnalytics/utils/index.ts - About 35 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 buildATIPageTrackPath has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const buildATIPageTrackPath = ({
  appName,
  contentId,
  contentType,
  language,
Severity: Minor
Found in src/app/components/ATIAnalytics/atiUrl/index.ts - About 35 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 SingleDoc has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const SingleDoc = ({ label, status, url, urlLabel }: SingleDocProps) => {
  const iconStatusStyle = status ? styles.positive : styles.negative;
  const hasIcon = status ? (
    <Confirm css={styles.icon} />
  ) : (
Severity: Minor
Found in .storybook/DocsDecorator/HealthFactors/SingleDoc/index.tsx - About 35 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 SidebarLabel has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const SidebarLabel = ({ item }) => {
  const api = useStorybookApi();
  const { isRoot, parameters, name, children, isComponent } = item;
  const { docsOnly } = parameters ?? {};

Severity: Minor
Found in .storybook/SidebarLabel/index.tsx - About 35 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 RelatedContentItem has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  ({ item, ariaLabelledBy, eventTrackingData = null }, viewRef) => {
    if (!item || isEmpty(item)) return null;

    const headlineFirst = pathOr<string>(
      '',
Severity: Minor
Found in src/app/components/RelatedContentSection/RelatedContentItem/index.tsx - About 35 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

Avoid too many return statements within this function.
Open

      return [
        'modern.OnDemandAudioPage-31ecd969.ec6af2d0.js',
        'modern.commons-1111.js',
        'modern.commons-2222.js',
        'modern.1111-lib-1111.js',
Severity: Major
Found in scripts/bundleSize/__mocks__/pageTypeBundleExtractor.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

          return [
            'modern.ErrorPage-31ecd969.31473c35.js',
            'modern.commons-1111.js',
            'modern.commons-2222.js',
            'modern.1111-lib-1111.js',
    Severity: Major
    Found in scripts/bundleSize/__mocks__/pageTypeBundleExtractor.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                      return 0;
      Severity: Major
      Found in scripts/mostReadCollectionTimes.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              return [
                'modern.MostReadPage-31ecd969.7484ff05.js',
                'modern.commons-1111.js',
                'modern.commons-2222.js',
                'modern.1111-lib-1111.js',
        Severity: Major
        Found in scripts/bundleSize/__mocks__/pageTypeBundleExtractor.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return [
                  'modern.OnDemandTvPage-31ecd969.de41ab7f.js',
                  'modern.commons-1111.js',
                  'modern.1111-lib-1111.js',
                  'modern.3333-lib-2222.js',
          Severity: Major
          Found in scripts/bundleSize/__mocks__/pageTypeBundleExtractor.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return [
                    'modern.FeatureIdxPage-31ecd969.31473c35.js',
                    'modern.commons-1111.js',
                    'modern.commons-2222.js',
                    'modern.1111-lib-1111.js',
            Severity: Major
            Found in scripts/bundleSize/__mocks__/pageTypeBundleExtractor.js - About 30 mins to fix
              Severity
              Category
              Status
              Source
              Language