inasafe/inasafe

View on GitHub
safe/impact_function/impact_function.py

Summary

Maintainability
F
3 wks
Test Coverage

File impact_function.py has 2411 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# coding=utf-8

"""Impact Function."""


Severity: Major
Found in safe/impact_function/impact_function.py - About 6 days to fix

    ImpactFunction has 67 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ImpactFunction():
    
        """Impact Function."""
    
        def __init__(self):
    Severity: Major
    Found in safe/impact_function/impact_function.py - About 1 day to fix

      Function _run has 69 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def _run(self):
              """Internal function to run the impact function with profiling."""
              LOGGER.info('ANALYSIS : The impact function is starting.')
              step_count = len(analysis_steps)
              self.callback(0, step_count, analysis_steps['initialisation'])
      Severity: Major
      Found in safe/impact_function/impact_function.py - About 2 hrs to fix

        Function __init__ has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def __init__(self):
                """Constructor."""
                # Input layers
                self._hazard = None
                self._exposure = None
        Severity: Minor
        Found in safe/impact_function/impact_function.py - About 1 hr to fix

          Function load_from_output_metadata has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def load_from_output_metadata(output_metadata):
                  """Set Impact Function based on an output of an analysis's metadata.
          
                  If possible, we will try to use layers already in the legend and to not
                  recreating new ones. We will keep the style for instance.
          Severity: Minor
          Found in safe/impact_function/impact_function.py - About 1 hr to fix

            Function generate_report has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def generate_report(
            Severity: Major
            Found in safe/impact_function/impact_function.py - About 50 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if ratio_is_a_field and not ratio_is_a_constant:
                                          # The ratio is a field, we do nothing here.
                                          # The ratio will be propagated to the
                                          # aggregate_hazard layer.
                                          # Let's skip to the next field.
              Severity: Major
              Found in safe/impact_function/impact_function.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if not ratio_is_a_constant and not ratio_is_a_field:
                                            if is_vector_layer(self.exposure):
                                                LOGGER.info(
                                                    '{ratio_field} is neither a constant nor '
                                                    'a field in the aggregation layer AND the '
                Severity: Major
                Found in safe/impact_function/impact_function.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if ratio_field in aggregation_fields:
                                              # The count field is in the exposure and the ratio
                                              # is in the aggregation. We need to remove it from
                                              # the aggregation. We remove the keyword too.
                                              remove_fields(
                  Severity: Major
                  Found in safe/impact_function/impact_function.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            for feature in iterator:
                                                layer.addFeature(feature)
                                            layer.commitChanges()
                    Severity: Major
                    Found in safe/impact_function/impact_function.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if ratio_is_a_constant and not ratio_is_a_field:
                                                  # It's a constant. We need to add to the exposure.
                                                  value = aggregation_default_fields[ratio_field]
                                                  exposure_defaults[ratio_field] = value
                                                  if is_vector_layer(self.exposure):
                      Severity: Major
                      Found in safe/impact_function/impact_function.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if count_key not in keywords['inasafe_fields']:
                                                    # The exposure hasn't a count field, we should add
                                                    # it.
                                                    default_value = get_inasafe_default_value_qsetting(
                                                        QSettings(), GLOBAL, ratio_field)
                        Severity: Major
                        Found in safe/impact_function/impact_function.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if ratio_is_a_constant and ratio_is_a_field:
                                                      # This should of course never happen! It would
                                                      # be an error from the wizard. See #3809.
                                                      # Let's raise an exception.
                                                      raise Exception
                          Severity: Major
                          Found in safe/impact_function/impact_function.py - About 45 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                        return PREPARE_SUCCESS, None
                            Severity: Major
                            Found in safe/impact_function/impact_function.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                              return False, message
                              Severity: Major
                              Found in safe/impact_function/impact_function.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                                    return PREPARE_FAILED_BAD_INPUT, message
                                Severity: Major
                                Found in safe/impact_function/impact_function.py - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                                  return PREPARE_FAILED_BAD_INPUT, message
                                  Severity: Major
                                  Found in safe/impact_function/impact_function.py - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                                        return False, message
                                    Severity: Major
                                    Found in safe/impact_function/impact_function.py - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                              return True, ''
                                      Severity: Major
                                      Found in safe/impact_function/impact_function.py - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                                            return PREPARE_FAILED_BAD_INPUT, message
                                        Severity: Major
                                        Found in safe/impact_function/impact_function.py - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                                              return PREPARE_FAILED_BAD_INPUT, message
                                          Severity: Major
                                          Found in safe/impact_function/impact_function.py - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

                                                                    return False, message
                                            Severity: Major
                                            Found in safe/impact_function/impact_function.py - About 30 mins to fix

                                              Avoid too many return statements within this function.
                                              Open

                                                                      return False, message
                                              Severity: Major
                                              Found in safe/impact_function/impact_function.py - About 30 mins to fix

                                                Avoid too many return statements within this function.
                                                Open

                                                                    return PREPARE_FAILED_BAD_INPUT, message
                                                Severity: Major
                                                Found in safe/impact_function/impact_function.py - About 30 mins to fix

                                                  Avoid too many return statements within this function.
                                                  Open

                                                              return ANALYSIS_FAILED_BAD_CODE, message
                                                  Severity: Major
                                                  Found in safe/impact_function/impact_function.py - About 30 mins to fix

                                                    Avoid too many return statements within this function.
                                                    Open

                                                                return ANALYSIS_FAILED_BAD_INPUT, message
                                                    Severity: Major
                                                    Found in safe/impact_function/impact_function.py - About 30 mins to fix

                                                      Avoid too many return statements within this function.
                                                      Open

                                                                      return ANALYSIS_FAILED_BAD_CODE, message
                                                      Severity: Major
                                                      Found in safe/impact_function/impact_function.py - About 30 mins to fix

                                                        Avoid too many return statements within this function.
                                                        Open

                                                                                return False, message
                                                        Severity: Major
                                                        Found in safe/impact_function/impact_function.py - About 30 mins to fix

                                                          Avoid too many return statements within this function.
                                                          Open

                                                                          return status, message
                                                          Severity: Major
                                                          Found in safe/impact_function/impact_function.py - About 30 mins to fix

                                                            Avoid too many return statements within this function.
                                                            Open

                                                                        return ANALYSIS_SUCCESS, None
                                                            Severity: Major
                                                            Found in safe/impact_function/impact_function.py - About 30 mins to fix

                                                              Avoid too many return statements within this function.
                                                              Open

                                                                              return False, message
                                                              Severity: Major
                                                              Found in safe/impact_function/impact_function.py - About 30 mins to fix

                                                                Avoid too many return statements within this function.
                                                                Open

                                                                                    return PREPARE_FAILED_BAD_INPUT, message
                                                                Severity: Major
                                                                Found in safe/impact_function/impact_function.py - About 30 mins to fix

                                                                  Avoid too many return statements within this function.
                                                                  Open

                                                                                      return status, message
                                                                  Severity: Major
                                                                  Found in safe/impact_function/impact_function.py - About 30 mins to fix

                                                                    Avoid too many return statements within this function.
                                                                    Open

                                                                                    return PREPARE_FAILED_BAD_CODE, message
                                                                    Severity: Major
                                                                    Found in safe/impact_function/impact_function.py - About 30 mins to fix

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

                                                                              if self.aggregate_hazard_impacted:
                                                                                  self.aggregate_hazard_impacted.keywords[
                                                                                      'provenance_data'] = self.provenance
                                                                                  append_ISO19115_keywords(
                                                                                      self.aggregate_hazard_impacted.keywords)
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 1 other location - About 1 day to fix
                                                                      safe/impact_function/impact_function.py on lines 1735..1753

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

                                                                      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

                                                                              if self._exposure_summary:
                                                                                  self._exposure_summary.keywords[
                                                                                      'provenance_data'] = self.provenance
                                                                                  append_ISO19115_keywords(
                                                                                      self._exposure_summary.keywords)
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 1 other location - About 1 day to fix
                                                                      safe/impact_function/impact_function.py on lines 1756..1777

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

                                                                      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

                                                                                          if isinstance(property_a, QgsVectorLayer):
                                                                                              fields_a = [f.name() for f in property_a.fields()]
                                                                                              fields_b = [f.name() for f in property_b.fields()]
                                                                                              if fields_a != fields_b:
                                                                                                  message = (
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 1 other location - About 7 hrs to fix
                                                                      safe/impact_function/multi_exposure_wrapper.py on lines 617..630

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

                                                                      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

                                                                              except ProcessingInstallationError:
                                                                                  warning_heading = m.Heading(
                                                                                      tr('Configuration issue'), **WARNING_STYLE)
                                                                                  warning_message = tr(
                                                                                      'There is a problem with the Processing plugin.')
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 2 other locations - About 6 hrs to fix
                                                                      safe/impact_function/impact_function.py on lines 1488..1506
                                                                      safe/impact_function/impact_function.py on lines 1549..1566

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

                                                                      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

                                                                              except MemoryError:
                                                                                  warning_heading = m.Heading(tr('Memory issue'), **WARNING_STYLE)
                                                                                  warning_message = tr(
                                                                                      'There is not enough free memory to run this analysis.')
                                                                                  suggestion_heading = m.Heading(
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 2 other locations - About 6 hrs to fix
                                                                      safe/impact_function/impact_function.py on lines 1488..1506
                                                                      safe/impact_function/impact_function.py on lines 1520..1543

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

                                                                      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

                                                                              except NoFeaturesInExtentError:
                                                                                  warning_heading = m.Heading(
                                                                                      tr('No features in the extent'), **WARNING_STYLE)
                                                                                  warning_message = tr(
                                                                                      'There are no features in the analysis extent.')
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 2 other locations - About 6 hrs to fix
                                                                      safe/impact_function/impact_function.py on lines 1520..1543
                                                                      safe/impact_function/impact_function.py on lines 1549..1566

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

                                                                      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

                                                                                  try:
                                                                                      property_a = getattr(self, if_property)
                                                                                      property_b = getattr(other, if_property)
                                                                                      if not isinstance(property_a, type(property_b)):
                                                                                          message = (
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 1 other location - About 5 hrs to fix
                                                                      safe/impact_function/multi_exposure_wrapper.py on lines 654..728

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

                                                                      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

                                                                                  if default_user_directory:
                                                                                      path = join(default_user_directory, self._unique_name)
                                                                                      if not exists(path):
                                                                                          makedirs(path)
                                                                                      self._datastore = Folder(path)
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 1 other location - About 3 hrs to fix
                                                                      safe/impact_function/multi_exposure_wrapper.py on lines 943..949

                                                                      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

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

                                                                          @property
                                                                          def duration(self):
                                                                              """The duration of running the impact function in seconds.
                                                                      
                                                                              Return 0 if the start or end datetime is None.
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 1 other location - About 2 hrs to fix
                                                                      safe/impact_function/multi_exposure_wrapper.py on lines 251..262

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

                                                                      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

                                                                              if self.hazard.crs().authid() != analysis_crs.authid():
                                                                                  crs_transform = QgsCoordinateTransform(
                                                                                      self.hazard.crs(), analysis_crs, QgsProject.instance())
                                                                                  hazard_extent.transform(crs_transform)
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 1 other location - About 2 hrs to fix
                                                                      safe/impact_function/impact_function.py on lines 1286..1289

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

                                                                      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

                                                                              if self.exposure.crs().authid() != analysis_crs.authid():
                                                                                  crs_transform = QgsCoordinateTransform(
                                                                                      self.exposure.crs(), analysis_crs, QgsProject.instance())
                                                                                  exposure_extent.transform(crs_transform)
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 1 other location - About 2 hrs to fix
                                                                      safe/impact_function/impact_function.py on lines 1281..1284

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

                                                                      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

                                                                                      elif isinstance(property_a, QgsGeometry):
                                                                                          if not property_a.equals(property_b):
                                                                                              string_a = property_a.asWkt()
                                                                                              string_b = property_b.asWkt()
                                                                                              message = (
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 1 other location - About 2 hrs to fix
                                                                      safe/impact_function/multi_exposure_wrapper.py on lines 667..674

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

                                                                      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

                                                                          @crs.setter
                                                                          def crs(self, crs):
                                                                              """Setter for extent_crs property.
                                                                      
                                                                              :param crs: The coordinate reference system for the analysis boundary.
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 2 other locations - About 2 hrs to fix
                                                                      safe/impact_function/impact_function.py on lines 747..760
                                                                      safe/impact_function/multi_exposure_wrapper.py on lines 276..287

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

                                                                      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

                                                                          @requested_extent.setter
                                                                          def requested_extent(self, extent):
                                                                              """Setter for extent property.
                                                                      
                                                                              :param extent: Analysis boundaries expressed as a QgsRectangle.
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 2 other locations - About 2 hrs to fix
                                                                      safe/impact_function/impact_function.py on lines 774..785
                                                                      safe/impact_function/multi_exposure_wrapper.py on lines 276..287

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

                                                                      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

                                                                                      elif isinstance(property_a, DataStore):
                                                                                          if property_a.uri_path != property_b.uri_path:
                                                                                              string_a = property_a.uri_path
                                                                                              string_b = property_b.uri_path
                                                                                              message = (
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 1 other location - About 1 hr to fix
                                                                      safe/impact_function/multi_exposure_wrapper.py on lines 675..682

                                                                      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

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

                                                                                      if not isinstance(property_a, type(property_b)):
                                                                                          message = (
                                                                                              'Different type of property %s.\nA: %s\nB: %s' % (
                                                                                                  if_property, type(property_a), type(property_b)))
                                                                                          return False, message
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 1 other location - About 1 hr to fix
                                                                      safe/impact_function/multi_exposure_wrapper.py on lines 657..661

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

                                                                      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

                                                                              if self.hazard.keywords.get('layer_mode') == 'continuous':
                                                                                  # If the layer is continuous, we update the original data to the
                                                                                  # inasafe hazard class.
                                                                                  self.set_state_process(
                                                                                      'hazard',
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 1 other location - About 1 hr to fix
                                                                      safe/impact_function/impact_function.py on lines 2153..2159

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

                                                                      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

                                                                                  if self.hazard.keywords.get('layer_mode') == 'continuous':
                                                                                      self.set_state_process(
                                                                                          'hazard', 'Classify continuous raster hazard')
                                                                                      # noinspection PyTypeChecker
                                                                                      self.hazard = reclassify_raster(
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 1 other location - About 1 hr to fix
                                                                      safe/impact_function/impact_function.py on lines 2196..2204

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

                                                                      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

                                                                          @datastore.setter
                                                                          def datastore(self, datastore):
                                                                              """Setter for the datastore.
                                                                      
                                                                              :param datastore: The datastore.
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 1 other location - About 1 hr to fix
                                                                      safe/impact_function/multi_exposure_wrapper.py on lines 338..348

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

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

                                                                              if self.exposure.keywords['layer_mode'] == 'classified':
                                                                                  if 'classified_notes' in exposure:
                                                                                      notes += exposure['classified_notes']
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 5 other locations - About 1 hr to fix
                                                                      safe/impact_function/impact_function.py on lines 2636..2638
                                                                      safe/impact_function/impact_function.py on lines 2661..2663
                                                                      safe/impact_function/impact_function.py on lines 2664..2666
                                                                      safe/impact_function/impact_function.py on lines 2667..2669
                                                                      safe/impact_function/impact_function.py on lines 2670..2672

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

                                                                              if self.hazard.keywords['hazard_category'] == 'single_event':
                                                                                  if 'single_event_notes' in hazard:
                                                                                      notes += hazard['single_event_notes']
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 5 other locations - About 1 hr to fix
                                                                      safe/impact_function/impact_function.py on lines 2633..2635
                                                                      safe/impact_function/impact_function.py on lines 2636..2638
                                                                      safe/impact_function/impact_function.py on lines 2661..2663
                                                                      safe/impact_function/impact_function.py on lines 2664..2666
                                                                      safe/impact_function/impact_function.py on lines 2670..2672

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

                                                                              if self.hazard.keywords['hazard_category'] == 'multiple_event':
                                                                                  if 'multi_event_notes' in hazard:
                                                                                      notes += hazard['multi_event_notes']
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 5 other locations - About 1 hr to fix
                                                                      safe/impact_function/impact_function.py on lines 2633..2635
                                                                      safe/impact_function/impact_function.py on lines 2636..2638
                                                                      safe/impact_function/impact_function.py on lines 2661..2663
                                                                      safe/impact_function/impact_function.py on lines 2664..2666
                                                                      safe/impact_function/impact_function.py on lines 2667..2669

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

                                                                              if self.hazard.keywords['layer_mode'] == 'classified':
                                                                                  if 'classified_notes' in hazard:
                                                                                      notes += hazard['classified_notes']
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 5 other locations - About 1 hr to fix
                                                                      safe/impact_function/impact_function.py on lines 2633..2635
                                                                      safe/impact_function/impact_function.py on lines 2636..2638
                                                                      safe/impact_function/impact_function.py on lines 2664..2666
                                                                      safe/impact_function/impact_function.py on lines 2667..2669
                                                                      safe/impact_function/impact_function.py on lines 2670..2672

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

                                                                              if self.hazard.keywords['layer_mode'] == 'continuous':
                                                                                  if 'continuous_notes' in hazard:
                                                                                      notes += hazard['continuous_notes']
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 5 other locations - About 1 hr to fix
                                                                      safe/impact_function/impact_function.py on lines 2633..2635
                                                                      safe/impact_function/impact_function.py on lines 2636..2638
                                                                      safe/impact_function/impact_function.py on lines 2661..2663
                                                                      safe/impact_function/impact_function.py on lines 2667..2669
                                                                      safe/impact_function/impact_function.py on lines 2670..2672

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

                                                                              if self.exposure.keywords['layer_mode'] == 'continuous':
                                                                                  if 'continuous_notes' in exposure:
                                                                                      notes += exposure['continuous_notes']
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 5 other locations - About 1 hr to fix
                                                                      safe/impact_function/impact_function.py on lines 2633..2635
                                                                      safe/impact_function/impact_function.py on lines 2661..2663
                                                                      safe/impact_function/impact_function.py on lines 2664..2666
                                                                      safe/impact_function/impact_function.py on lines 2667..2669
                                                                      safe/impact_function/impact_function.py on lines 2670..2672

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

                                                                              if self._exposure.keywords.get('classification'):
                                                                                  self.set_state_process(
                                                                                      'impact function', 'Build the exposure summary table')
                                                                                  self._exposure_summary_table = exposure_summary_table(
                                                                                      self._aggregate_hazard_impacted, self._exposure_summary)
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 2 other locations - About 1 hr to fix
                                                                      safe/impact_function/impact_function.py on lines 2167..2173
                                                                      safe/impact_function/impact_function.py on lines 2455..2462

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

                                                                      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 not use_same_projection:
                                                                                  self.set_state_process(
                                                                                      'hazard',
                                                                                      'Reproject hazard layer to aggregation CRS')
                                                                                  # noinspection PyTypeChecker
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 2 other locations - About 1 hr to fix
                                                                      safe/impact_function/impact_function.py on lines 2455..2462
                                                                      safe/impact_function/impact_function.py on lines 2477..2483

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

                                                                      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 is_vector_layer(self._exposure_summary):
                                                                                  # With continuous exposure, we don't have an exposure summary layer
                                                                                  self.set_state_process(
                                                                                      'impact function',
                                                                                      'Aggregate the impact summary')
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 2 other locations - About 1 hr to fix
                                                                      safe/impact_function/impact_function.py on lines 2167..2173
                                                                      safe/impact_function/impact_function.py on lines 2477..2483

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

                                                                      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 self._aggregate_hazard_impacted:
                                                                                  self._aggregate_hazard_impacted.keywords[
                                                                                      'provenance_data'] = self.provenance
                                                                                  write_iso19115_metadata(
                                                                                      self._aggregate_hazard_impacted.source(),
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 2 other locations - About 1 hr to fix
                                                                      safe/impact_function/impact_function.py on lines 1848..1853
                                                                      safe/impact_function/impact_function.py on lines 1860..1865

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

                                                                      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 self._exposure_summary_table:
                                                                                  self._exposure_summary_table.keywords[
                                                                                      'provenance_data'] = self.provenance
                                                                                  write_iso19115_metadata(
                                                                                      self._exposure_summary_table.source(),
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 2 other locations - About 1 hr to fix
                                                                      safe/impact_function/impact_function.py on lines 1848..1853
                                                                      safe/impact_function/impact_function.py on lines 1854..1859

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

                                                                      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 self._exposure_summary:
                                                                                  self._exposure_summary.keywords[
                                                                                      'provenance_data'] = self.provenance
                                                                                  write_iso19115_metadata(
                                                                                      self._exposure_summary.source(),
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 2 other locations - About 1 hr to fix
                                                                      safe/impact_function/impact_function.py on lines 1854..1859
                                                                      safe/impact_function/impact_function.py on lines 1860..1865

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

                                                                      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

                                                                                  if not self.exposure:
                                                                                      message = generate_input_error_message(
                                                                                          tr('The exposure layer is compulsory'),
                                                                                          m.Paragraph(tr(
                                                                                              'The impact function needs an exposure layer to run. '
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 4 other locations - About 1 hr to fix
                                                                      safe/impact_function/impact_function.py on lines 1022..1029
                                                                      safe/impact_function/impact_function.py on lines 1074..1082
                                                                      safe/impact_function/impact_function.py on lines 1438..1444
                                                                      safe/impact_function/multi_exposure_wrapper.py on lines 773..797

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

                                                                      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

                                                                              if not self._is_ready:
                                                                                  message = generate_input_error_message(
                                                                                      tr('You need to run `prepare` first.'),
                                                                                      m.Paragraph(tr(
                                                                                          'In order to run the analysis, you need to call '
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 4 other locations - About 1 hr to fix
                                                                      safe/impact_function/impact_function.py on lines 1009..1016
                                                                      safe/impact_function/impact_function.py on lines 1022..1029
                                                                      safe/impact_function/impact_function.py on lines 1074..1082
                                                                      safe/impact_function/multi_exposure_wrapper.py on lines 773..797

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

                                                                      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

                                                                                  if not self.hazard:
                                                                                      message = generate_input_error_message(
                                                                                          tr('The hazard layer is compulsory'),
                                                                                          m.Paragraph(tr(
                                                                                              'The impact function needs a hazard layer to run. '
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 4 other locations - About 1 hr to fix
                                                                      safe/impact_function/impact_function.py on lines 1009..1016
                                                                      safe/impact_function/impact_function.py on lines 1074..1082
                                                                      safe/impact_function/impact_function.py on lines 1438..1444
                                                                      safe/impact_function/multi_exposure_wrapper.py on lines 773..797

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

                                                                      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

                                                                                      if not self._crs:
                                                                                          message = generate_input_error_message(
                                                                                              tr('Error with the requested CRS'),
                                                                                              m.Paragraph(tr(
                                                                                                  'CRS must be set when you don\'t use an '
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 4 other locations - About 1 hr to fix
                                                                      safe/impact_function/impact_function.py on lines 1009..1016
                                                                      safe/impact_function/impact_function.py on lines 1022..1029
                                                                      safe/impact_function/impact_function.py on lines 1438..1444
                                                                      safe/impact_function/multi_exposure_wrapper.py on lines 773..797

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

                                                                      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

                                                                                          if byteify(property_a.keywords) != byteify(
                                                                                                  property_b.keywords):
                                                                                              message = (
                                                                                                  'Keyword Layer is not equal is %s' % if_property)
                                                                                              return False, message
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 1 other location - About 1 hr to fix
                                                                      safe/impact_function/multi_exposure_wrapper.py on lines 612..616

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

                                                                      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

                                                                              if exposure not in indivisible_keys and geometry != \
                                                                                      QgsWkbTypes.PointGeometry:
                                                                                  # We can now split features because the `prepare_vector_layer`
                                                                                  # might have added the size field.
                                                                                  self.set_state_process(
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 1 other location - About 1 hr to fix
                                                                      safe/impact_function/impact_function.py on lines 2279..2286

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

                                                                      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

                                                                              if not use_same_projection:
                                                                                  self.set_state_process(
                                                                                      'exposure',
                                                                                      'Reproject exposure layer to aggregation CRS')
                                                                                  # noinspection PyTypeChecker
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 1 other location - About 1 hr to fix
                                                                      safe/impact_function/impact_function.py on lines 2295..2303

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

                                                                      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

                                                                                      if self._requested_extent:
                                                                                          message = generate_input_error_message(
                                                                                              tr('Error with the requested extent'),
                                                                                              m.Paragraph(tr(
                                                                                                  'Requested Extent must be null when an '
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 3 other locations - About 50 mins to fix
                                                                      safe/impact_function/impact_function.py on lines 1045..1052
                                                                      safe/impact_function/impact_function.py on lines 1054..1061
                                                                      safe/impact_function/multi_exposure_wrapper.py on lines 779..787

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

                                                                      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

                                                                                      if self.use_exposure_view_only:
                                                                                          message = generate_input_error_message(
                                                                                              tr('Error with the requested extent'),
                                                                                              m.Paragraph(tr(
                                                                                                  'Use exposure view only can not be set to True if '
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 3 other locations - About 50 mins to fix
                                                                      safe/impact_function/impact_function.py on lines 1036..1043
                                                                      safe/impact_function/impact_function.py on lines 1045..1052
                                                                      safe/impact_function/multi_exposure_wrapper.py on lines 779..787

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

                                                                      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

                                                                                      if self._crs:
                                                                                          message = generate_input_error_message(
                                                                                              tr('Error with the requested extent'),
                                                                                              m.Paragraph(tr(
                                                                                                  'Requested Extent CRS must be null when an '
                                                                      Severity: Major
                                                                      Found in safe/impact_function/impact_function.py and 3 other locations - About 50 mins to fix
                                                                      safe/impact_function/impact_function.py on lines 1036..1043
                                                                      safe/impact_function/impact_function.py on lines 1054..1061
                                                                      safe/impact_function/multi_exposure_wrapper.py on lines 779..787

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

                                                                      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