lifeart/ember-ast-hot-load

View on GitHub

Showing 74 of 74 total issues

File hot-loader.js has 468 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import Service from '@ember/service';
import Evented from '@ember/object/evented';
import Component from '@ember/component';
import { getOwner } from '@ember/application';
import { get, computed } from '@ember/object';
Severity: Minor
Found in addon/services/hot-loader.js - About 7 hrs to fix

    File ast-transform.js has 374 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // builders ref https://github.com/glimmerjs/glimmer-vm/blob/master/packages/%40glimmer/syntax/lib/builders.ts
    const HOT_LOAD_HELPER_NAME = 'hot-load';
    // for cases like {{#let (component 'foo-bar') as |Boo|}}  <Boo />a {{/let}}
    var nestedNames = [];
    
    
    Severity: Minor
    Found in lib/ast-transform.js - About 5 hrs to fix

      `` has 37 functions (exceeds 20 allowed). Consider refactoring.
      Open

      export default Service.extend(Evented, {
        templateOptionsKey: null,
        templateCompilerKey: null,
        useOriginalVendorFile: false,
        scriptDownloadErrors: 0,
      Severity: Minor
      Found in addon/services/hot-loader.js - About 4 hrs to fix

        File ast-transform.test.js has 361 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        'use strict';
        
        /* eslint-env jest */
        const defaultConfig = {
          addonContext: {
        Severity: Minor
        Found in lib/ast-transform.test.js - About 4 hrs to fix

          Function createPlugin has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

          function createPlugin(appName, hotReloadService, rootUrl, baseUrl) {
            function Plugin(window, host) {
              this.window = window;
              this.host = host;
            }
          Severity: Minor
          Found in addon/instance-initializers/hot-loader-livereload-plugin.js - About 4 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 willHotReloadRouteTemplate has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

            willHotReloadRouteTemplate(attrs) {
              const meta = getPossibleRouteTemplateMeta(attrs, this.podModulePrefix);
              if (!meta.looksLikeRouteTemplate) {
                return;
              }
          Severity: Minor
          Found in addon/services/hot-loader.js - About 4 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 createPlugin has 76 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function createPlugin(appName, hotReloadService, rootUrl, baseUrl) {
            function Plugin(window, host) {
              this.window = window;
              this.host = host;
            }
          Severity: Major
          Found in addon/instance-initializers/hot-loader-livereload-plugin.js - About 3 hrs to fix

            Function onFileRequested has 70 lines of code (exceeds 25 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: Major
            Found in lib/hot-load-middleware.js - About 2 hrs to fix

              Function HotReloader has 69 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              module.exports = function HotReloader(options) {
                var fsWatcher = options.watcher;
                var ui = options.ui;
                var _isRunning = false;
                var lsProxy = options.ssl ? require('https') : require('http');
              Severity: Major
              Found in lib/hot-reloader.js - About 2 hrs to fix

                Function compute has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                  compute([
                    name,
                    context = {},
                    maybePropertyValue = undefined,
                    astStringName = '',
                Severity: Minor
                Found in addon/helpers/hot-load.js - About 2 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 createASTPlugin has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  static createASTPlugin(config, syntax) {
                    let b = syntax.builders;
                    let options = config || { helpers: [] };
                    nestedNames = [];
                    const visitor = {
                Severity: Major
                Found in lib/ast-transform.js - About 2 hrs to fix

                  Function reload has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    Plugin.prototype.reload = function (path) {
                      let crossOrigin;
                      const cancelableEvent = { modulePath: path, cancel: false, components: [] };
                      hotReloadService.triggerInRunLoop('willLiveReload', cancelableEvent);
                      if (cancelableEvent.cancel) {
                  Severity: Major
                  Found in addon/instance-initializers/hot-loader-livereload-plugin.js - About 2 hrs to fix

                    Function HotReloader has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                    Open

                    module.exports = function HotReloader(options) {
                      var fsWatcher = options.watcher;
                      var ui = options.ui;
                      var _isRunning = false;
                      var lsProxy = options.ssl ? require('https') : require('http');
                    Severity: Minor
                    Found in lib/hot-reloader.js - About 2 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 initialize has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export function initialize(application) {
                      if (typeof window !== 'object') {
                        return;
                      }
                    
                    
                    Severity: Minor
                    Found in addon/instance-initializers/resolver-hot-loader-patch.js - About 2 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 compute has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      compute([
                        name,
                        context = {},
                        maybePropertyValue = undefined,
                        astStringName = '',
                    Severity: Major
                    Found in addon/helpers/hot-load.js - About 2 hrs to fix

                      Function willHotReloadRouteTemplate has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        willHotReloadRouteTemplate(attrs) {
                          const meta = getPossibleRouteTemplateMeta(attrs, this.podModulePrefix);
                          if (!meta.looksLikeRouteTemplate) {
                            return;
                          }
                      Severity: Major
                      Found in addon/services/hot-loader.js - About 2 hrs to fix

                        Function clearRequirejsCache has 47 lines of code (exceeds 25 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 1 hr to fix

                          Function createASTPlugin has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                            static createASTPlugin(config, syntax) {
                              let b = syntax.builders;
                              let options = config || { helpers: [] };
                              nestedNames = [];
                              const visitor = {
                          Severity: Minor
                          Found in lib/ast-transform.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 matchingComponent has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export function matchingComponent(rawComponentName, path) {
                            if (typeof path !== 'string') {
                              return false;
                            }
                            if (typeof rawComponentName !== 'string') {
                          Severity: Minor
                          Found in addon/utils/matchers.js - About 1 hr to fix

                            Function testHotReloadChangedUrl has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            async function testHotReloadChangedUrl(options, expectedUrl) {
                              jest.mock('http');
                              jest.mock('https');
                              const http = require('http');
                              const https = require('https');
                            Severity: Minor
                            Found in lib/hot-reloader.test.js - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language