rx/presenters

View on GitHub

Showing 126 of 126 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    actionsSucceeded(vEvent) {
        const ev = new CustomEvent('V:actionsSucceeded', {
            bubbles: true,
            cancelable: false,
            detail: vEvent,
Severity: Major
Found in views/mdc/assets/js/components/base-component.js and 1 other location - About 1 hr to fix
views/mdc/assets/js/components/base-component.js on lines 78..86

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 57.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    clear() {
        if (this.element.vPlugin && this.element.vPlugin.clear) {
            return this.element.vPlugin.clear();
        }
    }
Severity: Major
Found in views/mdc/assets/js/components/plugins.js and 2 other locations - About 1 hr to fix
views/mdc/assets/js/components/plugins.js on lines 54..58
views/mdc/assets/js/components/plugins.js on lines 60..64

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 57.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function serialize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    serialize(obj, prefix) {
        var str = [],
            p;
        for (p in obj) {
            if (obj.hasOwnProperty(p)) {
Severity: Minor
Found in views/mdc/assets/js/utils/urls.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 previewComponent has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    previewComponent(e) {
        if (!this.preview) return null;
        for (const previewId of this.preview) {
            const elem = this.root.querySelector(`#${previewId}`);

Severity: Minor
Found in views/mdc/assets/js/components/file-inputs.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

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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                  MaterialStepper.prototype.getActive = function () {
                      return this.Steps_.collection[this.Steps_.active - 1].container;
                  };
      Severity: Major
      Found in views/mdc/assets/js/mdl-stepper.js and 1 other location - About 1 hr to fix
      views/mdc/assets/js/mdl-stepper.js on lines 349..351

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 55.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                  MaterialStepper.prototype.getActiveId = function () {
                      return this.Steps_.collection[this.Steps_.active - 1].id;
                  };
      Severity: Major
      Found in views/mdc/assets/js/mdl-stepper.js and 1 other location - About 1 hr to fix
      views/mdc/assets/js/mdl-stepper.js on lines 341..343

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 55.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          clear() {
              for (const comp of this.inputComponents()) {
                  if (comp.respondTo('clear')) {
                      comp.clear();
                  }
      Severity: Minor
      Found in views/mdc/assets/js/components/base-container.js and 1 other location - About 55 mins to fix
      views/mdc/assets/js/components/base-container.js on lines 42..48

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 53.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          reset() {
              for (const comp of this.inputComponents()) {
                  if (comp.respondTo('reset')) {
                      comp.reset();
                  }
      Severity: Minor
      Found in views/mdc/assets/js/components/base-container.js and 1 other location - About 55 mins to fix
      views/mdc/assets/js/components/base-container.js on lines 34..40

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 53.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

                  Severity
                  Category
                  Status
                  Source
                  Language