lifeart/ember-ast-hot-load

View on GitHub

Showing 58 of 74 total issues

Avoid deeply nested control flow statements.
Open

        if (maybeRoute) {
          routeName = possibleRouteName;
          break;
        } else {
          if (paths.length === 0) {
Severity: Major
Found in addon/services/hot-loader.js - About 45 mins to fix

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

    function onFileRequested(req, res) {
      var appFileName = req.params.name.split('---').join('/');
      if (!appFileName.endsWith('.js')) {
        return res.status(404).send('Not found');
      }
    Severity: Minor
    Found in lib/hot-load-middleware.js - 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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    export function initialize(appInstance) {
      let hotLoadService = lookup(appInstance, 'service:hot-loader');
      if (!hotLoadService) {
        return;
      }
    Severity: Minor
    Found in addon/instance-initializers/hot-loader-livereload-plugin.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

    Function findEntypointFile has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    function findEntypointFile(
      fileName,
      lookupFolder = ['dist', 'assets', ''].join(path.sep)
    ) {
      if (lookupFolder.charAt(lookupFolder.length - 1) !== path.sep) {
    Severity: Minor
    Found in lib/hot-load-middleware.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

    Function _getTemplateCompilerPath has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      _getTemplateCompilerPath() {
        if (this._OPTIONS && this._OPTIONS['templateCompilerPath']) {
          return this._OPTIONS['templateCompilerPath'];
        }
        const npmCompilerPath = path.join(
    Severity: Minor
    Found in index.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 hotLoader.placeholderComponentName();
    Severity: Major
    Found in addon/helpers/hot-load.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return renderComponentName;
      Severity: Major
      Found in addon/helpers/hot-load.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return true;
        Severity: Major
        Found in lib/ast-transform.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

            return node;
          Severity: Major
          Found in lib/ast-transform.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return this.reloadWindow();
            Severity: Major
            Found in addon/services/hot-loader.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return false;
              Severity: Major
              Found in addon/services/hot-loader.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                  return false;
                Severity: Major
                Found in lib/ast-transform.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        return false;
                  Severity: Major
                  Found in lib/ast-transform.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return hotLoader.renderDynamicComponentHelper(
                              name,
                              context,
                              maybePropertyValue
                            );
                    Severity: Major
                    Found in addon/helpers/hot-load.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return false;
                      Severity: Major
                      Found in lib/ast-transform.js - About 30 mins to fix

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

                          _scopedComponentNames(name, scope) {
                            const closestRelativeName = []
                              .concat(this.muScopedComponents, this.currentRouteComponents())
                              .filter((resolvedName) => resolvedName.endsWith(name))
                              .pop();
                        Severity: Minor
                        Found in addon/services/hot-loader.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

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

                        export function clearRequirejsCache(context, componentName) {
                          const owner = getOwner(context);
                          const config = owner.resolveRegistration('config:environment');
                        
                          const modulePrefix = get(config, 'modulePrefix') || 'dummy';
                        Severity: Minor
                        Found in addon/utils/cleaners.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

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

                          _ensureFindHost() {
                            if (!this._findHost) {
                              this._findHost = function findHostShim() {
                                let current = this;
                                let app;
                        Severity: Minor
                        Found in index.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