rx/presenters

View on GitHub

Showing 126 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

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

                  MaterialStepper.prototype.dispatchEventOnStepSkip_ = function (step) {
                      if (!step.actionsSkip) return false;
      
                      step.actionsSkip.addEventListener('click', function (event) {
                          event.preventDefault();
      Severity: Major
      Found in views/mdc/assets/js/mdl-stepper.js and 2 other locations - About 3 hrs to fix
      views/mdc/assets/js/mdl-stepper.js on lines 1016..1025
      views/mdc/assets/js/mdl-stepper.js on lines 1049..1057

      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 104.

      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

                  MaterialStepper.prototype.dispatchEventOnStepBack_ = function (step) {
                      if (!step.actionsBack) return false;
      
                      step.actionsBack.addEventListener('click', function (event) {
                          event.preventDefault();
      Severity: Major
      Found in views/mdc/assets/js/mdl-stepper.js and 2 other locations - About 3 hrs to fix
      views/mdc/assets/js/mdl-stepper.js on lines 1016..1025
      views/mdc/assets/js/mdl-stepper.js on lines 1033..1041

      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 104.

      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

                  MaterialStepper.prototype.dispatchEventOnStepCancel_ = function (step) {
                      if (!step.actionsCancel) return false;
      
                      step.actionsCancel.addEventListener('click', function (event) {
                          event.preventDefault();
      Severity: Major
      Found in views/mdc/assets/js/mdl-stepper.js and 2 other locations - About 3 hrs to fix
      views/mdc/assets/js/mdl-stepper.js on lines 1033..1041
      views/mdc/assets/js/mdl-stepper.js on lines 1049..1057

      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 104.

      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

      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

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

                      if (!elem) {
                          const err = new Error(
                              `Unable to locate node ${targetId}!`
                              + ' Did you forget to attach it?',
                          );
              Severity: Major
              Found in views/mdc/assets/js/components/events/toggle_visibility.js and 1 other location - About 2 hrs to fix
              views/mdc/assets/js/components/events/toggle_disabled.js on lines 15..28

              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 86.

              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

                  if (!elem) {
                    const err = new Error(
                      `Unable to locate node ${targetId}!`
                      + ' Did you forget to attach it?',
                    );
              Severity: Major
              Found in views/mdc/assets/js/components/events/toggle_disabled.js and 1 other location - About 2 hrs to fix
              views/mdc/assets/js/components/events/toggle_visibility.js on lines 15..28

              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 86.

              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

                      if (!(dialog && dialog.vComponent)) {
                          const err = new Error(
                              `Unable to find dialog ${this.dialogId}. `
                              + 'Did you forget to attach it?'
                          );
              Severity: Major
              Found in views/mdc/assets/js/components/events/dialog.js and 2 other locations - About 2 hrs to fix
              views/mdc/assets/js/components/events/close_dialog.js on lines 13..25
              views/mdc/assets/js/components/events/close_dialog.js on lines 26..38

              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 85.

              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

                          if (!elem.vComponent || !elem.vComponent.respondTo('closeDialog')) {
                              const err = new Error(
                                  `Element at node ${this.elementId} does not contain a component that reponds to `
                                  + 'the closeDialog() method. Are you targeting the correct element.');
              
              
              Severity: Major
              Found in views/mdc/assets/js/components/events/close_dialog.js and 2 other locations - About 2 hrs to fix
              views/mdc/assets/js/components/events/close_dialog.js on lines 13..25
              views/mdc/assets/js/components/events/dialog.js on lines 12..25

              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 85.

              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

                          if (!elem) {
                              const err = new Error(
                                  `Unable to locate node ${this.elementId}!`
                                  + ' Did you forget to attach it?');
              
              
              Severity: Major
              Found in views/mdc/assets/js/components/events/close_dialog.js and 2 other locations - About 2 hrs to fix
              views/mdc/assets/js/components/events/close_dialog.js on lines 26..38
              views/mdc/assets/js/components/events/dialog.js on lines 12..25

              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 85.

              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

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

                  isDirty() {
                      if (!this.dirtyable) {
                          return false;
                      }
                      const currVal = new Date(this.fp.input.value);
              Severity: Major
              Found in views/mdc/assets/js/components/datetime.js and 1 other location - About 2 hrs to fix
              views/mdc/assets/js/components/datetime.js on lines 75..82

              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 83.

              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

              Severity
              Category
              Status
              Source
              Language