Dogstudio/highway

View on GitHub

Showing 5 of 10 total issues

Function afterFetch has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  async afterFetch() {
    // We are calling the renderer attached to the view we just fetched and we
    // are adding the [data-router-view] in our DOM.
    const Renderer = await this.properties.renderer;

Severity: Minor
Found in src/core.js - About 1 hr to fix

    Function beforeFetch has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      async beforeFetch() {
        // Push State
        this.pushState();
    
        // We lock the navigation to avoid multiples clicks that could overload the
    Severity: Minor
    Found in src/core.js - About 1 hr to fix

      Function redirect has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        redirect(href, contextual = false, trigger = 'script') {
          // Save Trigger Element
          this.trigger = trigger;
      
          // When our URL is different from the current location `href` and no other
      Severity: Minor
      Found in src/core.js - About 55 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 getRenderer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        getRenderer(slug) {
          // Return Default
          if (!this.renderers) {
            return Promise.resolve(Renderer);
          }
      Severity: Minor
      Found in src/helpers.js - 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

      Avoid too many return statements within this function.
      Open

          return Promise.resolve(Renderer);
      Severity: Major
      Found in src/helpers.js - About 30 mins to fix
        Severity
        Category
        Status
        Source
        Language