Showing 390 of 2,206 total issues

Avoid too many return statements within this function.
Open

  return PROVIDERS.UNKNOWN;
Severity: Major
Found in src/app/legacy/containers/SocialEmbed/sourceHelpers.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return PROVIDERS.FACEBOOK;
    Severity: Major
    Found in src/app/legacy/containers/SocialEmbed/sourceHelpers.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return localToggles;
      Severity: Major
      Found in src/app/lib/utilities/getToggles/index.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

          return null;
        Severity: Major
        Found in src/app/components/Pagination/buildBlocks.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return <FlourishEmbed {...oembed} />;
          Severity: Major
          Found in src/app/components/Embeds/OEmbed/index.tsx - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return null;
            Severity: Major
            Found in src/app/components/Curation/index.tsx - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                return <EmbedHtml embeddableContent={html} />;
              Severity: Major
              Found in src/app/components/Embeds/OEmbed/index.tsx - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                  return 'Unknown';
                Severity: Major
                Found in ws-nextjs-app/utilities/derivePageType/index.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return curationLength > 1 && (title || isFirstCuration) ? (
                            <section aria-labelledby={id} role="region">
                              {isFirstCuration ? (
                                <VisuallyHiddenText id={id} as="h2">
                                  {curationSubheading}
                  Severity: Major
                  Found in src/app/components/Curation/index.tsx - About 30 mins to fix

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

                    const getRouteProps = url => {
                      const matchedRoutes = matchRoutes(routes, url);
                    
                      const route = path([0, 'route'], matchedRoutes);
                      const match = path([0, 'match'], matchedRoutes);
                    Severity: Minor
                    Found in src/app/routes/utils/fetchPageData/utils/getRouteProps/index.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 squashTopStories has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    const squashTopStories = jsonRaw => {
                      const json = jsonRaw;
                      let groups = pathOr(null, ['content', 'groups'], json);
                      let collectedItems = [];
                      let collectedStrapline;
                    Severity: Minor
                    Found in src/app/routes/utils/sharedDataTransformers/squashTopStories/index.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 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';
                    Severity: Minor
                    Found in src/server/utilities/getAgent/certs.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 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
                    Severity: Minor
                    Found in src/app/components/Pagination/buildBlocks.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 addLiteExtension has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    const addLiteExtension = (href?: string) => {
                      if (!href) return null;
                    
                      const url = new URL(href, 'http://localhost');
                    
                    
                    Severity: Minor
                    Found in src/server/Document/Renderers/litePageTransforms/transformAnchorTags.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 FrostedGlassPromo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    const FrostedGlassPromo = ({
                      image,
                      children,
                      footer = null,
                      url,
                    Severity: Minor
                    Found in src/app/components/FrostedGlassPromo/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 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');
                    Severity: Minor
                    Found in src/app/legacy/containers/NielsenAnalytics/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 getProviderFromSource has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export const getProviderFromSource = source => {
                      if (source.match(/^https:\/\/twitter\.com/)) {
                        return PROVIDERS.TWITTER;
                      }
                      if (source.match(/^https:\/\/www\.instagram\.com/)) {
                    Severity: Minor
                    Found in src/app/legacy/containers/SocialEmbed/sourceHelpers.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 IndexPageSection has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    const IndexPageSection = ({
                      bar = true,
                      group,
                      sectionNumber,
                      showAllPromos = false,
                    Severity: Minor
                    Found in src/app/legacy/containers/IndexPageSection/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 RecentAudioEpisodes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    const RecentAudioEpisodes = ({
                      masterBrand,
                      episodes,
                      brandId = '',
                      pageType,
                    Severity: Minor
                    Found in src/app/legacy/containers/EpisodeList/RecentAudioEpisodes/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 ScrollablePromo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    const ScrollablePromo = ({ blocks, blockGroupIndex = null }) => {
                      const { script, service, dir, translations } = useContext(ServiceContext);
                    
                      const eventTrackingData = {
                        componentName: `edoj${blockGroupIndex}`,
                    Severity: Minor
                    Found in src/app/legacy/components/ScrollablePromo/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

                    Severity
                    Category
                    Status
                    Source
                    Language