rx/presenters

View on GitHub

Showing 75 of 126 total issues

Method presenters_path has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

          def presenters_path(presenter, host: false, **params)
            presenter = _expand_namespace_(presenter, namespace)
            presenter = presenter.gsub(':', '/')

            path = host ? voom_presenters_web_client_app_url(params, host: router.base_url) :
Severity: Minor
Found in lib/voom/presenters/helpers/rails.rb - 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 setActive_ has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            MaterialStepper.prototype.setActive_ = function (id) {
                /** @type {HTMLElement | null} */
                var active;
                /** MaterialStepper.Steps_.collection<step> */
                var first;
Severity: Minor
Found in views/mdc/assets/js/mdl-stepper.js - About 1 hr to fix

    Function call has 26 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: Minor
    Found in views/mdc/assets/js/components/events/toggle_disabled.js - About 1 hr to fix

      Avoid deeply nested control flow statements.
      Open

                                      if (moved && this.Stepper_.hasFeedback) {
                                          // Remove the (feedback) transient effect before move
                                          this.removeTransientEffect_(step);
                                      }
      Severity: Major
      Found in views/mdc/assets/js/mdl-stepper.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if (!this.displayInputError(key, errors[key])) {
                                    // If not handled at the field level, display at the page level
                                    if (errors[key].length > 0) {
                                        this.prependErrors([errors[key]]);
                                    }
        Severity: Major
        Found in views/mdc/assets/js/components/events/errors.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                          if (step.labelTitleMessageText) {
                                              this.updateTitleMessage_(step, step.labelTitleMessageText);
                                          } else {
                                              this.removeTitleMessage_(step);
                                          }
          Severity: Major
          Found in views/mdc/assets/js/mdl-stepper.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                            for (item in this.Steps_.collection) {
                                                // Rule eslint guard-for-in.
                                                if (this.Steps_.collection.hasOwnProperty(item)) {
                                                    stepItem = this.Steps_.collection[item];
            
            
            Severity: Major
            Found in views/mdc/assets/js/mdl-stepper.js - About 45 mins to fix

              Method initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                          def initialize(**attribs_, &block)
                            super(type: :line, **attribs_, &block)
                            @selected = attribs.delete(:selected) {false}
                            @selectable = attribs.delete(:selectable) {false}
                            self.text(attribs.delete(:text), attribs) if attribs[:text]
              Severity: Minor
              Found in lib/voom/presenters/dsl/components/lists/line.rb - 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

              Method initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                        def initialize(**attribs_, &block)
                          super(type: :dialog, **attribs_, &block)
                          width = attribs.delete(:width)
                          height = attribs.delete(:height)
                          @percent_width = width&.end_with?("%") ? width : nil
              Severity: Minor
              Found in lib/voom/presenters/dsl/components/dialog.rb - 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

              Avoid deeply nested control flow statements.
              Open

                                              if (previous.isEditable) {
                                                  moved = moveStep.bind(this)(previous);
                                              }
              Severity: Major
              Found in views/mdc/assets/js/mdl-stepper.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                                if (step.isOptional || step.id === this.Steps_.total) {
                                                    this.updateStepState_(step, this.StepState_.COMPLETED);
                                                }
                Severity: Major
                Found in views/mdc/assets/js/mdl-stepper.js - About 45 mins to fix

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

                      getData(funcProcessData) {
                          let comp = this.component();
                          console.log(comp);
                          if(comp.value().length < 2){
                              return;
                  Severity: Minor
                  Found in views/mdc/assets/js/components/events/autocomplete.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

                  Method select has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                              def select(options, current_option, total_records, replace_id = @replace_id, replace_presenter = @replace_presenter)
                  Severity: Minor
                  Found in lib/voom/presenters/dsl/components/table.rb - About 35 mins to fix

                    Method initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                              def initialize(type: nil, **attribs_, &block)
                                @button_type = type || ((attribs_[:icon] && !attribs_[:text]) ? :icon : nil) || :flat
                                super(type: :button, **attribs_, &block)
                                @color = attribs.delete(:color)
                                @background_color = attribs.delete(:background_color)
                    Severity: Minor
                    Found in lib/voom/presenters/dsl/components/button.rb - 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 constructor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        constructor(element) {
                            super(element);
                            const pluginClassName = this.element.dataset.pluginCallback;
                            if (pluginClassName) {
                                var PluginClass = null;
                    Severity: Minor
                    Found in views/mdc/assets/js/components/plugins.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 flatten has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        flatten(errors) {
                            if (!errors) {
                                return [];
                            }
                    
                    
                    Severity: Minor
                    Found in views/mdc/assets/js/components/events/errors.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 checkValue has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function checkValue(str, max) {
                        if (str.charAt(0) !== '0' || str === '00') {
                            let num = parseInt(str);
                            if (isNaN(num) || num <= 0 || num > max) num = 1;
                            str = num > parseInt(max.toString().charAt(0)) && num.toString().length === 1 ? '0' + num : num.toString();
                    Severity: Minor
                    Found in views/mdc/assets/js/components/datetime.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 isValidDate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        isValidDate(dateString) {
                            dateString = dateString.replace(/\s+/g, '');
                            if (dateString === '' && !this.input.required) {
                                return true
                            }
                    Severity: Minor
                    Found in views/mdc/assets/js/components/datetime.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

                    Method color_classname has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                              def color_classname(comp, affects = nil, color_attr = :color)
                                color = comp&.public_send(color_attr)
                                return unless color
                    
                                return "v-#{comp.type}__primary" if eq(color, :primary)
                    Severity: Minor
                    Found in lib/voom/presenters/web_client/app.rb - 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

                    Method build_render_url has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                            def build_render_url(render_, params, host:)
                              return '#' unless render_
                              render = render_.to_s
                              return render if render.start_with?('http')
                              render = render.gsub(':', '/')
                    Severity: Minor
                    Found in lib/voom/presenters/router.rb - 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

                    Severity
                    Category
                    Status
                    Source
                    Language