Showing 390 of 2,206 total issues

Function dealWithNonNumericCharacters has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const dealWithNonNumericCharacters = (versionString, timeJson) => {
  const patchVersion = versionString.match(/patch/);
  if (patchVersion) {
    const possibleVersionStrings = versionString.match(
      /@npm:([\d.]+)|@([\d.]+)/,
Severity: Minor
Found in scripts/esmDependencyCheck.js - About 1 hr to fix

    Function performanceNavigationEventHandlerTimingLevel1 has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                        this.performanceNavigationEventHandlerTimingLevel1 = function() {
                            setTimeout((function() {
                                var t = performance.timing,
                                    n = t.navigationStart,
                                    r = {
    Severity: Minor
    Found in public/vendor/cwr.js - About 1 hr to fix

      Function w has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                      function w(e, t, n) {
                          if (!Symbol.asyncIterator)
                              throw new TypeError("Symbol.asyncIterator is not defined.");
                          var r,
                              o = n.apply(e, t || []),
      Severity: Minor
      Found in public/vendor/cwr.js - About 1 hr to fix

        Function signString has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                        }, e.prototype.signString = function(e, t) {
                            var n = void 0 === t ? {} : t,
                                r = n.signingDate,
                                o = void 0 === r ? new Date : r,
                                i = n.signingRegion,
        Severity: Minor
        Found in public/vendor/cwr.js - About 1 hr to fix

          Function rowsTest has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const rowsTest = value => {
            describe('first section', () => {
              it(`should correctly split ${value} stories`, () => {
                const items = numberOfStories[value].input;
                const isFirstSection = true;

            Function allowedItemsTest has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const allowedItemsTest = value => {
              describe('first section', () => {
                it(`should return correct allowed items for ${value} stories`, () => {
                  const items = numberOfStories[value].input;
                  const isFirstSection = true;

              Function AdvertTagLoader has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const AdvertTagLoader = () => {
                const location = useLocation();
                const queryString = location ? location.search : '';
              
                useEffect(() => {
              Severity: Minor
              Found in src/app/components/MediaLoader/index.tsx - About 1 hr to fix

                Function getRemoteGitFile has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const getRemoteGitFile = async (gitDepUrl, args) => {
                  let url = `https://api.github.com/repos/${gitDepUrl}/contents/package.json`;
                  if (url.includes('/tree/')) {
                    url = url
                      .replace(/\/tree\/[^/]+\//, '/contents/')
                Severity: Minor
                Found in scripts/esmDependencyCheck.js - About 1 hr to fix

                  Function assumeRoleWithWebIdentity has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                                  this.assumeRoleWithWebIdentity = function(e) {
                                      return E(t, void 0, void 0, (function() {
                                          var t,
                                              n,
                                              r;
                  Severity: Minor
                  Found in public/vendor/cwr.js - About 1 hr to fix

                    Function bylineExtractor has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const bylineExtractor = (blocks: OptimoBylineContributorBlock[]) => {
                      const bylineBlocks = blocks?.[0]?.model?.blocks || [];
                    
                      const authorBlock = bylineBlocks.find(block => block.type === 'name');
                      const jobRoleBlock = bylineBlocks.find(block => block.type === 'role');
                    Severity: Minor
                    Found in src/app/components/Byline/utilities/bylineExtractor/index.tsx - About 1 hr to fix

                      Function squashTopStories has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const squashTopStories = jsonRaw => {
                        const json = jsonRaw;
                        let groups = pathOr(null, ['content', 'groups'], json);
                        let collectedItems = [];
                        let collectedStrapline;

                        Function checkA11y has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const checkA11y = () => {
                          cy.injectAxe();
                          cy.configureAxe({
                            runOnly: {
                              type: 'tag',
                        Severity: Minor
                        Found in cypress/support/helpers/checkA11y.js - About 1 hr to fix

                          Function LinkContents has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                          const LinkContents = ({ item, isInline = false, id }) => {
                            const {
                              translations: { media: mediaTranslations },
                            } = useContext(ServiceContext);
                          
                          
                          Severity: Minor
                          Found in src/app/legacy/containers/StoryPromo/LinkContents/index.jsx - About 1 hr 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 LinkedData has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                          const LinkedData = ({
                            showAuthor = false,
                            type,
                            seoTitle,
                            headline,
                          Severity: Minor
                          Found in src/app/components/LinkedData/index.tsx - About 1 hr 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 CurationPromo has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                          const CurationPromo = ({
                            id,
                            title,
                            lastPublished,
                            imageUrl,
                          Severity: Minor
                          Found in src/app/components/Curation/CurationPromo/index.tsx - About 1 hr 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 Byline has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                          const Byline = ({
                            blocks,
                            children = null,
                          }: PropsWithChildren<OptimoBylineBlock['model']>) => {
                            const { translations, dir } = useContext(ServiceContext);
                          Severity: Minor
                          Found in src/app/components/Byline/index.tsx - About 1 hr 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 o has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  var o = function() {
                                      function e(e) {
                                          this.method = e.method || "GET",
                                          this.hostname = e.hostname || "localhost",
                                          this.port = e.port,
                          Severity: Minor
                          Found in public/vendor/cwr.js - About 1 hr to fix

                            Function handleServerLogging has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const handleServerLogging = (ctx: DocumentContext) => {
                              const url = ctx.asPath || '';
                              const headers = removeSensitiveHeaders(ctx.req?.headers);
                              const pageType = derivePageType(url);
                              const { statusCode } = ctx.res || {};
                            Severity: Minor
                            Found in ws-nextjs-app/pages/_document.page.tsx - About 1 hr to fix

                              Function fetchEventHandler has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const fetchEventHandler = async event => {
                                if (
                                  /^https:\/\/ichef(\.test)?\.bbci\.co\.uk\/(news|images|ace\/(standard|ws))\/.+.webp$/.test(
                                    event.request.url,
                                  )
                              Severity: Minor
                              Found in public/sw.js - About 1 hr to fix

                                Function getInitialProps has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  static async getInitialProps(ctx: DocumentContext) {
                                    const url = ctx.asPath || '';
                                    const isApp = isAppPath(url);
                                    const isLite = isLitePath(url);
                                
                                
                                Severity: Minor
                                Found in ws-nextjs-app/pages/_document.page.tsx - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language