rx/presenters

View on GitHub

Showing 75 of 126 total issues

File mdl-stepper.js has 596 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
    This file was copied from the MDL Stepper Polyfill at https://ahlechandre.github.io/mdl-stepper/component/
    The stepper looks and behaves failry well but we wanted some specific behavior changes so pulled in a copy here.
 */

Severity: Major
Found in views/mdc/assets/js/mdl-stepper.js - About 1 day to fix

    Function call has 130 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        call(results, eventParams) {
            this.clearErrors();
            let method = this.method;
    
            const ev = new CustomEvent('V:postStarted', {
    Severity: Major
    Found in views/mdc/assets/js/components/events/posts.js - About 5 hrs to fix

      Function displayErrors has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

          displayErrors(result) {
              const {statusCode, contentType, content} = result;
      
              let responseErrors = null;
      
      
      Severity: Minor
      Found in views/mdc/assets/js/components/events/errors.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 call has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          call(results) {
              const targetId = this.targetId;
              const action = this.params.action;
              const delayAmt = this.event instanceof FocusEvent ? 500 : 0;
              const elem = this.root.getElementById(targetId);
      Severity: Minor
      Found in views/mdc/assets/js/components/events/toggle_visibility.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

      Method build_hash has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          def build_hash
            accessable = instance_variables.map {|i| i.to_s.gsub('@', '').to_sym} & methods
            accessable.reduce({}) do |hash, v|
              trace {"#{v}:#{params.inspect}"}
              params = Parameters.new(method(v).parameters)
      Severity: Minor
      Found in lib/voom/serializer.rb - 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 call has 77 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          call() {
              const event = this.event;
              const target = getEventTarget(event);
              let eventParams = {};
      
      
      Severity: Major
      Found in views/mdc/assets/js/components/events.js - About 3 hrs to fix

        Function initEvents has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

        export function initEvents(e) {
            console.debug('\tEvents');
        
            for (const eventElem of getEventElements(e)) {
                var eventsData = JSON.parse(eventElem.dataset.events);
        Severity: Minor
        Found in views/mdc/assets/js/components/events.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 call has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            call(results, eventParams) {
                this.clearErrors();
                let method = this.method;
        
                const ev = new CustomEvent('V:postStarted', {
        Severity: Minor
        Found in views/mdc/assets/js/components/events/posts.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 call has 72 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            call(results, eventParams=[]) {
                this.clearErrors();
        
                const httpRequest = new XMLHttpRequest();
                const root = this.root;
        Severity: Major
        Found in views/mdc/assets/js/components/events/replaces.js - About 2 hrs to fix

          Class Event has 24 methods (exceeds 20 allowed). Consider refactoring.
          Open

                  class Event < Base
                    attr_accessor :event, :actions
                    # Alias common event names
                    EVENT_MAP = {focus: :focusin, blur: :focusout, onload: :after_init}
          
          
          Severity: Minor
          Found in lib/voom/presenters/dsl/components/event.rb - About 2 hrs to fix

            Function updateStepState_ has 64 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                        MaterialStepper.prototype.updateStepState_ = function (step, state) {
                            /** @type {string} */
                            var stateClass;
                            /** @type {HTMLElement} */
                            var indicatorContent;
            Severity: Major
            Found in views/mdc/assets/js/mdl-stepper.js - About 2 hrs to fix

              Class App has 22 methods (exceeds 20 allowed). Consider refactoring.
              Open

                    class App < Sinatra::Base
                      include Trace
                      set :root, File.expand_path('../../../../..', __FILE__)
                      set :router_, WebClient::Router
                      set :bind, '0.0.0.0'
              Severity: Minor
              Found in lib/voom/presenters/web_client/app.rb - About 2 hrs to fix

                Function initLists has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                export function initLists(e) {
                    console.debug('\tLists');
                    let components = e.querySelectorAll('.mdc-list');
                
                    if (components.length === 0 && e.offsetParent && e.offsetParent.vComponent !== undefined) {
                Severity: Minor
                Found in views/mdc/assets/js/components/lists.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 call has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    call(results) {
                        const targetId = this.targetId;
                        const action = this.params.action;
                        const delayAmt = this.event instanceof FocusEvent ? 500 : 0;
                        const elem = this.root.getElementById(targetId);
                Severity: Major
                Found in views/mdc/assets/js/components/events/toggle_visibility.js - About 2 hrs to fix

                  Class UserInterface has 21 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                        class UserInterface
                          include DSL::Definer
                          include DSL::ProtectFromForgery
                          include Components::Mixins::Common
                          include Components::Mixins::Helpers
                  Severity: Minor
                  Found in lib/voom/presenters/dsl/user_interface.rb - About 2 hrs to fix

                    Method expand_hash has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def expand_hash(h)
                          HashExt::Traverse.traverse(h.to_h) do |k,v|
                            if !v.is_a?(Array) && v.respond_to?(:to_h)
                              v = v.is_a?(OpenStruct) ? expand_hash(v.to_h) : v.to_h
                            elsif v.is_a?(Array)
                    Severity: Minor
                    Found in lib/voom/presenters/web_client/helpers/expand_hash.rb - 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 next has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                                MaterialStepper.prototype.next = function () {
                                    /** @type {boolean} */
                                    var moved;
                                    /** @type {MaterialStepper.Steps_.collection<step>} */
                                    var step;
                    Severity: Minor
                    Found in views/mdc/assets/js/mdl-stepper.js - About 1 hr to fix

                      Function onreadystatechange has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                                  httpRequest.onreadystatechange = (event) => {
                                      if (httpRequest.readyState === XMLHttpRequest.DONE) {
                                          const contentType = httpRequest.getResponseHeader('content-type');
                                          console.debug(httpRequest.status + ':' + contentType);
                      
                      
                      Severity: Minor
                      Found in views/mdc/assets/js/components/events/posts.js - About 1 hr to fix

                        Function action_class has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            static action_class(action, event, root) {
                                const action_type = action[0];
                                const url = action[1];
                                const options = action[2];
                                const params = action[3];
                        Severity: Minor
                        Found in views/mdc/assets/js/components/events.js - About 1 hr to fix

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

                                      MaterialStepper.prototype.getStepModel_ = function (step, id) {
                                          /** @type {Object} */
                                          var model;
                                          /** @type {string} */
                                          var selectorActionsBack;
                          Severity: Minor
                          Found in views/mdc/assets/js/mdl-stepper.js - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language