rx/presenters

View on GitHub

Showing 126 of 126 total issues

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

    actionsFinished(vEvent) {
        const parentDialog = this.parentComponent('.v-dialog');

        if (!parentDialog) {
            return;
Severity: Minor
Found in views/mdc/assets/js/components/button.js and 2 other locations - About 30 mins to fix
views/mdc/assets/js/components/button.js on lines 47..55
views/mdc/assets/js/components/button.js on lines 57..65

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

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

    actionsHalted(vEvent) {
        const parentDialog = this.parentComponent('.v-dialog');

        if (!parentDialog) {
            return;
Severity: Minor
Found in views/mdc/assets/js/components/button.js and 2 other locations - About 30 mins to fix
views/mdc/assets/js/components/button.js on lines 57..65
views/mdc/assets/js/components/button.js on lines 67..75

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

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

    actionsSucceeded(vEvent) {
        const parentDialog = this.parentComponent('.v-dialog');

        if (!parentDialog) {
            return;
Severity: Minor
Found in views/mdc/assets/js/components/button.js and 2 other locations - About 30 mins to fix
views/mdc/assets/js/components/button.js on lines 47..55
views/mdc/assets/js/components/button.js on lines 67..75

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

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 expandParams has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function expandParams(results, params) {
    const expandedParams = {};

    for (const [key, value] of Object.entries(params)) {
        if (!isObject(value) || value.type === 'action_parameter') {
Severity: Minor
Found in views/mdc/assets/js/components/events/action_parameter.js - About 25 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 initDragAndDrop has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function initDragAndDrop(root) {
    const draggables = Array.from(root.querySelectorAll(DRAGGABLE_SELECTOR));

    if (typeof root.matches === 'function' && root.matches(DRAGGABLE_SELECTOR)) {
        draggables.unshift(root);
Severity: Minor
Found in views/mdc/assets/js/components/drag_n_drop.js - About 25 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

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

            def initialize(**attribs, &block)
              super(type: :divider, **attribs, &block)
              @position = validate_position(attribs.delete(:position) { :top })
              @size = validate_size(attribs.delete(:size) { :normal })
              @color = attribs.delete(:color) { :primary }
Severity: Minor
Found in lib/voom/presenters/dsl/components/menu.rb and 1 other location - About 25 mins to fix
lib/voom/presenters/dsl/components/menu.rb on lines 101..105

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

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 _table_row_ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def _table_row_(__columns__, block, except, item_, timezone: nil)
            __columns__.each do |col|
              next if except.include?(col.name.to_sym)
                value = format_value(col.name,item_.send(col.name.to_sym), timezone: timezone)
              column value do
Severity: Minor
Found in lib/voom/presenters/helpers/rails/model_table.rb - About 25 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 render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def render
          comp = ComponentDecoratorFactory.build(@comp)
          components = @components.map { |c| ComponentDecoratorFactory.build(c) }

          return public_send(:"render_#{@scope ? "_#{@scope}_" : nil}#{@comp.type}",
Severity: Minor
Found in lib/voom/presenters/web_client/component_renderer.rb - About 25 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 validate_padding has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

            def validate_padding(padding_)
              valid_padding = %i(top right bottom left
                                 top0 right0 bottom0 left0
                                 top1 right1 bottom1 left1
                                 top2 right2 bottom2 left2
Severity: Minor
Found in lib/voom/presenters/dsl/components/mixins/padding.rb - About 25 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 fireAfterLoad has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function fireAfterLoad(e) {
    for (const eventElem of getEventElements(e)) {
        var eventsData = JSON.parse(eventElem.dataset.events);
        for (var j = 0; j < eventsData.length; j++) {
            var eventData = eventsData[j];
Severity: Minor
Found in views/mdc/assets/js/components/events.js - About 25 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 optionSelected has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    optionSelected() {
        const dataList = this.element.querySelector('datalist');
        if (dataList) {
            const parentElement = this.input;
            // If we find the input inside our list, we submit the form
Severity: Minor
Found in views/mdc/assets/js/components/text-fields.js - About 25 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

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

            def initialize(**attribs, &block)
              super(type: :label, **attribs, &block)
              @position = validate_position(attribs.delete(:position) { :top })
              @size = validate_size(attribs.delete(:size) { :normal })
              @color = attribs.delete(:color) { :primary }
Severity: Minor
Found in lib/voom/presenters/dsl/components/menu.rb and 1 other location - About 25 mins to fix
lib/voom/presenters/dsl/components/menu.rb on lines 112..116

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

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 removeEvents has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function removeEvents(elem) {
    console.debug('\tuninitEvents');

    for (const eventElem of getEventElements(elem)) {
        let eventsData = JSON.parse(eventElem.dataset.events);
Severity: Minor
Found in views/mdc/assets/js/components/events.js - About 25 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 getEventTarget has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function getEventTarget(event) {
  if (typeof event.composedPath === 'function') {
    const compTarget = event.composedPath()[0];

    if (compTarget) {
Severity: Minor
Found in views/mdc/assets/js/components/get_event_target.js - About 25 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 helpers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

            def helpers(module_=nil, &block)
              return unless module_ || block
              @helpers ||= Module.new
              @helpers.include module_ if module_
              @helpers.module_eval(&block) if block
Severity: Minor
Found in lib/voom/presenters/dsl/components/mixins/helpers.rb - About 25 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 validate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    validate(form, params) {
        console.debug('Form validate', form, params);

        const errors = [];

Severity: Minor
Found in views/mdc/assets/js/components/base-container.js - About 25 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 global_namespace_css has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def global_namespace_css(path)
          return unless custom_css_path && path
          namespace_path = path.split('/').reject { |c| c.empty? }.first
          css_file = File.join(custom_css_path, namespace_path ? namespace_path : '')
          css_file = File.join(css_file, 'global.css')
Severity: Minor
Found in lib/voom/presenters/web_client/custom_css.rb - About 25 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 render_presenter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def render_presenter(presenter)
          begin
            before_render = Presenters::Settings.config.presenters.before_render
            render_instead, ctx = before_render
                                    .lazy
Severity: Minor
Found in lib/voom/presenters/api/app.rb - About 25 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 search has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def search(term)
          require 'yaml'
          return [] unless term
          @terms ||= YAML::load_file(File.join(__dir__, './search-terms.yml'))
          @terms.keys.reduce([]) do |matches, topic|
Severity: Minor
Found in lib/voom/presenters/demo/search.rb - About 25 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 traverse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.traverse(hash, &block)
      hash.inject({}) do |h,(k,v)|
        if Hash === v
          v = traverse(v,&block)
        end
Severity: Minor
Found in lib/hash_ext/traverse.rb - About 25 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