withmoney/withmoney-api

View on GitHub

Showing 4 of 96 total issues

File nexus.ts has 1116 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * This file was generated by Nexus Schema
 * Do not make changes to this file directly
 */

Severity: Major
Found in src/generated/nexus.ts - About 2 days to fix

    Function resolve has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      resolve: async (_parent, args, ctx) => {
        const userId = await getUserId(ctx);
    
        let where: NexusGenInputs['OperationWhereInput'] | null = {};
    
    
    Severity: Minor
    Found in src/types/Category/queries/findMany.ts - About 1 hr to fix

      Function resolve has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        resolve: async (
          parent,
          { data: { accountId, name, value, type, isPaid, paidAt, categoryId, creditCardId }, where },
          ctx,
        ) => {
      Severity: Minor
      Found in src/types/Operation/mutations/updateOne.ts - About 45 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 getUserId has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      export async function getUserId(context: Context): Promise<string> {
        const Authorization = context.request.req.get('Authorization');
        if (Authorization) {
          const token = Authorization.replace('Bearer ', '');
          const verifiedToken = verify(token, APP_SECRET) as Token;
      Severity: Minor
      Found in src/utils.ts - About 45 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