inasafe/inasafe

View on GitHub

Showing 1,474 of 1,497 total issues

File batch_dialog.py has 721 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# coding=utf-8
"""
InaSAFE Disaster risk assessment tool developed by AusAid -
**Script runner dialog.**

Severity: Major
Found in safe/gui/tools/batch/batch_dialog.py - About 1 day to fix

    File wizard_dialog.py has 710 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # coding=utf-8
    """Wizard Dialog."""
    
    
    import logging
    Severity: Major
    Found in safe/gui/tools/wizard/wizard_dialog.py - About 1 day to fix

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

          'classes': [
      
              {
                  'key': 'high',
                  'value': 4,
      Severity: Major
      Found in safe/definitions/hazard_classifications.py and 1 other location - About 1 day to fix
      safe/definitions/hazard_classifications.py on lines 1296..1395

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

      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

      Severity: Major
      Found in safe/gui/tools/wizard/step_fc45_disjoint_layers.py and 2 other locations - About 1 day to fix
      safe/gui/tools/wizard/step_fc65_agglayer_disjoint.py on lines 0..74
      safe/gui/tools/wizard/step_fc75_extent_disjoint.py on lines 0..74

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

      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

          'classes': [
              {
                  'key': 'very high',
                  'value': 5,
                  'color': dark_red,
      Severity: Major
      Found in safe/definitions/hazard_classifications.py and 1 other location - About 1 day to fix
      safe/definitions/hazard_classifications.py on lines 904..1003

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

      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

      Severity: Major
      Found in safe/gui/tools/wizard/step_fc65_agglayer_disjoint.py and 2 other locations - About 1 day to fix
      safe/gui/tools/wizard/step_fc45_disjoint_layers.py on lines 0..71
      safe/gui/tools/wizard/step_fc75_extent_disjoint.py on lines 0..74

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

      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

      Severity: Major
      Found in safe/gui/tools/wizard/step_fc75_extent_disjoint.py and 2 other locations - About 1 day to fix
      safe/gui/tools/wizard/step_fc45_disjoint_layers.py on lines 0..71
      safe/gui/tools/wizard/step_fc65_agglayer_disjoint.py on lines 0..74

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

      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

      File needs_manager_dialog.py has 702 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # coding=utf-8
      """Need Manager Dialog."""
      
      
      import os
      Severity: Major
      Found in safe/gui/tools/minimum_needs/needs_manager_dialog.py - About 1 day to fix

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

        Severity: Major
        Found in safe/metadata/property/integer_property.py and 1 other location - About 1 day to fix
        safe/metadata/property/float_property.py on lines 0..44

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 177.

        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

        Severity: Major
        Found in safe/metadata/property/float_property.py and 1 other location - About 1 day to fix
        safe/metadata/property/integer_property.py on lines 0..45

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

        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

        File impact_report.py has 685 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # coding=utf-8
        """Module to generate impact report.
        
        Enable dynamic report generation based on report metadata.
        Easily customize map report or document based report.
        Severity: Major
        Found in safe/report/impact_report.py - About 1 day to fix

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

          File multi_exposure_dialog.py has 607 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # coding=utf-8
          
          """Multi Exposure Tool."""
          
          
          
          Severity: Major
          Found in safe/gui/tools/multi_exposure_dialog.py - About 1 day to fix

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

                    for i in range(len(self._parameter.labels)):
                        if '%s' in self._parameter.labels[i]:
                            label = (
                                self._parameter.labels[i] %
                                self._parameter.options[i])
            Severity: Major
            Found in safe/common/parameters/default_value_parameter_widget.py and 1 other location - About 1 day to fix
            safe/common/parameters/default_select_parameter_widget.py on lines 48..61

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

            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 i in range(len(self._parameter.default_labels)):
                        if '%s' in self._parameter.default_labels[i]:
                            label = (
                                self._parameter.default_labels[i] %
                                self._parameter.default_values[i])
            Severity: Major
            Found in safe/common/parameters/default_select_parameter_widget.py and 1 other location - About 1 day to fix
            safe/common/parameters/default_value_parameter_widget.py on lines 39..52

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

            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

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

            # coding=utf-8
            """Utilities module for helping definitions retrieval."""
            
            from collections import OrderedDict
            from copy import deepcopy
            Severity: Major
            Found in safe/definitions/utilities.py - About 1 day to fix

              File default.py has 591 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # coding=utf-8
              
              """
              Module for basic renderer we support. Currently we have:
              
              
              Severity: Major
              Found in safe/report/processors/default.py - About 1 day 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

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

                              if is_hazard:
                                  # Min may be a single value or a dict of values so we need
                                  # to check type and deal with it accordingly
                                  if 'numeric_default_min' in inasafe_class:
                                      if isinstance(inasafe_class['numeric_default_min'], dict):
                  Severity: Major
                  Found in safe/gui/tools/help/definitions_help.py and 1 other location - About 1 day to fix
                  safe/gui/tools/help/definitions_help.py on lines 1275..1288

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

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

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

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

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

                  Refactorings

                  Further Reading

                  Severity
                  Category
                  Status
                  Source
                  Language