inasafe/inasafe

View on GitHub

Showing 1,474 of 1,497 total issues

File utilities.py has 506 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# coding=utf-8

"""Utilities for InaSAFE."""

import colorsys
Severity: Major
Found in safe/common/utilities.py - About 1 day to fix

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

    @qgsfunction(
        args='auto', group=label_group, usesGeometry=False, referencedColumns=[],
        help_text=help_message.to_html(), helpText=help_message.to_html())
    def name_of_the_nearest_place(feature, parent):
        """If the impact layer has a distance field, it will return the name
    Severity: Major
    Found in safe/report/expressions/map_report.py and 3 other locations - About 1 day to fix
    safe/report/expressions/map_report.py on lines 154..175
    safe/report/expressions/map_report.py on lines 187..208
    safe/report/expressions/map_report.py on lines 220..241

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

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

    @qgsfunction(
        args='auto', group=label_group, usesGeometry=False, referencedColumns=[],
        help_text=help_message.to_html(), helpText=help_message.to_html())
    def distance_to_nearest_place(feature, parent):
        """If the impact layer has a distance field, it will return the distance to
    Severity: Major
    Found in safe/report/expressions/map_report.py and 3 other locations - About 1 day to fix
    safe/report/expressions/map_report.py on lines 187..208
    safe/report/expressions/map_report.py on lines 220..241
    safe/report/expressions/map_report.py on lines 253..274

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

    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

        for exposure in exposure_all:
            extra_exposure_notes = specific_notes(definition, exposure)
            if extra_exposure_notes:
                title = tr('Notes for exposure : {exposure_name}').format(
                    exposure_name=exposure['name'])
    Severity: Major
    Found in safe/gui/tools/help/definitions_help.py and 1 other location - About 1 day to fix
    safe/gui/tools/help/definitions_help.py on lines 1143..1155

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

    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

        for exposure in exposure_all:
            extra_exposure_actions = specific_actions(definition, exposure)
            if extra_exposure_actions:
                title = tr('Actions for exposure : {exposure_name}').format(
                    exposure_name=exposure['name'])
    Severity: Major
    Found in safe/gui/tools/help/definitions_help.py and 1 other location - About 1 day to fix
    safe/gui/tools/help/definitions_help.py on lines 1077..1089

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

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

    @qgsfunction(
        args='auto', group=label_group, usesGeometry=False, referencedColumns=[],
        help_text=help_message.to_html(), helpText=help_message.to_html())
    def bearing_to_nearest_place(feature, parent):
        """If the impact layer has a distance field, it will return the bearing
    Severity: Major
    Found in safe/report/expressions/map_report.py and 3 other locations - About 1 day to fix
    safe/report/expressions/map_report.py on lines 154..175
    safe/report/expressions/map_report.py on lines 187..208
    safe/report/expressions/map_report.py on lines 253..274

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

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

    @qgsfunction(
        args='auto', group=label_group, usesGeometry=False, referencedColumns=[],
        help_text=help_message.to_html(), helpText=help_message.to_html())
    def direction_to_nearest_place(feature, parent):
        """If the impact layer has a distance field, it will return the direction
    Severity: Major
    Found in safe/report/expressions/map_report.py and 3 other locations - About 1 day to fix
    safe/report/expressions/map_report.py on lines 154..175
    safe/report/expressions/map_report.py on lines 220..241
    safe/report/expressions/map_report.py on lines 253..274

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

    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

    Plugin has 56 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Plugin():
    
        """The QGIS interface implementation for the InaSAFE plugin.
    
        This class acts as the 'glue' between QGIS and our custom logic.
    Severity: Major
    Found in safe/plugin.py - About 1 day to fix

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

                  for the_class in classes:
                      threshold = classifications[active_classification['key']][
                          'classes'][the_class['key']]
                      row = m.Row()
                      row.add(m.Cell(the_class['name']))
      Severity: Major
      Found in safe/utilities/keyword_io.py and 1 other location - About 1 day to fix
      safe/gui/tools/wizard/step_kw33_multi_classifications.py on lines 427..434

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

          if zero_displaced:
              context['sections']['gender'].append(
                  {
                      'header': gender_section_header,
                      'empty': True,
      Severity: Major
      Found in safe/report/extractors/aggregate_postprocessors.py and 2 other locations - About 1 day to fix
      safe/report/extractors/aggregate_postprocessors.py on lines 126..150
      safe/report/extractors/aggregate_postprocessors.py on lines 226..251

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

              if zero_displaced:
                  context['sections']['vulnerability'].append(
                      {
                          'header': vulnerability_section_header,
                          'empty': True,
      Severity: Major
      Found in safe/report/extractors/aggregate_postprocessors.py and 2 other locations - About 1 day to fix
      safe/report/extractors/aggregate_postprocessors.py on lines 126..150
      safe/report/extractors/aggregate_postprocessors.py on lines 176..200

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

      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

                      for the_class in classes:
                          threshold = thresholds[classification['key']]['classes'][
                              the_class['key']]
                          row = m.Row()
                          row.add(m.Cell(the_class['name']))
      Severity: Major
      Found in safe/gui/tools/wizard/step_kw33_multi_classifications.py and 1 other location - About 1 day to fix
      safe/utilities/keyword_io.py on lines 426..433

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

          if zero_displaced:
              context['sections']['age'].append(
                  {
                      'header': age_section_header,
                      'empty': True,
      Severity: Major
      Found in safe/report/extractors/aggregate_postprocessors.py and 2 other locations - About 1 day to fix
      safe/report/extractors/aggregate_postprocessors.py on lines 176..200
      safe/report/extractors/aggregate_postprocessors.py on lines 226..251

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

          def list_compatible_canvas_layers(self):
              """Fill the list widget with compatible layers.
      
              :returns: Metadata of found layers.
              :rtype: list of dicts
      Severity: Major
      Found in safe/gui/tools/wizard/step_fc35_explayer_from_canvas.py and 1 other location - About 7 hrs to fix
      safe/gui/tools/wizard/step_fc20_hazlayer_from_canvas.py on lines 92..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 119.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

          def list_compatible_canvas_layers(self):
              """Fill the list widget with compatible layers.
      
              :returns: Metadata of found layers.
              :rtype: list of dicts
      Severity: Major
      Found in safe/gui/tools/wizard/step_fc20_hazlayer_from_canvas.py and 1 other location - About 7 hrs to fix
      safe/gui/tools/wizard/step_fc35_explayer_from_canvas.py on lines 92..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 119.

      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

              {
                  'key': 'category_4',
                  'value': 4,
                  'color': dark_red,
                  'name': tr('Category 4 (major hurricane)'),
      Severity: Major
      Found in safe/definitions/hazard_classifications.py and 7 other locations - About 7 hrs to fix
      safe/definitions/hazard_classifications.py on lines 1469..1502
      safe/definitions/hazard_classifications.py on lines 1507..1539
      safe/definitions/hazard_classifications.py on lines 1544..1577
      safe/definitions/hazard_classifications.py on lines 1582..1614
      safe/definitions/hazard_classifications.py on lines 1762..1795
      safe/definitions/hazard_classifications.py on lines 1800..1833
      safe/definitions/hazard_classifications.py on lines 1838..1871

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

      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

              {
                  'key': 'category_4',
                  'value': 4,
                  'color': dark_red,
                  'name': tr('Category 4 (severe tropical cyclone)'),
      Severity: Major
      Found in safe/definitions/hazard_classifications.py and 7 other locations - About 7 hrs to fix
      safe/definitions/hazard_classifications.py on lines 1507..1539
      safe/definitions/hazard_classifications.py on lines 1544..1577
      safe/definitions/hazard_classifications.py on lines 1582..1614
      safe/definitions/hazard_classifications.py on lines 1722..1757
      safe/definitions/hazard_classifications.py on lines 1762..1795
      safe/definitions/hazard_classifications.py on lines 1800..1833
      safe/definitions/hazard_classifications.py on lines 1838..1871

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

      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

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

                  for field in self.parent.layer.fields():
                      # Check the field type
                      if isinstance(inasafe_field['type'], list):
                          if field.type() in inasafe_field['type']:
                              field_name = field.name()
      Severity: Major
      Found in safe/gui/tools/wizard/step_kw47_default_inasafe_fields.py and 1 other location - About 7 hrs to fix
      safe/gui/tools/wizard/step_kw45_inasafe_fields.py on lines 134..143

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

      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

              {
                  'key': 'category_3',
                  'value': 3,
                  'color': red,
                  'name': tr('Category 3 (major hurricane)'),
      Severity: Major
      Found in safe/definitions/hazard_classifications.py and 7 other locations - About 7 hrs to fix
      safe/definitions/hazard_classifications.py on lines 1469..1502
      safe/definitions/hazard_classifications.py on lines 1507..1539
      safe/definitions/hazard_classifications.py on lines 1544..1577
      safe/definitions/hazard_classifications.py on lines 1582..1614
      safe/definitions/hazard_classifications.py on lines 1722..1757
      safe/definitions/hazard_classifications.py on lines 1800..1833
      safe/definitions/hazard_classifications.py on lines 1838..1871

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

      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

              {
                  'key': 'category_3',
                  'value': 3,
                  'color': red,
                  'name': tr('Category 3 (severe tropical cyclone)'),
      Severity: Major
      Found in safe/definitions/hazard_classifications.py and 7 other locations - About 7 hrs to fix
      safe/definitions/hazard_classifications.py on lines 1469..1502
      safe/definitions/hazard_classifications.py on lines 1544..1577
      safe/definitions/hazard_classifications.py on lines 1582..1614
      safe/definitions/hazard_classifications.py on lines 1722..1757
      safe/definitions/hazard_classifications.py on lines 1762..1795
      safe/definitions/hazard_classifications.py on lines 1800..1833
      safe/definitions/hazard_classifications.py on lines 1838..1871

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

      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