mhuggins/ruby-measurement

View on GitHub

Showing 60 of 61 total issues

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

Measurement.define(:kg) do |unit|
  unit.alias :kilogram, :kilograms
  unit.convert_to(:t) { |value| value / 1_000.0 }
  unit.convert_to(:hg) { |value| value * 10.0 }
  unit.convert_to(:dag) { |value| value * 100.0 }
Severity: Major
Found in lib/ruby-measurement/definitions/metric/weight.rb and 7 other locations - About 1 hr to fix
lib/ruby-measurement/definitions/metric/weight.rb on lines 27..36
lib/ruby-measurement/definitions/metric/weight.rb on lines 39..48
lib/ruby-measurement/definitions/metric/weight.rb on lines 51..60
lib/ruby-measurement/definitions/metric/weight.rb on lines 63..72
lib/ruby-measurement/definitions/metric/weight.rb on lines 75..84
lib/ruby-measurement/definitions/metric/weight.rb on lines 87..96
lib/ruby-measurement/definitions/metric/weight.rb on lines 99..108

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

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

Measurement.define(:dg) do |unit|
  unit.alias :decigram, :decigrams
  unit.convert_to(:t) { |value| value / 10_000_000.0 }
  unit.convert_to(:kg) { |value| value / 10_000.0 }
  unit.convert_to(:hg) { |value| value / 1_000.0 }
Severity: Major
Found in lib/ruby-measurement/definitions/metric/weight.rb and 7 other locations - About 1 hr to fix
lib/ruby-measurement/definitions/metric/weight.rb on lines 15..24
lib/ruby-measurement/definitions/metric/weight.rb on lines 27..36
lib/ruby-measurement/definitions/metric/weight.rb on lines 39..48
lib/ruby-measurement/definitions/metric/weight.rb on lines 51..60
lib/ruby-measurement/definitions/metric/weight.rb on lines 75..84
lib/ruby-measurement/definitions/metric/weight.rb on lines 87..96
lib/ruby-measurement/definitions/metric/weight.rb on lines 99..108

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

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

Measurement.define(:g) do |unit|
  unit.alias :gram, :grams
  unit.convert_to(:t) { |value| value / 1_000_000.0 }
  unit.convert_to(:kg) { |value| value / 1_000.0 }
  unit.convert_to(:hg) { |value| value / 100.0 }
Severity: Major
Found in lib/ruby-measurement/definitions/metric/weight.rb and 7 other locations - About 1 hr to fix
lib/ruby-measurement/definitions/metric/weight.rb on lines 15..24
lib/ruby-measurement/definitions/metric/weight.rb on lines 27..36
lib/ruby-measurement/definitions/metric/weight.rb on lines 39..48
lib/ruby-measurement/definitions/metric/weight.rb on lines 63..72
lib/ruby-measurement/definitions/metric/weight.rb on lines 75..84
lib/ruby-measurement/definitions/metric/weight.rb on lines 87..96
lib/ruby-measurement/definitions/metric/weight.rb on lines 99..108

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

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

Measurement.define(:µg) do |unit|
  unit.alias :microgram, :micrograms
  unit.convert_to(:t) { |value| value / 10_000_000_000.0 }
  unit.convert_to(:kg) { |value| value / 10_000_000.0 }
  unit.convert_to(:hg) { |value| value / 1_000_000.0 }
Severity: Major
Found in lib/ruby-measurement/definitions/metric/weight.rb and 7 other locations - About 1 hr to fix
lib/ruby-measurement/definitions/metric/weight.rb on lines 15..24
lib/ruby-measurement/definitions/metric/weight.rb on lines 27..36
lib/ruby-measurement/definitions/metric/weight.rb on lines 39..48
lib/ruby-measurement/definitions/metric/weight.rb on lines 51..60
lib/ruby-measurement/definitions/metric/weight.rb on lines 63..72
lib/ruby-measurement/definitions/metric/weight.rb on lines 75..84
lib/ruby-measurement/definitions/metric/weight.rb on lines 87..96

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

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

Measurement.define(:hg) do |unit|
  unit.alias :hectogram, :hectograms
  unit.convert_to(:t) { |value| value / 10_000.0 }
  unit.convert_to(:kg) { |value| value / 10.0 }
  unit.convert_to(:dag) { |value| value * 10.0 }
Severity: Major
Found in lib/ruby-measurement/definitions/metric/weight.rb and 7 other locations - About 1 hr to fix
lib/ruby-measurement/definitions/metric/weight.rb on lines 15..24
lib/ruby-measurement/definitions/metric/weight.rb on lines 39..48
lib/ruby-measurement/definitions/metric/weight.rb on lines 51..60
lib/ruby-measurement/definitions/metric/weight.rb on lines 63..72
lib/ruby-measurement/definitions/metric/weight.rb on lines 75..84
lib/ruby-measurement/definitions/metric/weight.rb on lines 87..96
lib/ruby-measurement/definitions/metric/weight.rb on lines 99..108

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

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

Measurement.define(:mg) do |unit|
  unit.alias :milligram, :milligrams
  unit.convert_to(:t) { |value| value / 1_000_000_000.0 }
  unit.convert_to(:kg) { |value| value / 1_000_000.0 }
  unit.convert_to(:hg) { |value| value / 100_000.0 }
Severity: Major
Found in lib/ruby-measurement/definitions/metric/weight.rb and 7 other locations - About 1 hr to fix
lib/ruby-measurement/definitions/metric/weight.rb on lines 15..24
lib/ruby-measurement/definitions/metric/weight.rb on lines 27..36
lib/ruby-measurement/definitions/metric/weight.rb on lines 39..48
lib/ruby-measurement/definitions/metric/weight.rb on lines 51..60
lib/ruby-measurement/definitions/metric/weight.rb on lines 63..72
lib/ruby-measurement/definitions/metric/weight.rb on lines 75..84
lib/ruby-measurement/definitions/metric/weight.rb on lines 99..108

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

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

Measurement.define(:cg) do |unit|
  unit.alias :centigram, :centigrams
  unit.convert_to(:t) { |value| value / 100_000_000.0 }
  unit.convert_to(:kg) { |value| value / 100_000.0 }
  unit.convert_to(:hg) { |value| value / 10_000.0 }
Severity: Major
Found in lib/ruby-measurement/definitions/metric/weight.rb and 7 other locations - About 1 hr to fix
lib/ruby-measurement/definitions/metric/weight.rb on lines 15..24
lib/ruby-measurement/definitions/metric/weight.rb on lines 27..36
lib/ruby-measurement/definitions/metric/weight.rb on lines 39..48
lib/ruby-measurement/definitions/metric/weight.rb on lines 51..60
lib/ruby-measurement/definitions/metric/weight.rb on lines 63..72
lib/ruby-measurement/definitions/metric/weight.rb on lines 87..96
lib/ruby-measurement/definitions/metric/weight.rb on lines 99..108

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

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

Measurement.define(:dag) do |unit|
  unit.alias :dekagram, :dekagrams
  unit.convert_to(:t) { |value| value / 100_000.0 }
  unit.convert_to(:kg) { |value| value / 100.0 }
  unit.convert_to(:hg) { |value| value / 10.0 }
Severity: Major
Found in lib/ruby-measurement/definitions/metric/weight.rb and 7 other locations - About 1 hr to fix
lib/ruby-measurement/definitions/metric/weight.rb on lines 15..24
lib/ruby-measurement/definitions/metric/weight.rb on lines 27..36
lib/ruby-measurement/definitions/metric/weight.rb on lines 51..60
lib/ruby-measurement/definitions/metric/weight.rb on lines 63..72
lib/ruby-measurement/definitions/metric/weight.rb on lines 75..84
lib/ruby-measurement/definitions/metric/weight.rb on lines 87..96
lib/ruby-measurement/definitions/metric/weight.rb on lines 99..108

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

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(:'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(:dam) do |unit|
  unit.alias :dekameter, :dekameters
  unit.convert_to(:km) { |value| value / 100.0 }
  unit.convert_to(:hm) { |value| value / 10.0 }
  unit.convert_to(:m) { |value| value * 10.0 }
Severity: Major
Found in lib/ruby-measurement/definitions/metric/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 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
lib/ruby-measurement/definitions/us_customary/length.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

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

Measurement.define(:dm) do |unit|
  unit.alias :decimeter, :decimeters
  unit.convert_to(:km) { |value| value / 10_000.0 }
  unit.convert_to(:hm) { |value| value / 1_000.0 }
  unit.convert_to(:dam) { |value| value / 100.0 }
Severity: Major
Found in lib/ruby-measurement/definitions/metric/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 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
lib/ruby-measurement/definitions/us_customary/length.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

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

Measurement.define(:m) do |unit|
  unit.alias :meter, :meters
  unit.convert_to(:km) { |value| value / 1_000.0 }
  unit.convert_to(:hm) { |value| value / 100.0 }
  unit.convert_to(:dam) { |value| value / 10.0 }
Severity: Major
Found in lib/ruby-measurement/definitions/metric/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 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
lib/ruby-measurement/definitions/us_customary/length.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

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

Measurement.define(:dal) do |unit|
  unit.alias :dekaliter, :dekaliters
  unit.convert_to(:kl) { |value| value / 100.0 }
  unit.convert_to(:hl) { |value| value / 10.0 }
  unit.convert_to(:l) { |value| value * 10.0 }
Severity: Major
Found in lib/ruby-measurement/definitions/metric/volume.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 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
lib/ruby-measurement/definitions/us_customary/length.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

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

Measurement.define(:cl) do |unit|
  unit.alias :centiliter, :centiliters
  unit.convert_to(:kl) { |value| value / 10_0000.0 }
  unit.convert_to(:hl) { |value| value / 10_000.0 }
  unit.convert_to(:dal) { |value| value / 1_000.0 }
Severity: Major
Found in lib/ruby-measurement/definitions/metric/volume.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 69..77
lib/ruby-measurement/definitions/metric/volume.rb on lines 80..88
lib/ruby-measurement/definitions/us_customary/length.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

Severity
Category
Status
Source
Language