CMDBrew/adminterface

View on GitHub

Showing 93 of 93 total issues

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

class StringInputGroupingTest < ActiveAdmin::InputTestCase
  test "renders prepend" do
    form = build_form do |f|
      f.inputs do
        f.input :name, as: :string, prepend: content_tag(:span, "prepend text", class: "input-group-text")
Severity: Major
Found in test/lib/extensions/inputs/string_input_test.rb and 14 other locations - About 1 hr to fix
test/lib/extensions/inputs/color_input_test.rb on lines 32..50
test/lib/extensions/inputs/country_input_test.rb on lines 42..60
test/lib/extensions/inputs/datalist_input_test.rb on lines 47..65
test/lib/extensions/inputs/date_picker_input_test.rb on lines 57..75
test/lib/extensions/inputs/datetime_picker_input_test.rb on lines 57..75
test/lib/extensions/inputs/email_input_test.rb on lines 42..60
test/lib/extensions/inputs/file_input_test.rb on lines 42..60
test/lib/extensions/inputs/number_input_test.rb on lines 42..60
test/lib/extensions/inputs/password_input_test.rb on lines 42..60
test/lib/extensions/inputs/phone_input_test.rb on lines 42..60
test/lib/extensions/inputs/search_input_test.rb on lines 42..60
test/lib/extensions/inputs/time_picker_input_test.rb on lines 42..60
test/lib/extensions/inputs/time_zone_input_test.rb on lines 42..60
test/lib/extensions/inputs/url_input_test.rb on lines 42..60

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

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 15 locations. Consider refactoring.
Open

class EmailInputGroupingTest < ActiveAdmin::InputTestCase
  test "renders prepend" do
    form = build_form do |f|
      f.inputs do
        f.input :email, as: :email, prepend: content_tag(:span, "prepend text", class: "input-group-text")
Severity: Major
Found in test/lib/extensions/inputs/email_input_test.rb and 14 other locations - About 1 hr to fix
test/lib/extensions/inputs/color_input_test.rb on lines 32..50
test/lib/extensions/inputs/country_input_test.rb on lines 42..60
test/lib/extensions/inputs/datalist_input_test.rb on lines 47..65
test/lib/extensions/inputs/date_picker_input_test.rb on lines 57..75
test/lib/extensions/inputs/datetime_picker_input_test.rb on lines 57..75
test/lib/extensions/inputs/file_input_test.rb on lines 42..60
test/lib/extensions/inputs/number_input_test.rb on lines 42..60
test/lib/extensions/inputs/password_input_test.rb on lines 42..60
test/lib/extensions/inputs/phone_input_test.rb on lines 42..60
test/lib/extensions/inputs/search_input_test.rb on lines 42..60
test/lib/extensions/inputs/string_input_test.rb on lines 42..60
test/lib/extensions/inputs/time_picker_input_test.rb on lines 42..60
test/lib/extensions/inputs/time_zone_input_test.rb on lines 42..60
test/lib/extensions/inputs/url_input_test.rb on lines 42..60

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

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 15 locations. Consider refactoring.
Open

class PasswordInputGroupingTest < ActiveAdmin::InputTestCase
  test "renders prepend" do
    form = build_form do |f|
      f.inputs do
        f.input :secret, as: :password, prepend: content_tag(:span, "prepend text", class: "input-group-text")
Severity: Major
Found in test/lib/extensions/inputs/password_input_test.rb and 14 other locations - About 1 hr to fix
test/lib/extensions/inputs/color_input_test.rb on lines 32..50
test/lib/extensions/inputs/country_input_test.rb on lines 42..60
test/lib/extensions/inputs/datalist_input_test.rb on lines 47..65
test/lib/extensions/inputs/date_picker_input_test.rb on lines 57..75
test/lib/extensions/inputs/datetime_picker_input_test.rb on lines 57..75
test/lib/extensions/inputs/email_input_test.rb on lines 42..60
test/lib/extensions/inputs/file_input_test.rb on lines 42..60
test/lib/extensions/inputs/number_input_test.rb on lines 42..60
test/lib/extensions/inputs/phone_input_test.rb on lines 42..60
test/lib/extensions/inputs/search_input_test.rb on lines 42..60
test/lib/extensions/inputs/string_input_test.rb on lines 42..60
test/lib/extensions/inputs/time_picker_input_test.rb on lines 42..60
test/lib/extensions/inputs/time_zone_input_test.rb on lines 42..60
test/lib/extensions/inputs/url_input_test.rb on lines 42..60

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

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 15 locations. Consider refactoring.
Open

class PhoneInputGroupingTest < ActiveAdmin::InputTestCase
  test "renders prepend" do
    form = build_form do |f|
      f.inputs do
        f.input :telephone, as: :phone, prepend: content_tag(:span, "prepend text", class: "input-group-text")
Severity: Major
Found in test/lib/extensions/inputs/phone_input_test.rb and 14 other locations - About 1 hr to fix
test/lib/extensions/inputs/color_input_test.rb on lines 32..50
test/lib/extensions/inputs/country_input_test.rb on lines 42..60
test/lib/extensions/inputs/datalist_input_test.rb on lines 47..65
test/lib/extensions/inputs/date_picker_input_test.rb on lines 57..75
test/lib/extensions/inputs/datetime_picker_input_test.rb on lines 57..75
test/lib/extensions/inputs/email_input_test.rb on lines 42..60
test/lib/extensions/inputs/file_input_test.rb on lines 42..60
test/lib/extensions/inputs/number_input_test.rb on lines 42..60
test/lib/extensions/inputs/password_input_test.rb on lines 42..60
test/lib/extensions/inputs/search_input_test.rb on lines 42..60
test/lib/extensions/inputs/string_input_test.rb on lines 42..60
test/lib/extensions/inputs/time_picker_input_test.rb on lines 42..60
test/lib/extensions/inputs/time_zone_input_test.rb on lines 42..60
test/lib/extensions/inputs/url_input_test.rb on lines 42..60

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

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 15 locations. Consider refactoring.
Open

class UrlInputGroupingTest < ActiveAdmin::InputTestCase
  test "renders prepend" do
    form = build_form do |f|
      f.inputs do
        f.input :website, as: :url, prepend: content_tag(:span, "prepend text", class: "input-group-text")
Severity: Major
Found in test/lib/extensions/inputs/url_input_test.rb and 14 other locations - About 1 hr to fix
test/lib/extensions/inputs/color_input_test.rb on lines 32..50
test/lib/extensions/inputs/country_input_test.rb on lines 42..60
test/lib/extensions/inputs/datalist_input_test.rb on lines 47..65
test/lib/extensions/inputs/date_picker_input_test.rb on lines 57..75
test/lib/extensions/inputs/datetime_picker_input_test.rb on lines 57..75
test/lib/extensions/inputs/email_input_test.rb on lines 42..60
test/lib/extensions/inputs/file_input_test.rb on lines 42..60
test/lib/extensions/inputs/number_input_test.rb on lines 42..60
test/lib/extensions/inputs/password_input_test.rb on lines 42..60
test/lib/extensions/inputs/phone_input_test.rb on lines 42..60
test/lib/extensions/inputs/search_input_test.rb on lines 42..60
test/lib/extensions/inputs/string_input_test.rb on lines 42..60
test/lib/extensions/inputs/time_picker_input_test.rb on lines 42..60
test/lib/extensions/inputs/time_zone_input_test.rb on lines 42..60

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

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 15 locations. Consider refactoring.
Open

class DatetimePickerInputGroupingTest < ActiveAdmin::InputTestCase
  test "renders prepend" do
    form = build_form do |f|
      f.inputs do
        f.input :updated_at, as: :datetime_picker, prepend: content_tag(:span, "prepend text", class: "input-group-text")
Severity: Major
Found in test/lib/extensions/inputs/datetime_picker_input_test.rb and 14 other locations - About 1 hr to fix
test/lib/extensions/inputs/color_input_test.rb on lines 32..50
test/lib/extensions/inputs/country_input_test.rb on lines 42..60
test/lib/extensions/inputs/datalist_input_test.rb on lines 47..65
test/lib/extensions/inputs/date_picker_input_test.rb on lines 57..75
test/lib/extensions/inputs/email_input_test.rb on lines 42..60
test/lib/extensions/inputs/file_input_test.rb on lines 42..60
test/lib/extensions/inputs/number_input_test.rb on lines 42..60
test/lib/extensions/inputs/password_input_test.rb on lines 42..60
test/lib/extensions/inputs/phone_input_test.rb on lines 42..60
test/lib/extensions/inputs/search_input_test.rb on lines 42..60
test/lib/extensions/inputs/string_input_test.rb on lines 42..60
test/lib/extensions/inputs/time_picker_input_test.rb on lines 42..60
test/lib/extensions/inputs/time_zone_input_test.rb on lines 42..60
test/lib/extensions/inputs/url_input_test.rb on lines 42..60

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

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 15 locations. Consider refactoring.
Open

class TimePickerInputGroupingTest < ActiveAdmin::InputTestCase
  test "renders prepend" do
    form = build_form do |f|
      f.inputs do
        f.input :updated_at, as: :time_picker, prepend: content_tag(:span, "prepend text", class: "input-group-text")
Severity: Major
Found in test/lib/extensions/inputs/time_picker_input_test.rb and 14 other locations - About 1 hr to fix
test/lib/extensions/inputs/color_input_test.rb on lines 32..50
test/lib/extensions/inputs/country_input_test.rb on lines 42..60
test/lib/extensions/inputs/datalist_input_test.rb on lines 47..65
test/lib/extensions/inputs/date_picker_input_test.rb on lines 57..75
test/lib/extensions/inputs/datetime_picker_input_test.rb on lines 57..75
test/lib/extensions/inputs/email_input_test.rb on lines 42..60
test/lib/extensions/inputs/file_input_test.rb on lines 42..60
test/lib/extensions/inputs/number_input_test.rb on lines 42..60
test/lib/extensions/inputs/password_input_test.rb on lines 42..60
test/lib/extensions/inputs/phone_input_test.rb on lines 42..60
test/lib/extensions/inputs/search_input_test.rb on lines 42..60
test/lib/extensions/inputs/string_input_test.rb on lines 42..60
test/lib/extensions/inputs/time_zone_input_test.rb on lines 42..60
test/lib/extensions/inputs/url_input_test.rb on lines 42..60

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

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 15 locations. Consider refactoring.
Open

class CountryInputGroupingTest < ActiveAdmin::InputTestCase
  test "renders prepend" do
    form = build_form do |f|
      f.inputs do
        f.input :country, as: :country, prepend: content_tag(:span, "prepend text", class: "input-group-text")
Severity: Major
Found in test/lib/extensions/inputs/country_input_test.rb and 14 other locations - About 1 hr to fix
test/lib/extensions/inputs/color_input_test.rb on lines 32..50
test/lib/extensions/inputs/datalist_input_test.rb on lines 47..65
test/lib/extensions/inputs/date_picker_input_test.rb on lines 57..75
test/lib/extensions/inputs/datetime_picker_input_test.rb on lines 57..75
test/lib/extensions/inputs/email_input_test.rb on lines 42..60
test/lib/extensions/inputs/file_input_test.rb on lines 42..60
test/lib/extensions/inputs/number_input_test.rb on lines 42..60
test/lib/extensions/inputs/password_input_test.rb on lines 42..60
test/lib/extensions/inputs/phone_input_test.rb on lines 42..60
test/lib/extensions/inputs/search_input_test.rb on lines 42..60
test/lib/extensions/inputs/string_input_test.rb on lines 42..60
test/lib/extensions/inputs/time_picker_input_test.rb on lines 42..60
test/lib/extensions/inputs/time_zone_input_test.rb on lines 42..60
test/lib/extensions/inputs/url_input_test.rb on lines 42..60

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

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

  _defaultInputHTMLOptions () {
    const options = {
      class: `form-check-input ${this.options.as}`,
      type: 'checkbox'
    }
Severity: Major
Found in app/javascript/adminterface/lib/inputs/boolean_input.js and 1 other location - About 1 hr to fix
app/javascript/adminterface/lib/inputs/color_input.js on lines 4..11

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

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

  def build(menu, options = {})
    dropdown = options.delete(:dropdown) { false }
    menu_class = dropdown ? "dropdown-menu" : ""
    item_class = dropdown ? "dropdown-item" : ""

Severity: Minor
Found in lib/adminterface/extensions/views/components/menu.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

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

  _defaultInputHTMLOptions () {
    const options = {
      class: `form-control form-control-color ${this.options.as}`,
      type: 'color'
    }
Severity: Major
Found in app/javascript/adminterface/lib/inputs/color_input.js and 1 other location - About 1 hr to fix
app/javascript/adminterface/lib/inputs/boolean_input.js on lines 12..19

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

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 _bind has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  _bind () {
    const _self = this
    const dialogEl = this._create()
    const dialogForm = dialogEl.querySelector('#modal-dialog-confirm-form') || {}
    const confirmButton = dialogEl.querySelector('#modal-dialog-confirm-button') || {}
Severity: Minor
Found in app/javascript/adminterface/lib/confirm_dialog.js - About 1 hr to fix

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

        test "updates components" do
          assert_equal("rtl", @application.lang_dir)
          assert_equal({input: "string"}, @application.components[:comments].deep_symbolize_keys)
          assert_equal(
            {
    Severity: Major
    Found in test/lib/configurations_test.rb and 2 other locations - About 1 hr to fix
    test/lib/configurations_test.rb on lines 70..79
    test/lib/configurations_test.rb on lines 114..123

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

    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

        test "updates components" do
          assert_equal "rtl", @namespace.lang_dir
          assert_equal({input: "string"}, @namespace.components[:comments].deep_symbolize_keys)
          assert_equal(
            {
    Severity: Major
    Found in test/lib/configurations_test.rb and 2 other locations - About 1 hr to fix
    test/lib/configurations_test.rb on lines 35..44
    test/lib/configurations_test.rb on lines 114..123

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

    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

        test "updates components" do
          assert_equal "rtl", @resource.lang_dir
          assert_equal({input: "string"}, @resource.components[:comments].deep_symbolize_keys)
          assert_equal(
            {
    Severity: Major
    Found in test/lib/configurations_test.rb and 2 other locations - About 1 hr to fix
    test/lib/configurations_test.rb on lines 35..44
    test/lib/configurations_test.rb on lines 70..79

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

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

            def build_comment(comment)
              div for: comment, class: "active_admin_comment #{item_class[:wrapper]}".squish do
                div class: "active_admin_comment_header #{item_class.dig(:header, :wrapper)}".squish do
                  div class: "active_admin_comment_meta #{item_class.dig(:header, :meta)}".squish do
                    div class: "active_admin_comment_author #{item_class.dig(:header, :author)}".squish do

    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

      _getAllTimeZones () {
        const timeZones = adminterface.meta.timeZones
    
        if (timeZones.error) {
          console.error(timeZones)
    Severity: Major
    Found in app/javascript/adminterface/lib/inputs/time_zone_input.js and 1 other location - About 1 hr to fix
    app/javascript/adminterface/lib/inputs/country_input.js on lines 52..61

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

    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

      _getAllCountries () {
        const countries = adminterface.meta.countries
    
        if (countries.error) {
          console.error(countries)
    Severity: Major
    Found in app/javascript/adminterface/lib/inputs/country_input.js and 1 other location - About 1 hr to fix
    app/javascript/adminterface/lib/inputs/time_zone_input.js on lines 30..39

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

    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

    class CheckBoxesInputTest < ActiveAdmin::InputTestCase
      setup do
        @form = build_form do |f|
          f.inputs do
            f.input :interests, as: :check_boxes, collection: %w[movies]
    Severity: Minor
    Found in test/lib/extensions/inputs/check_boxes_input_test.rb and 1 other location - About 55 mins to fix
    test/lib/extensions/inputs/radio_input_test.rb on lines 3..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 46.

    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

    class RadioInputTest < ActiveAdmin::InputTestCase
      setup do
        @form = build_form do |f|
          f.inputs do
            f.input :interests, as: :radio, collection: %w[movies]
    Severity: Minor
    Found in test/lib/extensions/inputs/radio_input_test.rb and 1 other location - About 55 mins to fix
    test/lib/extensions/inputs/check_boxes_input_test.rb on lines 3..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 46.

    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