A11yWatch/a11ywatch-core

View on GitHub

Showing 96 of 188 total issues

Function setDnsVerifyRoutes has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const setDnsVerifyRoutes = (app: FastifyInstance) => {
  app.get("/api/website/dns", async (req, res) => {
    const userId = validateUserRequest(req);

    // check to see if dns if verified
Severity: Major
Found in src/web/routes_groups/dns-verify.ts - About 2 hrs to fix

    File auth.ts has 272 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { request } from "https";
    import { createUser } from "../../core/controllers/users/set";
    import {
      cancelSubscription,
      runUserChecks,
    Severity: Minor
    Found in src/web/routes_groups/auth.ts - About 2 hrs to fix

      Function getDataUntil has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const getDataUntil = async (
        baseProps: ScoreProps & { resolve: Resolver },
        offset?: number,
        prevIssuesInfo?: any
      ): Promise<void> => {
      Severity: Major
      Found in src/core/controllers/pages/update/utils/domain.ts - About 2 hrs to fix

        Function getReport has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

        export const getReport = async (url: string, userId?: number) => {
          if (!url) {
            return { website: undefined };
          }
          const authenticated = typeof userId !== "undefined";
        Severity: Minor
        Found in src/core/controllers/reports/read.ts - About 2 hrs 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 crawlPage has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

        export const crawlPage = async (
          crawlConfig: CrawlConfig,
          sendEmail?: boolean, // determine if email should be sent based on results
          blockEvent?: boolean // block event from emitting to protect crawl interfere
        ): Promise<ResponseModel> => {
        Severity: Minor
        Found in src/core/actions/accessibility/crawl.ts - About 2 hrs 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 verifyUser has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

        const verifyUser = async ({
          password,
          email,
          googleId,
          githubId,
        Severity: Minor
        Found in src/core/controllers/users/update/verify.ts - About 2 hrs 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 stripeHook has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

        export const stripeHook = async (req, res) => {
          let event: Stripe.Event;
        
          try {
            event = await stripe.webhooks.constructEventAsync(
        Severity: Minor
        Found in src/web/routes_groups/stripe.ts - About 2 hrs 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 priceHandler has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const priceHandler = (plan: string, yearly?: boolean) => {
          const q = (plan && typeof plan === "string" && plan.toUpperCase()) || "";
          let price = 0;
        
          switch (q) {
        Severity: Major
        Found in src/core/utils/price-handler.ts - About 2 hrs to fix

          Function downloadToExcel has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const downloadToExcel = async (
            _req: FastifyContext["request"],
            res: FastifyContext["reply"],
            data: Issue | any
          ) => {
          Severity: Major
          Found in src/core/utils/download-to-excel.ts - About 2 hrs to fix

            Function roleHandler has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const roleHandler = (plan: string) => {
              const q = (plan && typeof plan === "string" && plan.toUpperCase()) || "";
              let role = 0;
            
              switch (q) {
            Severity: Minor
            Found in src/core/utils/price-handler.ts - About 1 hr to fix

              Function crawlStream has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const crawlStream = async (
                req: FastifyContext["request"],
                res: FastifyContext["reply"],
                slim?: boolean
              ) => {
              Severity: Minor
              Found in src/core/streams/crawl.ts - About 1 hr to fix

                Function crawlHttpStreamSlim has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const crawlHttpStreamSlim = (
                  props: CrawlParams,
                  res: FastifyContext["reply"],
                  removeTrailing: boolean = true
                ): Promise<boolean> => {
                Severity: Minor
                Found in src/core/utils/crawl-stream-slim.ts - About 1 hr to fix

                  Function updateScanAttempt has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const updateScanAttempt = async ({
                    userId,
                    user,
                    collection,
                  }: {
                  Severity: Minor
                  Found in src/core/controllers/users/update/scan-attempt.ts - 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 scanWebsite has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                    scanWebsite: async (parent, args, context, info) => {
                      const { url } = args;
                      const { keyid } = context.user?.payload || defaultPayload;
                      const unauth = typeof keyid === "undefined";
                  
                  
                  Severity: Minor
                  Found in src/core/mutations.ts - 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 getWebsiteReport has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const getWebsiteReport = async (
                    req: FastifyContext["request"],
                    res: FastifyContext["reply"]
                  ) => {
                    const download = paramParser(req, "download");
                  Severity: Minor
                  Found in src/web/routes/data/website.ts - About 1 hr to fix

                    Function scanWebsite has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      scanWebsite: async (parent, args, context, info) => {
                        const { url } = args;
                        const { keyid } = context.user?.payload || defaultPayload;
                        const unauth = typeof keyid === "undefined";
                    
                    
                    Severity: Minor
                    Found in src/core/mutations.ts - About 1 hr to fix

                      Function pageUpdate has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const pageUpdate = async (
                        call: ServerWritableStream<
                          { domain: string; url: string; user_id: number; insight: any },
                          {}
                        >,
                      Severity: Minor
                      Found in src/proto/calls/page-update.ts - About 1 hr to fix

                        Function scanSimple has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const scanSimple = async (
                          req: FastifyContext["request"],
                          res: FastifyContext["reply"]
                        ) => {
                          const baseUrl = paramParser(req, "websiteUrl") || paramParser(req, "url");
                        Severity: Minor
                        Found in src/web/routes/scan.ts - About 1 hr to fix

                          Function websiteWatch has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export async function websiteWatch(pages: Website[] = []): Promise<void> {
                            for (const website of pages) {
                              const { userId, url, subdomains, tld, ua, proxy, monitoringEnabled } =
                                website;
                          
                          
                          Severity: Minor
                          Found in src/core/controllers/websites/watch-pages.ts - About 1 hr to fix

                            Function getPagesPaging has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export const getPagesPaging = async (
                              {
                                userId,
                                domain,
                                limit = 5,
                            Severity: Minor
                            Found in src/core/controllers/pages/find/domains.ts - 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

                            Severity
                            Category
                            Status
                            Source
                            Language