ophrescue/RescueRails

View on GitHub

Showing 254 of 254 total issues

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

                    L: [ "[0-9]{2}", Date.prototype.setMilliseconds, "milliseconds", function() {
                        return y(Date.prototype.getMilliseconds.call(this), 2);
                    } ],
Severity: Major
Found in app/assets/javascripts/jquery.inputmask.js and 8 other locations - About 35 mins to fix
app/assets/javascripts/jquery.inputmask.js on lines 458..460
app/assets/javascripts/jquery.inputmask.js on lines 471..473
app/assets/javascripts/jquery.inputmask.js on lines 474..476
app/assets/javascripts/jquery.inputmask.js on lines 478..480
app/assets/javascripts/jquery.inputmask.js on lines 487..489
app/assets/javascripts/jquery.inputmask.js on lines 498..500
app/assets/javascripts/jquery.inputmask.js on lines 502..504
app/assets/javascripts/jquery.inputmask.js on lines 505..507

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

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

                    yy: [ "[0-9]{2}", Date.prototype.setFullYear, "year", function() {
                        return y(Date.prototype.getFullYear.call(this), 2);
                    } ],
Severity: Major
Found in app/assets/javascripts/jquery.inputmask.js and 8 other locations - About 35 mins to fix
app/assets/javascripts/jquery.inputmask.js on lines 458..460
app/assets/javascripts/jquery.inputmask.js on lines 474..476
app/assets/javascripts/jquery.inputmask.js on lines 478..480
app/assets/javascripts/jquery.inputmask.js on lines 487..489
app/assets/javascripts/jquery.inputmask.js on lines 498..500
app/assets/javascripts/jquery.inputmask.js on lines 502..504
app/assets/javascripts/jquery.inputmask.js on lines 505..507
app/assets/javascripts/jquery.inputmask.js on lines 508..510

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

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

                    ss: [ "0[0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]", Date.prototype.setSeconds, "seconds", function() {
                        return y(Date.prototype.getSeconds.call(this), 2);
                    } ],
Severity: Major
Found in app/assets/javascripts/jquery.inputmask.js and 8 other locations - About 35 mins to fix
app/assets/javascripts/jquery.inputmask.js on lines 458..460
app/assets/javascripts/jquery.inputmask.js on lines 471..473
app/assets/javascripts/jquery.inputmask.js on lines 474..476
app/assets/javascripts/jquery.inputmask.js on lines 478..480
app/assets/javascripts/jquery.inputmask.js on lines 487..489
app/assets/javascripts/jquery.inputmask.js on lines 498..500
app/assets/javascripts/jquery.inputmask.js on lines 505..507
app/assets/javascripts/jquery.inputmask.js on lines 508..510

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

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

                    HH: [ "0[0-9]|1[0-9]|2[0-3]", Date.prototype.setHours, "hours", function() {
                        return y(Date.prototype.getHours.call(this), 2);
                    } ],
Severity: Major
Found in app/assets/javascripts/jquery.inputmask.js and 8 other locations - About 35 mins to fix
app/assets/javascripts/jquery.inputmask.js on lines 458..460
app/assets/javascripts/jquery.inputmask.js on lines 471..473
app/assets/javascripts/jquery.inputmask.js on lines 474..476
app/assets/javascripts/jquery.inputmask.js on lines 478..480
app/assets/javascripts/jquery.inputmask.js on lines 498..500
app/assets/javascripts/jquery.inputmask.js on lines 502..504
app/assets/javascripts/jquery.inputmask.js on lines 505..507
app/assets/javascripts/jquery.inputmask.js on lines 508..510

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

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

  def validate(record)
    return if record.postal_code.blank?

    country = ISO3166::Country.find_country_by_alpha3(record.country)

Severity: Minor
Found in app/validators/postal_code_validator.rb - About 35 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 changes_to_sentence has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def changes_to_sentence
    result = []
    changed_audit_attributes.each do |attr|
      if attr == 'assigned_to_user_id'
        new_value = user.present? ? user.name : 'No One'
Severity: Minor
Found in app/models/adopter.rb - About 35 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 adopter_age has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def adopter_age
    return unless birth_date

    today = Date.current
    age = today.year - birth_date.year
Severity: Minor
Found in app/models/adoption_app.rb - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

  def show
    session[:last_cat_manager_search] ||= cats_manager_index_url
    @title = @cat.name
    @og_image_path = @cat.primary_photo_url
    @carousel = Carousel.new(@cat)
Severity: Minor
Found in app/controllers/cats/cats_base_controller.rb and 1 other location - About 35 mins to fix
app/controllers/dogs/dogs_base_controller.rb on lines 68..74

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

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

  def show
    session[:last_dog_manager_search] ||= dogs_manager_index_url
    @title = @dog.name
    @og_image_path = @dog.primary_photo_url
    @carousel = Carousel.new(@dog)
Severity: Minor
Found in app/controllers/dogs/dogs_base_controller.rb and 1 other location - About 35 mins to fix
app/controllers/cats/cats_base_controller.rb on lines 18..24

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

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

  def create
    @cat = Cat.new(cat_params)
    @cat.tracking_id = Cat.next_tracking_id if @cat.tracking_id.blank?

    if @cat.save
Severity: Minor
Found in app/controllers/cats/manager_controller.rb and 1 other location - About 30 mins to fix
app/controllers/dogs/manager_controller.rb on lines 114..124

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

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

  def create
    @dog = Dog.new(dog_params)
    @dog.tracking_id = Dog.next_tracking_id if @dog.tracking_id.blank?

    if @dog.save
Severity: Minor
Found in app/controllers/dogs/manager_controller.rb and 1 other location - About 30 mins to fix
app/controllers/cats/manager_controller.rb on lines 64..74

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

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

Avoid too many return statements within this function.
Open

                            return i;
Severity: Major
Found in app/assets/javascripts/jquery.inputmask.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                                if (a === n.groupSeparator) return {
                                    caret: h
                                };
    Severity: Major
    Found in app/assets/javascripts/jquery.inputmask.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                                      if (n.digitsOptional) return {
                                          rewritePosition: o.end
                                      };
      Severity: Major
      Found in app/assets/javascripts/jquery.inputmask.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                                    return {
                                        rewritePosition: t
                                    };
        Severity: Major
        Found in app/assets/javascripts/jquery.inputmask.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                                          } else if (n = g(n, a, r, f)) return !0;
          Severity: Major
          Found in app/assets/javascripts/jquery.inputmask.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                                    return !1;
            Severity: Major
            Found in app/assets/javascripts/jquery.inputmask.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                                                  if (o.begin > p && o.end <= p) return a === n.radixPoint ? {
                                                      insert: {
                                                          pos: p + 1,
                                                          c: "0",
                                                          fromIsValid: !0
              Severity: Major
              Found in app/assets/javascripts/jquery.inputmask.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                        if (void 0 === e) return this.each((function() {
                                            (a = new n.default(t)).mask(this);
                                        }));
                Severity: Major
                Found in app/assets/javascripts/jquery.inputmask.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                              if (-1 !== p && !0 === n._radixDance && !1 === i && a === n.radixPoint && void 0 !== n.digits && (isNaN(n.digits) || parseInt(n.digits) > 0) && p !== t) return {
                                                  caret: n._radixDance && t === p - 1 ? p + 1 : p
                                              };
                  Severity: Major
                  Found in app/assets/javascripts/jquery.inputmask.js - About 30 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language