jerrythomas/kavach

View on GitHub

Showing 11 of 24 total issues

Function serialize has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

export function serialize(name, val, options) {
    const opt = { maxAge: null, ...(options || {}) }
    const enc = opt.encode || encode

    if (typeof enc !== 'function') {
Severity: Minor
Found in packages/cookie/src/index.js - About 3 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 md5cycle has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function md5cycle(x, k) {
    let a = x[0],
        b = x[1],
        c = x[2],
        d = x[3]
Severity: Major
Found in packages/hashing/src/md5.js - About 2 hrs to fix

    Function serialize has 67 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function serialize(name, val, options) {
        const opt = { maxAge: null, ...(options || {}) }
        const enc = opt.encode || encode
    
        if (typeof enc !== 'function') {
    Severity: Major
    Found in packages/cookie/src/index.js - About 2 hrs to fix

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

      export async function getAdapter(options) {
          const client = await createAuth0Client(
              pick(['domain', 'clientId', 'redirectUri'], options)
          )
      
      
      Severity: Minor
      Found in adapters/auth0/src/adapter.js - About 1 hr to fix

        Function parse has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        export function parse(str, options) {
            if (typeof str !== 'string') {
                throw new TypeError('argument str must be a string')
            }
        
        
        Severity: Minor
        Found in packages/cookie/src/index.js - 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 hh has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function hh(a, b, c, d, x, s, t) {
        Severity: Major
        Found in packages/hashing/src/md5.js - About 50 mins to fix

          Function ff has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          function ff(a, b, c, d, x, s, t) {
          Severity: Major
          Found in packages/hashing/src/md5.js - About 50 mins to fix

            Function gg has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            function gg(a, b, c, d, x, s, t) {
            Severity: Major
            Found in packages/hashing/src/md5.js - About 50 mins to fix

              Function ii has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              function ii(a, b, c, d, x, s, t) {
              Severity: Major
              Found in packages/hashing/src/md5.js - About 50 mins to fix

                Function cmn has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function cmn(q, a, b, x, s, t) {
                Severity: Minor
                Found in packages/hashing/src/md5.js - About 45 mins to fix

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

                  async function handleSignIn(client, credentials) {
                      const { email, phone, password, provider, scopes = [] } = credentials
                      const redirectTo = credentials.redirectTo ?? defaultOrigin
                  
                      let result = null
                  Severity: Minor
                  Found in adapters/supabase/src/adapter.js - 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