inasafe/inasafe

View on GitHub

Showing 1,474 of 1,497 total issues

File fields.py has 2644 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# coding=utf-8

"""Definitions relating to fields."""

from qgis.PyQt.QtCore import QVariant
Severity: Major
Found in safe/definitions/fields.py - About 1 wk to fix

    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

      File hazard_classifications.py has 1902 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # coding=utf-8
      """Definitions relating to hazards classifications.
      
      See https://github.com/inasafe/inasafe/issues/2920#issuecomment-229874044
      to have a table showing you classes of each kind of hazard.
      Severity: Major
      Found in safe/definitions/hazard_classifications.py - About 5 days to fix

        File dock.py has 1321 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # coding=utf-8
        """InaSAFE Dock."""
        
        
        import codecs
        Severity: Major
        Found in safe/gui/widgets/dock.py - About 3 days to fix

          File definitions_help.py has 1243 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # coding=utf-8
          """Help text for the dock widget."""
          
          
          import copy
          Severity: Major
          Found in safe/gui/tools/help/definitions_help.py - About 3 days to fix

            File multi_exposure_wrapper.py has 1192 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # coding=utf-8
            
            """
            Multi-exposure wrapper.
            
            
            Severity: Major
            Found in safe/impact_function/multi_exposure_wrapper.py - About 3 days to fix

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

                  if isinstance(output_format, list):
                      component_output = []
                      for i in range(len(output_format)):
                          each_format = output_format[i]
                          each_path = component_output_path[i]
              Severity: Major
              Found in safe/report/processors/default.py and 1 other location - About 2 days to fix
              safe/report/processors/default.py on lines 616..666

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

              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 isinstance(output_format, list):
                      component_output = []
                      for i in range(len(output_format)):
                          each_format = output_format[i]
                          each_path = component_output_path[i]
              Severity: Major
              Found in safe/report/processors/default.py and 1 other location - About 2 days to fix
              safe/report/processors/default.py on lines 326..376

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

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

                File components.py has 875 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                # coding=utf-8
                """Contains definitions about Report components.
                
                """
                
                
                Severity: Major
                Found in safe/definitions/reports/components.py - About 2 days to fix

                  File plugin.py has 850 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  # coding=utf-8
                  """InaSAFE Plugin."""
                  
                  import sys
                  import os
                  Severity: Major
                  Found in safe/plugin.py - About 2 days to fix

                    File shake_grid.py has 833 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    # coding=utf-8
                    """A converter for USGS shakemap grid.xml files."""
                    
                    
                    import codecs
                    Severity: Major
                    Found in safe/gui/tools/shake_grid/shake_grid.py - About 2 days to fix

                      File exposure_classifications.py has 828 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      # coding=utf-8
                      
                      """Definitions relating to exposure classifications."""
                      
                      from safe.utilities.i18n import tr
                      Severity: Major
                      Found in safe/definitions/exposure_classifications.py - About 1 day to fix

                        File population_post_processors.py has 811 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        # coding=utf-8
                        
                        """Postprocessors about population and demographics."""
                        
                        from collections import OrderedDict
                        Severity: Major
                        Found in safe/processors/population_post_processors.py - About 1 day 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

                          File options_dialog.py has 760 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

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

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

                                def set_widgets(self):
                                    """Set widgets on the Exposure Layer From Canvas tab."""
                                    # The list is already populated in the previous step, but now we
                                    # need to do it again in case we're back from the Keyword Wizard.
                                    # First, preserve self.parent.layer before clearing the list
                            Severity: Major
                            Found in safe/gui/tools/wizard/step_fc35_explayer_from_canvas.py and 1 other location - About 1 day to fix
                            safe/gui/tools/wizard/step_fc20_hazlayer_from_canvas.py on lines 110..132

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

                            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 set_widgets(self):
                                    """Set widgets on the Hazard Layer From TOC tab."""
                                    # The list is already populated in the previous step, but now we
                                    # need to do it again in case we're back from the Keyword Wizard.
                                    # First, preserve self.parent.layer before clearing the list
                            Severity: Major
                            Found in safe/gui/tools/wizard/step_fc20_hazlayer_from_canvas.py and 1 other location - About 1 day to fix
                            safe/gui/tools/wizard/step_fc35_explayer_from_canvas.py on lines 110..132

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

                            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 concepts.py has 736 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            # coding=utf-8
                            """Concepts used in various places in InaSAFE.
                            
                            Where possible please supply citations. Concepts are used in reporting display
                            and in other places like the wizard to ensure that the user will have adequate
                            Severity: Major
                            Found in safe/definitions/concepts.py - About 1 day to fix
                              Severity
                              Category
                              Status
                              Source
                              Language