inasafe/inasafe

View on GitHub
safe/gui/tools/wizard/step_kw33_multi_classifications.py

Summary

Maintainability
F
2 wks
Test Coverage

File step_kw33_multi_classifications.py has 970 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# coding=utf-8
"""InaSAFE Wizard Step Multi Classifications."""


import logging
Severity: Major
Found in safe/gui/tools/wizard/step_kw33_multi_classifications.py - About 2 days to fix

    StepKwMultiClassifications has 26 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class StepKwMultiClassifications(WizardStep, FORM_CLASS):
    
        """InaSAFE Wizard Step Multi Classifications."""
    
        def __init__(self, parent=None):
    Severity: Minor
    Found in safe/gui/tools/wizard/step_kw33_multi_classifications.py - About 3 hrs to fix

      Function setup_value_mapping_panels has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def setup_value_mapping_panels(self, classification):
              """Setup value mapping panel in the right panel.
      
              :param classification: Classification definition.
              :type classification: dict
      Severity: Minor
      Found in safe/gui/tools/wizard/step_kw33_multi_classifications.py - About 1 hr to fix

        Avoid deeply nested control flow statements.
        Open

                                if exposure['key'] in self.value_maps:
                                    self.value_maps.pop(exposure['key'])
                            continue
        Severity: Major
        Found in safe/gui/tools/wizard/step_kw33_multi_classifications.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if is_active:
                                      current_index = i + 1
                          i += 1
          Severity: Major
          Found in safe/gui/tools/wizard/step_kw33_multi_classifications.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if exposure['key'] in self.thresholds:
                                        self.thresholds.pop(exposure['key'])
                                else:
            Severity: Major
            Found in safe/gui/tools/wizard/step_kw33_multi_classifications.py - About 45 mins to fix

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

                          if thresholds.get(self.active_exposure['key']):
                              exposure_thresholds = thresholds.get(
                                  self.active_exposure['key'])
                              if exposure_thresholds.get(classification['key']):
                                  exposure_thresholds_classifications = exposure_thresholds\
              Severity: Major
              Found in safe/gui/tools/wizard/step_kw33_multi_classifications.py and 1 other location - About 1 day to fix
              safe/gui/tools/wizard/step_kw33_multi_classifications.py on lines 667..687

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

              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 thresholds.get(self.active_exposure['key']):
                              exposure_thresholds = thresholds.get(
                                  self.active_exposure['key'])
                              if exposure_thresholds.get(classification['key']):
                                  exposure_thresholds_classifications = exposure_thresholds \
              Severity: Major
              Found in safe/gui/tools/wizard/step_kw33_multi_classifications.py and 1 other location - About 1 day to fix
              safe/gui/tools/wizard/step_kw33_multi_classifications.py on lines 636..656

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

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

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

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

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

              Refactorings

              Further Reading

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

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

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 122.

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

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

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

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

              Refactorings

              Further Reading

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

                              for the_class in classes:
                                  value_map = value_maps[classification['key']][
                                      'classes'].get(the_class['key'], [])
                                  row = m.Row()
                                  row.add(m.Cell(the_class['name']))
              Severity: Major
              Found in safe/gui/tools/wizard/step_kw33_multi_classifications.py and 1 other location - About 7 hrs to fix
              safe/utilities/keyword_io.py on lines 627..633

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

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

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

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

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

              Refactorings

              Further Reading

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

                          for value in assigned_values[default_class['key']]:
                              string_value = value is not None and str(value) or 'NULL'
                              tree_leaf = QTreeWidgetItem(tree_branch)
                              tree_leaf.setFlags(
                                  Qt.ItemIsEnabled
              Severity: Major
              Found in safe/gui/tools/wizard/step_kw33_multi_classifications.py and 1 other location - About 6 hrs to fix
              safe/gui/tools/wizard/step_kw40_classify.py on lines 327..335

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

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

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

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

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

              Refactorings

              Further Reading

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

                  def get_value_map(self):
                      """Obtain the value-to-class mapping set by user.
              
                      :returns: The complete mapping as a dict of lists.
                      :rtype: dict
              Severity: Major
              Found in safe/gui/tools/wizard/step_kw33_multi_classifications.py and 1 other location - About 6 hrs to fix
              safe/gui/tools/wizard/step_kw40_classify.py on lines 132..146

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

              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 is_raster_layer(self.parent.layer):
                          active_band = self.parent.step_kw_band_selector.selected_band()
                          layer_extent = self.parent.layer.extent()
                          statistics = self.parent.layer.dataProvider().bandStatistics(
                              active_band, QgsRasterBandStats.All, layer_extent, 0)
              Severity: Major
              Found in safe/gui/tools/wizard/step_kw33_multi_classifications.py and 1 other location - About 6 hrs to fix
              safe/gui/tools/wizard/step_kw43_threshold.py on lines 104..124

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

              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 mode == MAX_VALUE_MODE:
                              current_max_value = list(self.threshold_classes.values())[
                                  double_spin_index][1]
                              target_min_value = list(self.threshold_classes.values())[
                                  double_spin_index + 1][0]
              Severity: Major
              Found in safe/gui/tools/wizard/step_kw33_multi_classifications.py and 1 other location - About 5 hrs to fix
              safe/gui/tools/wizard/step_kw43_threshold.py on lines 201..205

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

              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

                          elif mode == MIN_VALUE_MODE:
                              current_min_value = list(self.threshold_classes.values())[
                                  double_spin_index][0]
                              target_max_value = list(self.threshold_classes.values())[
                                  double_spin_index - 1][1]
              Severity: Major
              Found in safe/gui/tools/wizard/step_kw33_multi_classifications.py and 1 other location - About 5 hrs to fix
              safe/gui/tools/wizard/step_kw43_threshold.py on lines 206..210

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

              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.thresholds.get(self.active_exposure['key']):
                              # Set other class to not active
                              for current_classification in list(self.thresholds.get(
                                      self.active_exposure['key']).values()):
                                  current_classification['active'] = False
              Severity: Major
              Found in safe/gui/tools/wizard/step_kw33_multi_classifications.py and 1 other location - About 4 hrs to fix
              safe/gui/tools/wizard/step_kw33_multi_classifications.py on lines 1087..1093

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

              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.value_maps.get(self.active_exposure['key']):
                              # Set other class to not active
                              for current_classification in list(self.value_maps.get(
                                      self.active_exposure['key']).values()):
                                  current_classification['active'] = False
              Severity: Major
              Found in safe/gui/tools/wizard/step_kw33_multi_classifications.py and 1 other location - About 4 hrs to fix
              safe/gui/tools/wizard/step_kw33_multi_classifications.py on lines 1071..1077

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

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

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

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

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

              Refactorings

              Further Reading

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

                  def get_threshold(self):
                      """Return threshold based on current state."""
                      value_map = dict()
                      for key, value in list(self.threshold_classes.items()):
                          value_map[key] = [
              Severity: Major
              Found in safe/gui/tools/wizard/step_kw33_multi_classifications.py and 1 other location - About 3 hrs to fix
              safe/gui/tools/wizard/step_kw43_threshold.py on lines 224..232

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

              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 int(item.flags() & Qt.ItemIsDropEnabled) \
                              and int(item.flags() & Qt.ItemIsDragEnabled):
                          item.setFlags(item.flags() & ~Qt.ItemIsDropEnabled)
              Severity: Major
              Found in safe/gui/tools/wizard/step_kw33_multi_classifications.py and 1 other location - About 3 hrs to fix
              safe/gui/tools/wizard/step_kw40_classify.py on lines 128..130

              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

                              if 'string_defaults' in default_class:
                                  # To make it case insensitive
                                  upper_string_defaults = [
                                      c.upper() for c in default_class['string_defaults']]
                                  in_string_default = (
              Severity: Major
              Found in safe/gui/tools/wizard/step_kw33_multi_classifications.py and 1 other location - About 3 hrs to fix
              safe/gui/tools/wizard/step_kw40_classify.py on lines 211..219

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 66.

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

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

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

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

              Refactorings

              Further Reading

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

                          for key, value_list in list(current_value_map.items()):
                              if unique_value in value_list and key in assigned_values:
                                  assigned_values[key] += [unique_value]
                                  assigned = True
              Severity: Major
              Found in safe/gui/tools/wizard/step_kw33_multi_classifications.py and 1 other location - About 2 hrs to fix
              safe/gui/tools/wizard/step_kw40_classify.py on lines 270..273

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

              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 numpy.issubdtype(unique_values.dtype, float):
                              unique_values = [float(i) for i in unique_values]
                          else:
                              unique_values = [int(i) for i in unique_values]
              Severity: Major
              Found in safe/gui/tools/wizard/step_kw33_multi_classifications.py and 1 other location - About 1 hr to fix
              safe/gui/tools/wizard/step_kw40_classify.py on lines 166..169

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

              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

                          description_text = continuous_raster_question % (
                              layer_purpose['name'],
                              layer_subcategory['name'],
                              classification['name'],
                              statistics.minimumValue,
              Severity: Major
              Found in safe/gui/tools/wizard/step_kw33_multi_classifications.py and 1 other location - About 1 hr to fix
              safe/gui/tools/wizard/step_kw43_threshold.py on lines 107..112

              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 classification_key == classification['key']:
                              value['active'] = True
                          else:
                              value['active'] = False
              Severity: Major
              Found in safe/gui/tools/wizard/step_kw33_multi_classifications.py and 1 other location - About 1 hr to fix
              safe/utilities/metadata.py on lines 430..436

              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 not value_maps or not classification:
                                  message.add(m.Paragraph(tr('No classifications set.')))
                                  continue
              Severity: Minor
              Found in safe/gui/tools/wizard/step_kw33_multi_classifications.py and 1 other location - About 55 mins to fix
              safe/gui/tools/wizard/step_kw33_multi_classifications.py on lines 414..416

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

              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 thresholds or not classification:
                                  message.add(m.Paragraph(tr('No classifications set.')))
                                  continue
              Severity: Minor
              Found in safe/gui/tools/wizard/step_kw33_multi_classifications.py and 1 other location - About 55 mins to fix
              safe/gui/tools/wizard/step_kw33_multi_classifications.py on lines 437..439

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 37.

              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.layer_mode == layer_mode_continuous:
                                      if exposure['key'] in self.thresholds:
                                          self.thresholds.pop(exposure['key'])
              Severity: Minor
              Found in safe/gui/tools/wizard/step_kw33_multi_classifications.py and 1 other location - About 45 mins to fix
              safe/gui/tools/wizard/step_kw33_multi_classifications.py on lines 222..227

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

              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 'name' in default_class:
                              default_class_name = default_class['name']
                          else:
                              default_class_name = default_class['key']
              Severity: Minor
              Found in safe/gui/tools/wizard/step_kw33_multi_classifications.py and 1 other location - About 35 mins to fix
              safe/gui/tools/wizard/step_kw40_classify.py on lines 318..321

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

              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

                          self.thresholds[self.active_exposure['key']][
                              classification['key']] = classification_class
              Severity: Minor
              Found in safe/gui/tools/wizard/step_kw33_multi_classifications.py and 1 other location - About 35 mins to fix
              safe/gui/tools/wizard/step_kw33_multi_classifications.py on lines 1095..1096

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

              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

                          self.value_maps[self.active_exposure['key']][
                              classification['key']] = classification_class
              Severity: Minor
              Found in safe/gui/tools/wizard/step_kw33_multi_classifications.py and 1 other location - About 35 mins to fix
              safe/gui/tools/wizard/step_kw33_multi_classifications.py on lines 1079..1080

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

              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

                          label = tr(
                              '{hazard_name} on {exposure_name} Classifications').format(
                              hazard_name=hazard['name'],
                              exposure_name=exposure['name']
              Severity: Major
              Found in safe/gui/tools/wizard/step_kw33_multi_classifications.py and 3 other locations - About 30 mins to fix
              safe/impact_function/provenance_utilities.py on lines 35..39
              safe/impact_function/provenance_utilities.py on lines 35..44
              safe/impact_function/provenance_utilities.py on lines 67..71

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

              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