inasafe/inasafe

View on GitHub

Showing 1,474 of 1,497 total issues

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

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

Duplicated Code

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

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

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

Tuning

This issue has a mass of 118.

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

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

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

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

Refactorings

Further Reading

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

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

Duplicated Code

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

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

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

Tuning

This issue has a mass of 118.

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

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

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

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

Refactorings

Further Reading

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

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

Duplicated Code

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

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

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

Tuning

This issue has a mass of 118.

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

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

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

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

Refactorings

Further Reading

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

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

Duplicated Code

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

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

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

Tuning

This issue has a mass of 118.

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

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

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

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

Refactorings

Further Reading

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

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

Duplicated Code

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

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

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

Tuning

This issue has a mass of 118.

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

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

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

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

Refactorings

Further Reading

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

Severity: Major
Found in safe/messaging/item/emphasized_text.py and 1 other location - About 7 hrs to fix
safe/messaging/item/important_text.py on lines 0..58

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

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/messaging/item/important_text.py and 1 other location - About 7 hrs to fix
safe/messaging/item/emphasized_text.py on lines 0..76

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

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 'multi_event_notes' in definition:
        message.add(
            m.Heading(
                tr('Notes for multi events / scenarios:'),
                **DETAILS_STYLE))
Severity: Major
Found in safe/gui/tools/help/definitions_help.py and 1 other location - About 7 hrs to fix
safe/gui/tools/help/definitions_help.py on lines 1109..1118

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

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_keys in lay_req:
                allowed_classifications = [
                    c['key'] for c in lay_req[classification_keys]]
                req_classifications = ', '.join(allowed_classifications)

Severity: Major
Found in safe/gui/tools/wizard/wizard_step_browser.py and 1 other location - About 7 hrs to fix
safe/gui/tools/wizard/wizard_step_browser.py on lines 271..287

Duplicated Code

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

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

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

Tuning

This issue has a mass of 116.

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 unit_keys in lay_req:
                allowed_units = [c['key'] for c in lay_req[unit_keys]]
                req_units = ', '.join(allowed_units)

                lay_unit = '  -'
Severity: Major
Found in safe/gui/tools/wizard/wizard_step_browser.py and 1 other location - About 7 hrs to fix
safe/gui/tools/wizard/wizard_step_browser.py on lines 236..257

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

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 'single_event_notes' in definition:
        message.add(
            m.Heading(tr('Notes for single events'), **DETAILS_STYLE))
        if len(definition['single_event_notes']) < 1:
            message.add(m.Paragraph(tr('No single event notes defined.')))
Severity: Major
Found in safe/gui/tools/help/definitions_help.py and 1 other location - About 7 hrs to fix
safe/gui/tools/help/definitions_help.py on lines 1120..1131

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

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

# coding=utf-8
"""This is a dialog to print a custom map report.
"""
import logging
from copy import deepcopy
Severity: Minor
Found in safe/gui/tools/print_report_dialog.py - About 7 hrs to fix

    File units.py has 477 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # coding=utf-8
    
    """Definitions relating to units."""
    
    from collections import OrderedDict
    Severity: Minor
    Found in safe/definitions/units.py - About 7 hrs to fix

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

          def _create_options_dialog_action(self):
              """Create action for options dialog."""
              icon = resources_path('img', 'icons', 'configure-inasafe.svg')
              self.action_options = QAction(
                  QIcon(icon),
      Severity: Major
      Found in safe/plugin.py and 7 other locations - About 7 hrs to fix
      safe/plugin.py on lines 236..248
      safe/plugin.py on lines 250..263
      safe/plugin.py on lines 265..279
      safe/plugin.py on lines 281..294
      safe/plugin.py on lines 296..308
      safe/plugin.py on lines 381..395
      safe/plugin.py on lines 428..444

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

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

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

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

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

      Refactorings

      Further Reading

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

          def _create_multi_buffer_action(self):
              """Create action for multi buffer dialog."""
              icon = resources_path('img', 'icons', 'show-multi-buffer.svg')
              self.action_multi_buffer = QAction(
                  QIcon(icon),
      Severity: Major
      Found in safe/plugin.py and 7 other locations - About 7 hrs to fix
      safe/plugin.py on lines 223..234
      safe/plugin.py on lines 236..248
      safe/plugin.py on lines 265..279
      safe/plugin.py on lines 281..294
      safe/plugin.py on lines 296..308
      safe/plugin.py on lines 381..395
      safe/plugin.py on lines 428..444

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

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

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

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

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

      Refactorings

      Further Reading

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

          def _create_minimum_needs_options_action(self):
              """Create action for global minimum needs dialog."""
              icon = resources_path('img', 'icons', 'show-global-minimum-needs.svg')
              self.action_minimum_needs_config = QAction(
                  QIcon(icon),
      Severity: Major
      Found in safe/plugin.py and 7 other locations - About 7 hrs to fix
      safe/plugin.py on lines 223..234
      safe/plugin.py on lines 236..248
      safe/plugin.py on lines 250..263
      safe/plugin.py on lines 281..294
      safe/plugin.py on lines 296..308
      safe/plugin.py on lines 381..395
      safe/plugin.py on lines 428..444

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

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

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

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

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

      Refactorings

      Further Reading

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

          def _create_add_petabencana_layer_action(self):
              """Create action for import OSM Dialog."""
              icon = resources_path('img', 'icons', 'add-petabencana-layer.svg')
              self.action_add_petabencana_layer = QAction(
                  QIcon(icon),
      Severity: Major
      Found in safe/plugin.py and 7 other locations - About 7 hrs to fix
      safe/plugin.py on lines 223..234
      safe/plugin.py on lines 236..248
      safe/plugin.py on lines 250..263
      safe/plugin.py on lines 265..279
      safe/plugin.py on lines 281..294
      safe/plugin.py on lines 296..308
      safe/plugin.py on lines 381..395

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

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

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

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

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

      Refactorings

      Further Reading

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

          def _create_batch_runner_action(self):
              """Create action for batch runner dialog."""
              icon = resources_path('img', 'icons', 'show-batch-runner.svg')
              self.action_batch_runner = QAction(
                  QIcon(icon),
      Severity: Major
      Found in safe/plugin.py and 7 other locations - About 7 hrs to fix
      safe/plugin.py on lines 223..234
      safe/plugin.py on lines 236..248
      safe/plugin.py on lines 250..263
      safe/plugin.py on lines 265..279
      safe/plugin.py on lines 281..294
      safe/plugin.py on lines 381..395
      safe/plugin.py on lines 428..444

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

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

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

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

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

      Refactorings

      Further Reading

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

          def _create_minimum_needs_action(self):
              """Create action for minimum needs dialog."""
              icon = resources_path('img', 'icons', 'show-minimum-needs.svg')
              self.action_minimum_needs = QAction(
                  QIcon(icon),
      Severity: Major
      Found in safe/plugin.py and 7 other locations - About 7 hrs to fix
      safe/plugin.py on lines 223..234
      safe/plugin.py on lines 250..263
      safe/plugin.py on lines 265..279
      safe/plugin.py on lines 281..294
      safe/plugin.py on lines 296..308
      safe/plugin.py on lines 381..395
      safe/plugin.py on lines 428..444

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

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

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

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

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

      Refactorings

      Further Reading

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

          def _create_metadata_converter_action(self):
              """Create action for showing metadata converter dialog."""
              icon = resources_path('img', 'icons', 'show-metadata-converter.svg')
              self.action_metadata_converter = QAction(
                  QIcon(icon),
      Severity: Major
      Found in safe/plugin.py and 7 other locations - About 7 hrs to fix
      safe/plugin.py on lines 223..234
      safe/plugin.py on lines 236..248
      safe/plugin.py on lines 250..263
      safe/plugin.py on lines 265..279
      safe/plugin.py on lines 281..294
      safe/plugin.py on lines 296..308
      safe/plugin.py on lines 428..444

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

      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