JulienChapron/simple-address-book

View on GitHub

Showing 5 of 17 total issues

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

import { contacts } from "../models/Contact.ts";
import { Bson } from "https://deno.land/x/mongo@v0.29.4/mod.ts";
import { decode as base64Decode } from "https://deno.land/std@0.130.0/encoding/base64.ts";
import { AES } from "https://deno.land/x/god_crypto/aes.ts";
import { v4 } from "https://deno.land/std@0.130.0/uuid/mod.ts";
Severity: Minor
Found in server/controllers/contactsController.ts - About 2 hrs to fix

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

    const addContact = async ({
      request,
      response,
    }: {
      request: any;
    Severity: Minor
    Found in server/controllers/contactsController.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 signup has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export const signup = async ({ request, response }: {
      request: any;
      response: any;
    }) => {
      try {
    Severity: Minor
    Found in server/controllers/authController.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 updateContact has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    const updateContact = async ({
      params,
      request,
      response,
    }: {
    Severity: Minor
    Found in server/controllers/contactsController.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 login has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    export const login = async ({ request, response }: {
      request: any;
      response: any;
    }) => {
      try {
    Severity: Minor
    Found in server/controllers/authController.ts - About 35 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