inasafe/inasafe

View on GitHub
safe/definitions/units.py

Summary

Maintainability
F
5 days
Test Coverage

File units.py has 477 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# coding=utf-8

"""Definitions relating to units."""

from collections import OrderedDict
Severity: Minor
Found in safe/definitions/units.py - About 7 hrs to fix

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

    unit_miles_per_hour = {
        'key': 'miles_per_hour',
        'name': tr('mph'),
        'plural_name': tr('mph'),
        'measure': tr('Speed'),
    Severity: Major
    Found in safe/definitions/units.py and 14 other locations - About 1 hr to fix
    safe/definitions/units.py on lines 14..26
    safe/definitions/units.py on lines 30..42
    safe/definitions/units.py on lines 46..59
    safe/definitions/units.py on lines 63..75
    safe/definitions/units.py on lines 95..107
    safe/definitions/units.py on lines 111..123
    safe/definitions/units.py on lines 127..139
    safe/definitions/units.py on lines 143..155
    safe/definitions/units.py on lines 189..200
    safe/definitions/units.py on lines 204..216
    safe/definitions/units.py on lines 220..232
    safe/definitions/units.py on lines 236..249
    safe/definitions/units.py on lines 253..265
    safe/definitions/units.py on lines 290..302

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

    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

    unit_feet = {
        'key': 'feet',
        'name': tr('Feet'),
        'plural_name': tr('feet'),
        'measure': tr('Length'),
    Severity: Major
    Found in safe/definitions/units.py and 14 other locations - About 1 hr to fix
    safe/definitions/units.py on lines 30..42
    safe/definitions/units.py on lines 46..59
    safe/definitions/units.py on lines 63..75
    safe/definitions/units.py on lines 79..91
    safe/definitions/units.py on lines 95..107
    safe/definitions/units.py on lines 111..123
    safe/definitions/units.py on lines 127..139
    safe/definitions/units.py on lines 143..155
    safe/definitions/units.py on lines 189..200
    safe/definitions/units.py on lines 204..216
    safe/definitions/units.py on lines 220..232
    safe/definitions/units.py on lines 236..249
    safe/definitions/units.py on lines 253..265
    safe/definitions/units.py on lines 290..302

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

    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

    unit_metres = {
        'key': 'metres',
        'name': tr('Metres'),
        'plural_name': tr('metres'),
        'measure': tr('Length'),
    Severity: Major
    Found in safe/definitions/units.py and 14 other locations - About 1 hr to fix
    safe/definitions/units.py on lines 14..26
    safe/definitions/units.py on lines 30..42
    safe/definitions/units.py on lines 46..59
    safe/definitions/units.py on lines 63..75
    safe/definitions/units.py on lines 79..91
    safe/definitions/units.py on lines 95..107
    safe/definitions/units.py on lines 111..123
    safe/definitions/units.py on lines 127..139
    safe/definitions/units.py on lines 189..200
    safe/definitions/units.py on lines 204..216
    safe/definitions/units.py on lines 220..232
    safe/definitions/units.py on lines 236..249
    safe/definitions/units.py on lines 253..265
    safe/definitions/units.py on lines 290..302

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

    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

    unit_square_metres = {
        'key': 'square_metres',
        'name': tr('Square Metres'),
        'plural_name': tr('square metres'),
        'measure': tr('Area'),
    Severity: Major
    Found in safe/definitions/units.py and 14 other locations - About 1 hr to fix
    safe/definitions/units.py on lines 14..26
    safe/definitions/units.py on lines 30..42
    safe/definitions/units.py on lines 46..59
    safe/definitions/units.py on lines 63..75
    safe/definitions/units.py on lines 79..91
    safe/definitions/units.py on lines 95..107
    safe/definitions/units.py on lines 111..123
    safe/definitions/units.py on lines 127..139
    safe/definitions/units.py on lines 143..155
    safe/definitions/units.py on lines 204..216
    safe/definitions/units.py on lines 220..232
    safe/definitions/units.py on lines 236..249
    safe/definitions/units.py on lines 253..265
    safe/definitions/units.py on lines 290..302

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

    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

    unit_millimetres = {
        'key': 'millimetres',
        'name': tr('Millimetres'),
        'plural_name': tr('millimetres'),
        'measure': tr('Length'),
    Severity: Major
    Found in safe/definitions/units.py and 14 other locations - About 1 hr to fix
    safe/definitions/units.py on lines 14..26
    safe/definitions/units.py on lines 30..42
    safe/definitions/units.py on lines 46..59
    safe/definitions/units.py on lines 63..75
    safe/definitions/units.py on lines 79..91
    safe/definitions/units.py on lines 95..107
    safe/definitions/units.py on lines 111..123
    safe/definitions/units.py on lines 127..139
    safe/definitions/units.py on lines 143..155
    safe/definitions/units.py on lines 189..200
    safe/definitions/units.py on lines 220..232
    safe/definitions/units.py on lines 236..249
    safe/definitions/units.py on lines 253..265
    safe/definitions/units.py on lines 290..302

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

    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

    unit_kilometres = {
        'key': 'kilometres',
        'name': tr('Kilometres'),
        'plural_name': tr('kilometres'),
        'measure': tr('Length'),
    Severity: Major
    Found in safe/definitions/units.py and 14 other locations - About 1 hr to fix
    safe/definitions/units.py on lines 14..26
    safe/definitions/units.py on lines 30..42
    safe/definitions/units.py on lines 46..59
    safe/definitions/units.py on lines 63..75
    safe/definitions/units.py on lines 79..91
    safe/definitions/units.py on lines 95..107
    safe/definitions/units.py on lines 111..123
    safe/definitions/units.py on lines 143..155
    safe/definitions/units.py on lines 189..200
    safe/definitions/units.py on lines 204..216
    safe/definitions/units.py on lines 220..232
    safe/definitions/units.py on lines 236..249
    safe/definitions/units.py on lines 253..265
    safe/definitions/units.py on lines 290..302

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

    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

    unit_percentage = {
        'key': 'percentage',
        'name': tr('Percentage'),
        'plural_name': tr('percentages'),
        'measure': tr('Percentage'),
    Severity: Major
    Found in safe/definitions/units.py and 14 other locations - About 1 hr to fix
    safe/definitions/units.py on lines 14..26
    safe/definitions/units.py on lines 30..42
    safe/definitions/units.py on lines 46..59
    safe/definitions/units.py on lines 63..75
    safe/definitions/units.py on lines 79..91
    safe/definitions/units.py on lines 95..107
    safe/definitions/units.py on lines 111..123
    safe/definitions/units.py on lines 127..139
    safe/definitions/units.py on lines 143..155
    safe/definitions/units.py on lines 189..200
    safe/definitions/units.py on lines 204..216
    safe/definitions/units.py on lines 220..232
    safe/definitions/units.py on lines 236..249
    safe/definitions/units.py on lines 290..302

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

    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

    unit_mmi = {
        'key': 'mmi',
        'name': tr('MMI'),
        'plural_name': tr('MMI'),
        'measure': tr('MMI'),
    Severity: Major
    Found in safe/definitions/units.py and 14 other locations - About 1 hr to fix
    safe/definitions/units.py on lines 14..26
    safe/definitions/units.py on lines 30..42
    safe/definitions/units.py on lines 46..59
    safe/definitions/units.py on lines 63..75
    safe/definitions/units.py on lines 79..91
    safe/definitions/units.py on lines 95..107
    safe/definitions/units.py on lines 111..123
    safe/definitions/units.py on lines 127..139
    safe/definitions/units.py on lines 143..155
    safe/definitions/units.py on lines 189..200
    safe/definitions/units.py on lines 204..216
    safe/definitions/units.py on lines 220..232
    safe/definitions/units.py on lines 253..265
    safe/definitions/units.py on lines 290..302

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

    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

    unit_generic = {
        'key': 'generic',
        'name': tr('Generic'),
        'plural_name': tr('generic'),
        'measure': tr('Count'),
    Severity: Major
    Found in safe/definitions/units.py and 14 other locations - About 1 hr to fix
    safe/definitions/units.py on lines 14..26
    safe/definitions/units.py on lines 46..59
    safe/definitions/units.py on lines 63..75
    safe/definitions/units.py on lines 79..91
    safe/definitions/units.py on lines 95..107
    safe/definitions/units.py on lines 111..123
    safe/definitions/units.py on lines 127..139
    safe/definitions/units.py on lines 143..155
    safe/definitions/units.py on lines 189..200
    safe/definitions/units.py on lines 204..216
    safe/definitions/units.py on lines 220..232
    safe/definitions/units.py on lines 236..249
    safe/definitions/units.py on lines 253..265
    safe/definitions/units.py on lines 290..302

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

    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

    unit_kilometres_per_hour = {
        'key': 'kilometres_per_hour',
        'name': tr('km/h'),
        'plural_name': tr('km/h'),
        'measure': tr('Speed'),
    Severity: Major
    Found in safe/definitions/units.py and 14 other locations - About 1 hr to fix
    safe/definitions/units.py on lines 14..26
    safe/definitions/units.py on lines 30..42
    safe/definitions/units.py on lines 46..59
    safe/definitions/units.py on lines 79..91
    safe/definitions/units.py on lines 95..107
    safe/definitions/units.py on lines 111..123
    safe/definitions/units.py on lines 127..139
    safe/definitions/units.py on lines 143..155
    safe/definitions/units.py on lines 189..200
    safe/definitions/units.py on lines 204..216
    safe/definitions/units.py on lines 220..232
    safe/definitions/units.py on lines 236..249
    safe/definitions/units.py on lines 253..265
    safe/definitions/units.py on lines 290..302

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

    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

    density_exposure_unit = {
        'key': 'density',
        'name': tr('Density'),
        'plural_name': tr('Density'),
        'measure': tr('Density'),
    Severity: Major
    Found in safe/definitions/units.py and 14 other locations - About 1 hr to fix
    safe/definitions/units.py on lines 14..26
    safe/definitions/units.py on lines 30..42
    safe/definitions/units.py on lines 46..59
    safe/definitions/units.py on lines 63..75
    safe/definitions/units.py on lines 79..91
    safe/definitions/units.py on lines 95..107
    safe/definitions/units.py on lines 111..123
    safe/definitions/units.py on lines 127..139
    safe/definitions/units.py on lines 143..155
    safe/definitions/units.py on lines 189..200
    safe/definitions/units.py on lines 204..216
    safe/definitions/units.py on lines 220..232
    safe/definitions/units.py on lines 236..249
    safe/definitions/units.py on lines 253..265

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

    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

    unit_kilogram_per_meter_square = {
        'key': 'kilogram_per_meter_square',
        'name': tr('kg/m2'),
        'plural_name': tr('kg/m2'),
        'measure': tr('Weight/area'),
    Severity: Major
    Found in safe/definitions/units.py and 14 other locations - About 1 hr to fix
    safe/definitions/units.py on lines 14..26
    safe/definitions/units.py on lines 30..42
    safe/definitions/units.py on lines 63..75
    safe/definitions/units.py on lines 79..91
    safe/definitions/units.py on lines 95..107
    safe/definitions/units.py on lines 111..123
    safe/definitions/units.py on lines 127..139
    safe/definitions/units.py on lines 143..155
    safe/definitions/units.py on lines 189..200
    safe/definitions/units.py on lines 204..216
    safe/definitions/units.py on lines 220..232
    safe/definitions/units.py on lines 236..249
    safe/definitions/units.py on lines 253..265
    safe/definitions/units.py on lines 290..302

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

    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

    unit_knots = {
        'key': 'knots',
        'name': tr('kn'),
        'plural_name': tr('kn'),
        'measure': tr('Speed'),
    Severity: Major
    Found in safe/definitions/units.py and 14 other locations - About 1 hr to fix
    safe/definitions/units.py on lines 14..26
    safe/definitions/units.py on lines 30..42
    safe/definitions/units.py on lines 46..59
    safe/definitions/units.py on lines 63..75
    safe/definitions/units.py on lines 79..91
    safe/definitions/units.py on lines 95..107
    safe/definitions/units.py on lines 127..139
    safe/definitions/units.py on lines 143..155
    safe/definitions/units.py on lines 189..200
    safe/definitions/units.py on lines 204..216
    safe/definitions/units.py on lines 220..232
    safe/definitions/units.py on lines 236..249
    safe/definitions/units.py on lines 253..265
    safe/definitions/units.py on lines 290..302

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

    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

    unit_centimetres = {
        'key': 'centimetres',
        'name': tr('Centimetres'),
        'plural_name': tr('centimetres'),
        'measure': tr('Length'),
    Severity: Major
    Found in safe/definitions/units.py and 14 other locations - About 1 hr to fix
    safe/definitions/units.py on lines 14..26
    safe/definitions/units.py on lines 30..42
    safe/definitions/units.py on lines 46..59
    safe/definitions/units.py on lines 63..75
    safe/definitions/units.py on lines 79..91
    safe/definitions/units.py on lines 95..107
    safe/definitions/units.py on lines 111..123
    safe/definitions/units.py on lines 127..139
    safe/definitions/units.py on lines 143..155
    safe/definitions/units.py on lines 189..200
    safe/definitions/units.py on lines 204..216
    safe/definitions/units.py on lines 236..249
    safe/definitions/units.py on lines 253..265
    safe/definitions/units.py on lines 290..302

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

    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

    unit_metres_per_second = {
        'key': 'metres_per_second',
        'name': tr('m/s'),
        'plural_name': tr('m/s'),
        'measure': tr('Speed'),
    Severity: Major
    Found in safe/definitions/units.py and 14 other locations - About 1 hr to fix
    safe/definitions/units.py on lines 14..26
    safe/definitions/units.py on lines 30..42
    safe/definitions/units.py on lines 46..59
    safe/definitions/units.py on lines 63..75
    safe/definitions/units.py on lines 79..91
    safe/definitions/units.py on lines 111..123
    safe/definitions/units.py on lines 127..139
    safe/definitions/units.py on lines 143..155
    safe/definitions/units.py on lines 189..200
    safe/definitions/units.py on lines 204..216
    safe/definitions/units.py on lines 220..232
    safe/definitions/units.py on lines 236..249
    safe/definitions/units.py on lines 253..265
    safe/definitions/units.py on lines 290..302

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

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

    unit_thousand = {
        'key': 'unit_thousand',
        'name': tr('Thousand'),
        'plural_name': tr('Thousands'),
        'abbreviation': tr('#'),
    Severity: Major
    Found in safe/definitions/units.py and 6 other locations - About 1 hr to fix
    safe/definitions/units.py on lines 327..339
    safe/definitions/units.py on lines 344..356
    safe/definitions/units.py on lines 361..373
    safe/definitions/units.py on lines 395..407
    safe/definitions/units.py on lines 411..423
    safe/definitions/units.py on lines 427..439

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

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

    unit_ones = {
        'key': 'unit_ones',
        'name': tr('One'),
        'plural_name': tr('Ones'),
        'abbreviation': tr('#'),
    Severity: Major
    Found in safe/definitions/units.py and 6 other locations - About 1 hr to fix
    safe/definitions/units.py on lines 344..356
    safe/definitions/units.py on lines 361..373
    safe/definitions/units.py on lines 379..391
    safe/definitions/units.py on lines 395..407
    safe/definitions/units.py on lines 411..423
    safe/definitions/units.py on lines 427..439

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

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

    unit_tens = {
        'key': 'unit_tens',
        'name': tr('Ten'),
        'plural_name': tr('Tens'),
        'abbreviation': tr('#'),
    Severity: Major
    Found in safe/definitions/units.py and 6 other locations - About 1 hr to fix
    safe/definitions/units.py on lines 327..339
    safe/definitions/units.py on lines 361..373
    safe/definitions/units.py on lines 379..391
    safe/definitions/units.py on lines 395..407
    safe/definitions/units.py on lines 411..423
    safe/definitions/units.py on lines 427..439

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

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

    unit_hundreds = {
        'key': 'unit_hundreds',
        'name': tr('Hundred'),
        'plural_name': tr('Hundreds'),
        'abbreviation': tr('#'),
    Severity: Major
    Found in safe/definitions/units.py and 6 other locations - About 1 hr to fix
    safe/definitions/units.py on lines 327..339
    safe/definitions/units.py on lines 344..356
    safe/definitions/units.py on lines 379..391
    safe/definitions/units.py on lines 395..407
    safe/definitions/units.py on lines 411..423
    safe/definitions/units.py on lines 427..439

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

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

    unit_trillion = {
        'key': 'unit_trillion',
        'name': tr('Trillion'),
        'plural_name': tr('Trillions'),
        'abbreviation': tr('#'),
    Severity: Major
    Found in safe/definitions/units.py and 6 other locations - About 1 hr to fix
    safe/definitions/units.py on lines 327..339
    safe/definitions/units.py on lines 344..356
    safe/definitions/units.py on lines 361..373
    safe/definitions/units.py on lines 379..391
    safe/definitions/units.py on lines 395..407
    safe/definitions/units.py on lines 411..423

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

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

    unit_million = {
        'key': 'unit_million',
        'name': tr('Million'),
        'plural_name': tr('Millions'),
        'abbreviation': tr('#'),
    Severity: Major
    Found in safe/definitions/units.py and 6 other locations - About 1 hr to fix
    safe/definitions/units.py on lines 327..339
    safe/definitions/units.py on lines 344..356
    safe/definitions/units.py on lines 361..373
    safe/definitions/units.py on lines 379..391
    safe/definitions/units.py on lines 411..423
    safe/definitions/units.py on lines 427..439

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

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

    unit_billion = {
        'key': 'unit_billion',
        'name': tr('Billion'),
        'plural_name': tr('Billions'),
        'abbreviation': tr('#'),
    Severity: Major
    Found in safe/definitions/units.py and 6 other locations - About 1 hr to fix
    safe/definitions/units.py on lines 327..339
    safe/definitions/units.py on lines 344..356
    safe/definitions/units.py on lines 361..373
    safe/definitions/units.py on lines 379..391
    safe/definitions/units.py on lines 395..407
    safe/definitions/units.py on lines 427..439

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

    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