rx/presenters

View on GitHub

Showing 75 of 126 total issues

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

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

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