A11yWatch/a11ywatch-core

View on GitHub

Showing 188 of 188 total issues

Avoid too many return statements within this function.
Open

  return await collection.updateOne(
    queryParams,
    { $set: source },
    {
      upsert: shouldUpdate === "upsert",
Severity: Major
Found in src/core/utils/collection-upsert.ts - About 30 mins to fix

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

    export const setAuthRoutes = (app: FastifyInstance) => {
      app.post("/api/register", registerLimiter, async (req, res) => {
        const allowed = await allowedNext(
          req?.headers?.authorization || req.cookies.jwt,
          req,
    Severity: Minor
    Found in src/web/routes_groups/auth.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 getServerConfig has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    const getServerConfig = (
      extra?: ApolloServerFastifyConfig
    ): ApolloServerFastifyConfig => {
      const schema = createScheme();
    
    
    Severity: Minor
    Found in src/apollo-server.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 initDbConnection has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    const initDbConnection = async (dbconnection?: string) => {
      client = await createClient(dbconnection);
    
      if (client) {
        try {
    Severity: Minor
    Found in src/database/client.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 responseWrap has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    export const responseWrap = async (res: FastifyContext["reply"], source) => {
      const { callback, userId } = source ?? {};
    
      let message = HttpMessage.Ok;
      let code = StatusCode.Ok;
    Severity: Minor
    Found in src/web/response.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 watcherCrawl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    export const watcherCrawl = async (
      {
        url,
        userId,
        scan = false,
    Severity: Minor
    Found in src/core/actions/accessibility/watcher_crawl.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 getHostName has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    export const getHostName = (url: string) => {
      if (!url) {
        return "";
      }
      let q = decodeURIComponent(url);
    Severity: Minor
    Found in src/core/utils/get-host.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 statusBadge has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    export const statusBadge = async (
      req: FastifyContext["request"],
      res: FastifyContext["reply"]
    ) => {
      const domain = (req.params as any)?.domain?.replace(".svg", "");
    Severity: Minor
    Found in src/web/routes/resources/badge.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

    Severity
    Category
    Status
    Source
    Language