inasafe/inasafe

View on GitHub
safe/report/expressions/map_report.py

Summary

Maintainability
F
1 wk
Test Coverage

File map_report.py has 471 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# coding=utf-8

"""QGIS Expressions which are available in the QGIS GUI interface."""

import os
Severity: Minor
Found in safe/report/expressions/map_report.py - About 7 hrs to fix

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

    @qgsfunction(
        args='auto', group=label_group, usesGeometry=False, referencedColumns=[],
        help_text=help_message.to_html(), helpText=help_message.to_html())
    def name_of_the_nearest_place(feature, parent):
        """If the impact layer has a distance field, it will return the name
    Severity: Major
    Found in safe/report/expressions/map_report.py and 3 other locations - About 1 day to fix
    safe/report/expressions/map_report.py on lines 154..175
    safe/report/expressions/map_report.py on lines 187..208
    safe/report/expressions/map_report.py on lines 220..241

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

    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

    @qgsfunction(
        args='auto', group=label_group, usesGeometry=False, referencedColumns=[],
        help_text=help_message.to_html(), helpText=help_message.to_html())
    def distance_to_nearest_place(feature, parent):
        """If the impact layer has a distance field, it will return the distance to
    Severity: Major
    Found in safe/report/expressions/map_report.py and 3 other locations - About 1 day to fix
    safe/report/expressions/map_report.py on lines 187..208
    safe/report/expressions/map_report.py on lines 220..241
    safe/report/expressions/map_report.py on lines 253..274

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

    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

    @qgsfunction(
        args='auto', group=label_group, usesGeometry=False, referencedColumns=[],
        help_text=help_message.to_html(), helpText=help_message.to_html())
    def bearing_to_nearest_place(feature, parent):
        """If the impact layer has a distance field, it will return the bearing
    Severity: Major
    Found in safe/report/expressions/map_report.py and 3 other locations - About 1 day to fix
    safe/report/expressions/map_report.py on lines 154..175
    safe/report/expressions/map_report.py on lines 187..208
    safe/report/expressions/map_report.py on lines 253..274

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

    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

    @qgsfunction(
        args='auto', group=label_group, usesGeometry=False, referencedColumns=[],
        help_text=help_message.to_html(), helpText=help_message.to_html())
    def direction_to_nearest_place(feature, parent):
        """If the impact layer has a distance field, it will return the direction
    Severity: Major
    Found in safe/report/expressions/map_report.py and 3 other locations - About 1 day to fix
    safe/report/expressions/map_report.py on lines 154..175
    safe/report/expressions/map_report.py on lines 220..241
    safe/report/expressions/map_report.py on lines 253..274

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

    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

    @qgsfunction(
        args='auto', group=image_group, usesGeometry=False, referencedColumns=[],
        help_text=help_message.to_html(), helpText=help_message.to_html())
    def north_arrow_path(feature, parent):
        """Retrieve the full path of default north arrow logo."""
    Severity: Major
    Found in safe/report/expressions/map_report.py and 1 other location - About 6 hrs to fix
    safe/report/expressions/map_report.py on lines 588..603

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

    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

    @qgsfunction(
        args='auto', group=image_group, usesGeometry=False, referencedColumns=[],
        help_text=help_message.to_html(), helpText=help_message.to_html())
    def organisation_logo_path(feature, parent):
        """Retrieve the full path of used specified organisation logo."""
    Severity: Major
    Found in safe/report/expressions/map_report.py and 1 other location - About 6 hrs to fix
    safe/report/expressions/map_report.py on lines 560..575

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

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

    @qgsfunction(
        args='auto', group=label_group, usesGeometry=False, referencedColumns=[],
        help_text=help_message.to_html(), helpText=help_message.to_html())
    def source_title_header_element(feature, parent):
        """Retrieve source title header string from definitions."""
    Severity: Major
    Found in safe/report/expressions/map_report.py and 18 other locations - About 3 hrs to fix
    safe/report/expressions/infographic.py on lines 174..181
    safe/report/expressions/infographic.py on lines 191..198
    safe/report/expressions/infographic.py on lines 208..215
    safe/report/expressions/infographic.py on lines 225..232
    safe/report/expressions/infographic.py on lines 260..267
    safe/report/expressions/infographic.py on lines 278..285
    safe/report/expressions/infographic.py on lines 296..303
    safe/report/expressions/infographic.py on lines 314..323
    safe/report/expressions/map_report.py on lines 82..89
    safe/report/expressions/map_report.py on lines 285..292
    safe/report/expressions/map_report.py on lines 320..327
    safe/report/expressions/map_report.py on lines 338..345
    safe/report/expressions/map_report.py on lines 356..363
    safe/report/expressions/map_report.py on lines 410..417
    safe/report/expressions/map_report.py on lines 428..435
    safe/report/expressions/map_report.py on lines 446..453
    safe/report/expressions/map_report.py on lines 488..495
    safe/report/expressions/map_report.py on lines 506..513

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

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

    @qgsfunction(
        args='auto', group=label_group, usesGeometry=False, referencedColumns=[],
        help_text=help_message.to_html(), helpText=help_message.to_html())
    def aggregation_not_used_text_element(feature, parent):
        """Retrieve reference title header string from definitions."""
    Severity: Major
    Found in safe/report/expressions/map_report.py and 18 other locations - About 3 hrs to fix
    safe/report/expressions/infographic.py on lines 174..181
    safe/report/expressions/infographic.py on lines 191..198
    safe/report/expressions/infographic.py on lines 208..215
    safe/report/expressions/infographic.py on lines 225..232
    safe/report/expressions/infographic.py on lines 260..267
    safe/report/expressions/infographic.py on lines 278..285
    safe/report/expressions/infographic.py on lines 296..303
    safe/report/expressions/infographic.py on lines 314..323
    safe/report/expressions/map_report.py on lines 82..89
    safe/report/expressions/map_report.py on lines 285..292
    safe/report/expressions/map_report.py on lines 320..327
    safe/report/expressions/map_report.py on lines 338..345
    safe/report/expressions/map_report.py on lines 356..363
    safe/report/expressions/map_report.py on lines 392..399
    safe/report/expressions/map_report.py on lines 410..417
    safe/report/expressions/map_report.py on lines 428..435
    safe/report/expressions/map_report.py on lines 446..453
    safe/report/expressions/map_report.py on lines 488..495

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

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

    @qgsfunction(
        args='auto', group=label_group, usesGeometry=False, referencedColumns=[],
        help_text=help_message.to_html(), helpText=help_message.to_html())
    def disclaimer_title_header_element(feature, parent):
        """Retrieve disclaimer title header string from definitions."""
    Severity: Major
    Found in safe/report/expressions/map_report.py and 18 other locations - About 3 hrs to fix
    safe/report/expressions/infographic.py on lines 174..181
    safe/report/expressions/infographic.py on lines 191..198
    safe/report/expressions/infographic.py on lines 208..215
    safe/report/expressions/infographic.py on lines 225..232
    safe/report/expressions/infographic.py on lines 260..267
    safe/report/expressions/infographic.py on lines 278..285
    safe/report/expressions/infographic.py on lines 296..303
    safe/report/expressions/infographic.py on lines 314..323
    safe/report/expressions/map_report.py on lines 82..89
    safe/report/expressions/map_report.py on lines 320..327
    safe/report/expressions/map_report.py on lines 338..345
    safe/report/expressions/map_report.py on lines 356..363
    safe/report/expressions/map_report.py on lines 392..399
    safe/report/expressions/map_report.py on lines 410..417
    safe/report/expressions/map_report.py on lines 428..435
    safe/report/expressions/map_report.py on lines 446..453
    safe/report/expressions/map_report.py on lines 488..495
    safe/report/expressions/map_report.py on lines 506..513

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

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

    @qgsfunction(
        args='auto', group=label_group, usesGeometry=False, referencedColumns=[],
        help_text=help_message.to_html(), helpText=help_message.to_html())
    def time_title_header_element(feature, parent):
        """Retrieve time title header string from definitions."""
    Severity: Major
    Found in safe/report/expressions/map_report.py and 18 other locations - About 3 hrs to fix
    safe/report/expressions/infographic.py on lines 174..181
    safe/report/expressions/infographic.py on lines 191..198
    safe/report/expressions/infographic.py on lines 208..215
    safe/report/expressions/infographic.py on lines 225..232
    safe/report/expressions/infographic.py on lines 260..267
    safe/report/expressions/infographic.py on lines 278..285
    safe/report/expressions/infographic.py on lines 296..303
    safe/report/expressions/infographic.py on lines 314..323
    safe/report/expressions/map_report.py on lines 82..89
    safe/report/expressions/map_report.py on lines 285..292
    safe/report/expressions/map_report.py on lines 320..327
    safe/report/expressions/map_report.py on lines 356..363
    safe/report/expressions/map_report.py on lines 392..399
    safe/report/expressions/map_report.py on lines 410..417
    safe/report/expressions/map_report.py on lines 428..435
    safe/report/expressions/map_report.py on lines 446..453
    safe/report/expressions/map_report.py on lines 488..495
    safe/report/expressions/map_report.py on lines 506..513

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

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

    @qgsfunction(
        args='auto', group=label_group, usesGeometry=False, referencedColumns=[],
        help_text=help_message.to_html(), helpText=help_message.to_html())
    def analysis_title_header_element(feature, parent):
        """Retrieve analysis title header string from definitions."""
    Severity: Major
    Found in safe/report/expressions/map_report.py and 18 other locations - About 3 hrs to fix
    safe/report/expressions/infographic.py on lines 174..181
    safe/report/expressions/infographic.py on lines 191..198
    safe/report/expressions/infographic.py on lines 208..215
    safe/report/expressions/infographic.py on lines 225..232
    safe/report/expressions/infographic.py on lines 260..267
    safe/report/expressions/infographic.py on lines 278..285
    safe/report/expressions/infographic.py on lines 296..303
    safe/report/expressions/infographic.py on lines 314..323
    safe/report/expressions/map_report.py on lines 82..89
    safe/report/expressions/map_report.py on lines 285..292
    safe/report/expressions/map_report.py on lines 320..327
    safe/report/expressions/map_report.py on lines 338..345
    safe/report/expressions/map_report.py on lines 356..363
    safe/report/expressions/map_report.py on lines 392..399
    safe/report/expressions/map_report.py on lines 428..435
    safe/report/expressions/map_report.py on lines 446..453
    safe/report/expressions/map_report.py on lines 488..495
    safe/report/expressions/map_report.py on lines 506..513

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

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

    @qgsfunction(
        args='auto', group=label_group, usesGeometry=False, referencedColumns=[],
        help_text=help_message.to_html(), helpText=help_message.to_html())
    def unknown_source_text_element(feature, parent):
        """Retrieve reference title header string from definitions."""
    Severity: Major
    Found in safe/report/expressions/map_report.py and 18 other locations - About 3 hrs to fix
    safe/report/expressions/infographic.py on lines 174..181
    safe/report/expressions/infographic.py on lines 191..198
    safe/report/expressions/infographic.py on lines 208..215
    safe/report/expressions/infographic.py on lines 225..232
    safe/report/expressions/infographic.py on lines 260..267
    safe/report/expressions/infographic.py on lines 278..285
    safe/report/expressions/infographic.py on lines 296..303
    safe/report/expressions/infographic.py on lines 314..323
    safe/report/expressions/map_report.py on lines 82..89
    safe/report/expressions/map_report.py on lines 285..292
    safe/report/expressions/map_report.py on lines 320..327
    safe/report/expressions/map_report.py on lines 338..345
    safe/report/expressions/map_report.py on lines 356..363
    safe/report/expressions/map_report.py on lines 392..399
    safe/report/expressions/map_report.py on lines 410..417
    safe/report/expressions/map_report.py on lines 428..435
    safe/report/expressions/map_report.py on lines 446..453
    safe/report/expressions/map_report.py on lines 506..513

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

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

    @qgsfunction(
        args='auto', group=label_group, usesGeometry=False, referencedColumns=[],
        help_text=help_message.to_html(), helpText=help_message.to_html())
    def reference_title_header_element(feature, parent):
        """Retrieve reference title header string from definitions."""
    Severity: Major
    Found in safe/report/expressions/map_report.py and 18 other locations - About 3 hrs to fix
    safe/report/expressions/infographic.py on lines 174..181
    safe/report/expressions/infographic.py on lines 191..198
    safe/report/expressions/infographic.py on lines 208..215
    safe/report/expressions/infographic.py on lines 225..232
    safe/report/expressions/infographic.py on lines 260..267
    safe/report/expressions/infographic.py on lines 278..285
    safe/report/expressions/infographic.py on lines 296..303
    safe/report/expressions/infographic.py on lines 314..323
    safe/report/expressions/map_report.py on lines 82..89
    safe/report/expressions/map_report.py on lines 285..292
    safe/report/expressions/map_report.py on lines 320..327
    safe/report/expressions/map_report.py on lines 338..345
    safe/report/expressions/map_report.py on lines 356..363
    safe/report/expressions/map_report.py on lines 392..399
    safe/report/expressions/map_report.py on lines 410..417
    safe/report/expressions/map_report.py on lines 428..435
    safe/report/expressions/map_report.py on lines 488..495
    safe/report/expressions/map_report.py on lines 506..513

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

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

    @qgsfunction(
        args='auto', group=label_group, usesGeometry=False, referencedColumns=[],
        help_text=help_message.to_html(), helpText=help_message.to_html())
    def legend_title_header_element(feature, parent):
        """Retrieve legend title header string from definitions."""
    Severity: Major
    Found in safe/report/expressions/map_report.py and 18 other locations - About 3 hrs to fix
    safe/report/expressions/infographic.py on lines 174..181
    safe/report/expressions/infographic.py on lines 191..198
    safe/report/expressions/infographic.py on lines 208..215
    safe/report/expressions/infographic.py on lines 225..232
    safe/report/expressions/infographic.py on lines 260..267
    safe/report/expressions/infographic.py on lines 278..285
    safe/report/expressions/infographic.py on lines 296..303
    safe/report/expressions/infographic.py on lines 314..323
    safe/report/expressions/map_report.py on lines 285..292
    safe/report/expressions/map_report.py on lines 320..327
    safe/report/expressions/map_report.py on lines 338..345
    safe/report/expressions/map_report.py on lines 356..363
    safe/report/expressions/map_report.py on lines 392..399
    safe/report/expressions/map_report.py on lines 410..417
    safe/report/expressions/map_report.py on lines 428..435
    safe/report/expressions/map_report.py on lines 446..453
    safe/report/expressions/map_report.py on lines 488..495
    safe/report/expressions/map_report.py on lines 506..513

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

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

    @qgsfunction(
        args='auto', group=label_group, usesGeometry=False, referencedColumns=[],
        help_text=help_message.to_html(), helpText=help_message.to_html())
    def caution_title_header_element(feature, parent):
        """Retrieve caution title header string from definitions."""
    Severity: Major
    Found in safe/report/expressions/map_report.py and 18 other locations - About 3 hrs to fix
    safe/report/expressions/infographic.py on lines 174..181
    safe/report/expressions/infographic.py on lines 191..198
    safe/report/expressions/infographic.py on lines 208..215
    safe/report/expressions/infographic.py on lines 225..232
    safe/report/expressions/infographic.py on lines 260..267
    safe/report/expressions/infographic.py on lines 278..285
    safe/report/expressions/infographic.py on lines 296..303
    safe/report/expressions/infographic.py on lines 314..323
    safe/report/expressions/map_report.py on lines 82..89
    safe/report/expressions/map_report.py on lines 285..292
    safe/report/expressions/map_report.py on lines 320..327
    safe/report/expressions/map_report.py on lines 338..345
    safe/report/expressions/map_report.py on lines 392..399
    safe/report/expressions/map_report.py on lines 410..417
    safe/report/expressions/map_report.py on lines 428..435
    safe/report/expressions/map_report.py on lines 446..453
    safe/report/expressions/map_report.py on lines 488..495
    safe/report/expressions/map_report.py on lines 506..513

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

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

    @qgsfunction(
        args='auto', group=label_group, usesGeometry=False, referencedColumns=[],
        help_text=help_message.to_html(), helpText=help_message.to_html())
    def version_title_header_element(feature, parent):
        """Retrieve version title header string from definitions."""
    Severity: Major
    Found in safe/report/expressions/map_report.py and 18 other locations - About 3 hrs to fix
    safe/report/expressions/infographic.py on lines 174..181
    safe/report/expressions/infographic.py on lines 191..198
    safe/report/expressions/infographic.py on lines 208..215
    safe/report/expressions/infographic.py on lines 225..232
    safe/report/expressions/infographic.py on lines 260..267
    safe/report/expressions/infographic.py on lines 278..285
    safe/report/expressions/infographic.py on lines 296..303
    safe/report/expressions/infographic.py on lines 314..323
    safe/report/expressions/map_report.py on lines 82..89
    safe/report/expressions/map_report.py on lines 285..292
    safe/report/expressions/map_report.py on lines 320..327
    safe/report/expressions/map_report.py on lines 338..345
    safe/report/expressions/map_report.py on lines 356..363
    safe/report/expressions/map_report.py on lines 392..399
    safe/report/expressions/map_report.py on lines 410..417
    safe/report/expressions/map_report.py on lines 446..453
    safe/report/expressions/map_report.py on lines 488..495
    safe/report/expressions/map_report.py on lines 506..513

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

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

    @qgsfunction(
        args='auto', group=label_group, usesGeometry=False, referencedColumns=[],
        help_text=help_message.to_html(), helpText=help_message.to_html())
    def information_title_header_element(feature, parent):
        """Retrieve information title header string from definitions."""
    Severity: Major
    Found in safe/report/expressions/map_report.py and 18 other locations - About 3 hrs to fix
    safe/report/expressions/infographic.py on lines 174..181
    safe/report/expressions/infographic.py on lines 191..198
    safe/report/expressions/infographic.py on lines 208..215
    safe/report/expressions/infographic.py on lines 225..232
    safe/report/expressions/infographic.py on lines 260..267
    safe/report/expressions/infographic.py on lines 278..285
    safe/report/expressions/infographic.py on lines 296..303
    safe/report/expressions/infographic.py on lines 314..323
    safe/report/expressions/map_report.py on lines 82..89
    safe/report/expressions/map_report.py on lines 285..292
    safe/report/expressions/map_report.py on lines 338..345
    safe/report/expressions/map_report.py on lines 356..363
    safe/report/expressions/map_report.py on lines 392..399
    safe/report/expressions/map_report.py on lines 410..417
    safe/report/expressions/map_report.py on lines 428..435
    safe/report/expressions/map_report.py on lines 446..453
    safe/report/expressions/map_report.py on lines 488..495
    safe/report/expressions/map_report.py on lines 506..513

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

    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

    @qgsfunction(
        args='auto', group=label_group, usesGeometry=False, referencedColumns=[],
        help_text=help_message.to_html(), helpText=help_message.to_html())
    def caution_text_element(feature, parent):
        """Retrieve caution text string from definitions."""
    Severity: Major
    Found in safe/report/expressions/map_report.py and 2 other locations - About 3 hrs to fix
    safe/report/expressions/infographic.py on lines 242..249
    safe/report/expressions/infographic.py on lines 334..341

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

    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

    @qgsfunction(
        args='auto', group=image_group, usesGeometry=False, referencedColumns=[],
        help_text=help_message.to_html(), helpText=help_message.to_html())
    def inasafe_logo_black_path(feature, parent):
        """Retrieve the full path of inasafe-logo-black.svg."""
    Severity: Major
    Found in safe/report/expressions/map_report.py and 1 other location - About 2 hrs to fix
    safe/report/expressions/map_report.py on lines 541..547

    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

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

    @qgsfunction(
        args='auto', group=image_group, usesGeometry=False, referencedColumns=[],
        help_text=help_message.to_html(), helpText=help_message.to_html())
    def inasafe_logo_white_path(feature, parent):
        """Retrieve the full path of inasafe-logo-white.svg."""
    Severity: Major
    Found in safe/report/expressions/map_report.py and 1 other location - About 2 hrs to fix
    safe/report/expressions/map_report.py on lines 524..530

    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

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

        if is_multi_exposure:
            key = ('{provenance}__{exposure}').format(
                provenance=provenance_multi_exposure_summary_layers_id[
                    'provenance_key'],
                exposure=exposure_place['key'])
    Severity: Minor
    Found in safe/report/expressions/map_report.py and 1 other location - About 30 mins to fix
    safe/report/expressions/map_report.py on lines 131..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 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

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

            if is_multi_exposure:
                key = ('{provenance}__{exposure}').format(
                    provenance=provenance_multi_exposure_summary_layers[
                        'provenance_key'],
                    exposure=exposure_place['key'])
    Severity: Minor
    Found in safe/report/expressions/map_report.py and 1 other location - About 30 mins to fix
    safe/report/expressions/map_report.py on lines 119..123

    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