mhuggins/ruby-measurement

View on GitHub
lib/ruby-measurement/definitions/us_customary/length.rb

Summary

Maintainability
D
1 day
Test Coverage

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

Measurement.define(:'ft.') do |unit|
  unit.alias :ft, :foot, :feet, :"'"
  unit.convert_to(:mi) { |value| value / 5_280.0 }
  unit.convert_to(:ch) { |value| value / 66.0 }
  unit.convert_to(:fur) { |value| value / 660.0 }
Severity: Major
Found in lib/ruby-measurement/definitions/us_customary/length.rb and 1 other location - About 1 hr to fix
lib/ruby-measurement/definitions/us_customary/length.rb on lines 69..77

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

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

Measurement.define(:'in.') do |unit|
  unit.alias :in, :inch, :inches, :'"'
  unit.convert_to(:mi) { |value| value / 63_360.0 }
  unit.convert_to(:fur) { |value| value / 7_920.0 }
  unit.convert_to(:ch) { |value| value / 792.0 }
Severity: Major
Found in lib/ruby-measurement/definitions/us_customary/length.rb and 1 other location - About 1 hr to fix
lib/ruby-measurement/definitions/us_customary/length.rb on lines 58..66

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

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

Measurement.define(:'yd.') do |unit|
  unit.alias :yd, :yard, :yards
  unit.convert_to(:mi) { |value| value / 1_760.0 }
  unit.convert_to(:fur) { |value| value / 220.0 }
  unit.convert_to(:ch) { |value| value / 22.0 }
Severity: Major
Found in lib/ruby-measurement/definitions/us_customary/length.rb and 4 other locations - About 1 hr to fix
lib/ruby-measurement/definitions/us_customary/length.rb on lines 3..11
lib/ruby-measurement/definitions/us_customary/length.rb on lines 14..22
lib/ruby-measurement/definitions/us_customary/length.rb on lines 25..33
lib/ruby-measurement/definitions/us_customary/length.rb on lines 36..44

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

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

Measurement.define(:'fur.') do |unit|
  unit.alias :fur, :furlong, :furlongs
  unit.convert_to(:mi) { |value| value / 8.0 }
  unit.convert_to(:ch) { |value| value * 10.0 }
  unit.convert_to(:ftm) { |value| value * 110.0 }
Severity: Major
Found in lib/ruby-measurement/definitions/us_customary/length.rb and 4 other locations - About 1 hr to fix
lib/ruby-measurement/definitions/us_customary/length.rb on lines 3..11
lib/ruby-measurement/definitions/us_customary/length.rb on lines 25..33
lib/ruby-measurement/definitions/us_customary/length.rb on lines 36..44
lib/ruby-measurement/definitions/us_customary/length.rb on lines 47..55

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

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

Measurement.define(:'ch.') do |unit|
  unit.alias :ch, :chain, :chains
  unit.convert_to(:mi) { |value| value / 80.0 }
  unit.convert_to(:fur) { |value| value / 10.0 }
  unit.convert_to(:ftm) { |value| value * 11.0 }
Severity: Major
Found in lib/ruby-measurement/definitions/us_customary/length.rb and 4 other locations - About 1 hr to fix
lib/ruby-measurement/definitions/us_customary/length.rb on lines 3..11
lib/ruby-measurement/definitions/us_customary/length.rb on lines 14..22
lib/ruby-measurement/definitions/us_customary/length.rb on lines 36..44
lib/ruby-measurement/definitions/us_customary/length.rb on lines 47..55

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

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

Measurement.define(:'mi.') do |unit|
  unit.alias :mi, :mile, :miles
  unit.convert_to(:fur) { |value| value * 8.0 }
  unit.convert_to(:ch) { |value| value * 80.0 }
  unit.convert_to(:ftm) { |value| value * 880.0 }
Severity: Major
Found in lib/ruby-measurement/definitions/us_customary/length.rb and 4 other locations - About 1 hr to fix
lib/ruby-measurement/definitions/us_customary/length.rb on lines 14..22
lib/ruby-measurement/definitions/us_customary/length.rb on lines 25..33
lib/ruby-measurement/definitions/us_customary/length.rb on lines 36..44
lib/ruby-measurement/definitions/us_customary/length.rb on lines 47..55

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

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

Measurement.define(:'ftm.') do |unit|
  unit.alias :ftm, :fathom, :fathoms
  unit.convert_to(:mi) { |value| value / 880.0 }
  unit.convert_to(:fur) { |value| value / 110.0 }
  unit.convert_to(:ch) { |value| value / 11.0 }
Severity: Major
Found in lib/ruby-measurement/definitions/us_customary/length.rb and 4 other locations - About 1 hr to fix
lib/ruby-measurement/definitions/us_customary/length.rb on lines 3..11
lib/ruby-measurement/definitions/us_customary/length.rb on lines 14..22
lib/ruby-measurement/definitions/us_customary/length.rb on lines 25..33
lib/ruby-measurement/definitions/us_customary/length.rb on lines 47..55

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

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

Measurement.define(:'th.') do |unit|
  unit.alias :th, :thou
  unit.convert_to(:mi) { |value| value / 63_360_000.0 }
  unit.convert_to(:fur) { |value| value / 7_920_000.0 }
  unit.convert_to(:ch) { |value| value / 792_000.0 }
Severity: Major
Found in lib/ruby-measurement/definitions/us_customary/length.rb and 16 other locations - About 1 hr to fix
lib/ruby-measurement/definitions/metric/length.rb on lines 3..11
lib/ruby-measurement/definitions/metric/length.rb on lines 14..22
lib/ruby-measurement/definitions/metric/length.rb on lines 25..33
lib/ruby-measurement/definitions/metric/length.rb on lines 36..44
lib/ruby-measurement/definitions/metric/length.rb on lines 47..55
lib/ruby-measurement/definitions/metric/length.rb on lines 58..66
lib/ruby-measurement/definitions/metric/length.rb on lines 69..77
lib/ruby-measurement/definitions/metric/length.rb on lines 80..88
lib/ruby-measurement/definitions/metric/volume.rb on lines 3..11
lib/ruby-measurement/definitions/metric/volume.rb on lines 14..22
lib/ruby-measurement/definitions/metric/volume.rb on lines 25..33
lib/ruby-measurement/definitions/metric/volume.rb on lines 36..44
lib/ruby-measurement/definitions/metric/volume.rb on lines 47..55
lib/ruby-measurement/definitions/metric/volume.rb on lines 58..66
lib/ruby-measurement/definitions/metric/volume.rb on lines 69..77
lib/ruby-measurement/definitions/metric/volume.rb on lines 80..88

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

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

There are no issues that match your filters.

Category
Status