CMDBrew/adminterface

View on GitHub

Showing 82 of 93 total issues

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

  test('bindAddEvent called with correctly element and click event added', () => {
    const spyOnBindAddEvent = jest.spyOn(
      HasManyClass.prototype,
      '_bindAddEvent'
    )
Severity: Major
Found in app/javascript/adminterface/lib/__tests__/has_many.spec.js and 2 other locations - About 6 hrs to fix
app/javascript/adminterface/lib/__tests__/has_many.spec.js on lines 100..118
app/javascript/adminterface/lib/__tests__/has_many.spec.js on lines 120..138

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

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('bindRemoveEvent called with element and click event added', () => {
    const spyOnBindRemoveEvent = jest.spyOn(
      HasManyClass.prototype,
      '_bindRemoveEvent'
    )
Severity: Major
Found in app/javascript/adminterface/lib/__tests__/has_many.spec.js and 2 other locations - About 6 hrs to fix
app/javascript/adminterface/lib/__tests__/has_many.spec.js on lines 100..118
app/javascript/adminterface/lib/__tests__/has_many.spec.js on lines 173..192

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

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('bindDestroyEvent called with element and change event added', () => {
    const spyOnBindDestroyEvent = jest.spyOn(
      HasManyClass.prototype,
      '_bindDestroyEvent'
    )
Severity: Major
Found in app/javascript/adminterface/lib/__tests__/has_many.spec.js and 2 other locations - About 6 hrs to fix
app/javascript/adminterface/lib/__tests__/has_many.spec.js on lines 120..138
app/javascript/adminterface/lib/__tests__/has_many.spec.js on lines 173..192

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

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

  test('bind does not call add when cookie is activeClass and breakpointHelper is not visible', () => {
    windowSpy.mockImplementation(() => ({
      getComputedStyle: () => ({
        visibility: 'not-visible'
      })
app/javascript/adminterface/lib/__tests__/header_toggler.spec.js on lines 81..92

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

  test('bind does not call add when cookie is not activeClass and breakpoint is visible', () => {
    windowSpy.mockImplementation(() => ({
      getComputedStyle: () => ({
        visibility: 'visible'
      })
app/javascript/adminterface/lib/__tests__/header_toggler.spec.js on lines 94..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 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

const initInputCounter = function (element) {
  const inputCounterTriggerList = [].slice.call(element.querySelectorAll('[data-aa-input-counter]'))

  inputCounterTriggerList.map((el) => {
    const options = JSON.parse(el.dataset.aaInputCounter || '{}')
app/javascript/adminterface/initializers/header_toggler.js on lines 3..10

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

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

document.addEventListener('DOMContentLoaded', () => {
  const togglerTriggerList = [].slice.call(document.querySelectorAll('[data-aa-header-toggler]'))
  togglerTriggerList.map((el) => {
    const options = JSON.parse(el.dataset.aaHeaderToggler || '{}')

Severity: Major
Found in app/javascript/adminterface/initializers/header_toggler.js and 1 other location - About 2 hrs to fix
app/javascript/adminterface/initializers/plugins/input_counter.js on lines 3..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 84.

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

  _formatTimeZones () {
    const _self = this

    this.timeZones = this.timeZones.map(function (item) {
      if (item === _self._divider()) {
Severity: Major
Found in app/javascript/adminterface/lib/inputs/time_zone_input.js and 1 other location - About 2 hrs to fix
app/javascript/adminterface/lib/inputs/country_input.js on lines 63..73

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

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

  _formatCountries () {
    const _self = this

    this.countries = this.countries.map(function (item) {
      if (item === _self._divider()) {
Severity: Major
Found in app/javascript/adminterface/lib/inputs/country_input.js and 1 other location - About 2 hrs to fix
app/javascript/adminterface/lib/inputs/time_zone_input.js on lines 41..51

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

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

module DatePickerInputScenarios
  extend ActiveSupport::Concern

  def find_wrapper(form)
    @wrapper ||= form.find(".input.date_picker")
Severity: Major
Found in test/lib/extensions/inputs/date_picker_input_test.rb and 1 other location - About 2 hrs to fix
test/lib/extensions/inputs/datetime_picker_input_test.rb on lines 3..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 81.

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

module DatetimePickerInputScenarios
  extend ActiveSupport::Concern

  def find_wrapper(form)
    @wrapper ||= form.find(".input.datetime_picker")
Severity: Major
Found in test/lib/extensions/inputs/datetime_picker_input_test.rb and 1 other location - About 2 hrs to fix
test/lib/extensions/inputs/date_picker_input_test.rb on lines 3..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 81.

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 DatalistInputGroupingTest < ActiveAdmin::InputTestCase
  test "renders prepend" do
    form = build_form do |f|
      f.inputs do
        f.input :friend, as: :datalist, prepend: content_tag(:span, "prepend text", class: "input-group-text")
Severity: Major
Found in test/lib/extensions/inputs/datalist_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/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 15 locations. Consider refactoring.
Open

class DatePickerInputGroupingTest < ActiveAdmin::InputTestCase
  test "renders prepend" do
    form = build_form do |f|
      f.inputs do
        f.input :updated_at, as: :date_picker, prepend: content_tag(:span, "prepend text", class: "input-group-text")
Severity: Major
Found in test/lib/extensions/inputs/date_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/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 15 locations. Consider refactoring.
Open

class SearchInputGroupingTest < ActiveAdmin::InputTestCase
  test "renders prepend" do
    form = build_form do |f|
      f.inputs do
        f.input :keyword, as: :search, prepend: content_tag(:span, "prepend text", class: "input-group-text")
Severity: Major
Found in test/lib/extensions/inputs/search_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/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 TimeZoneInputGroupingTest < ActiveAdmin::InputTestCase
  test "renders prepend" do
    form = build_form do |f|
      f.inputs do
        f.input :timezone, as: :time_zone, prepend: content_tag(:span, "prepend text", class: "input-group-text")
Severity: Major
Found in test/lib/extensions/inputs/time_zone_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/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 ColorInputGroupingTest < ActiveAdmin::InputTestCase
  test "renders prepend" do
    form = build_form do |f|
      f.inputs do
        f.input :favorite_color, as: :color, prepend: content_tag(:span, "prepend text", class: "input-group-text")
Severity: Major
Found in test/lib/extensions/inputs/color_input_test.rb and 14 other locations - About 1 hr to fix
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
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 FileInputGroupingTest < ActiveAdmin::InputTestCase
  test "renders prepend" do
    form = build_form do |f|
      f.inputs do
        f.input :image, as: :file, prepend: content_tag(:span, "prepend text", class: "input-group-text")
Severity: Major
Found in test/lib/extensions/inputs/file_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/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 NumberInputGroupingTest < ActiveAdmin::InputTestCase
  test "renders prepend" do
    form = build_form do |f|
      f.inputs do
        f.input :quantity, as: :number, prepend: content_tag(:span, "prepend text", class: "input-group-text")
Severity: Major
Found in test/lib/extensions/inputs/number_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/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 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

Severity
Category
Status
Source
Language