failmap/failmap

View on GitHub

Showing 577 of 577 total issues

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

websecmap/organizations/management/commands/one_shot_merge_NL_municipalities_2019.py on lines 0..200

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

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

websecmap/organizations/management/commands/one_shot_merge_NL_municipalities_2020.py on lines 0..200

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

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

# pylint: disable=C0321
import logging
import re
from typing import List

Severity: Major
Found in websecmap/map/management/commands/map_parse_administrative_regions.py - About 4 days to fix

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

        for urlrating in newest_urlratings:
    
            # url level, why are there reports without url ratings / empty url ratings like
            if "ratings" in urlrating.calculation:
                for rating in urlrating.calculation["ratings"]:
    Severity: Major
    Found in websecmap/map/logic/improvements.py and 1 other location - About 3 days to fix
    websecmap/map/logic/improvements.py on lines 111..138

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

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

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

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

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

    Refactorings

    Further Reading

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

        for urlrating in oldest_urlratings:
    
            if "ratings" in urlrating.calculation:
                for rating in urlrating.calculation["ratings"]:
                    if rating["type"] not in old_measurement:
    Severity: Major
    Found in websecmap/map/logic/improvements.py and 1 other location - About 3 days to fix
    websecmap/map/logic/improvements.py on lines 80..108

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

    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 generate_username():
        # generate nice names like docker container names
        # https://github.com/moby/moby/blob/master/pkg/namesgenerator/names-generator.go
    
        # slightly redacted list to make all names always positive.
    Severity: Major
    Found in websecmap/app/admin.py and 1 other location - About 3 days to fix
    websecmap/game/admin.py on lines 274..602

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

    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 generate_team_name_docker():
        # generate nice names like docker container names
        # https://github.com/moby/moby/blob/master/pkg/namesgenerator/names-generator.go
    
        # slightly redacted list to make all names always positive.
    Severity: Major
    Found in websecmap/game/admin.py and 1 other location - About 3 days to fix
    websecmap/app/admin.py on lines 193..521

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

    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

    class ScannerTaskCommand(TaskCommand):
        """Generic Task Command for scanners."""
    
        scanner_module = None
    
    
    Severity: Major
    Found in websecmap/app/management/commands/_private.py and 1 other location - About 3 days to fix
    websecmap/app/management/commands/_private.py on lines 146..209

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

    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

    class GenericTaskCommand(TaskCommand):
        """Generic Task Command for scanners."""
    
        scanner_module = None
    
    
    Severity: Major
    Found in websecmap/app/management/commands/_private.py and 1 other location - About 3 days to fix
    websecmap/app/management/commands/_private.py on lines 214..277

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

    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

    Function calculate_high_level_stats has a Cognitive Complexity of 116 (exceeds 5 allowed). Consider refactoring.
    Open

    def calculate_high_level_stats(days: int = 1, countries: List = None, organization_types: List = None):
        log.info("Creating high_level_stats")
    
        map_configurations = filter_map_configs(countries=countries, organization_types=organization_types)
    
    
    Severity: Minor
    Found in websecmap/map/report.py - About 2 days to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    File settings.py has 892 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """Django settings for websecmap project.
    
    You do not need to edit the settings listed below.
    
    For example, you should not need to change the DEBUG setting here, ever. For this you can use
    Severity: Major
    Found in websecmap/settings.py - About 2 days to fix

      File test_internet_nl_v2.py has 839 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import logging
      from copy import copy
      from datetime import datetime, timedelta
      
      from websecmap.organizations.models import Url
      Severity: Major
      Found in websecmap/scanners/tests/test_internet_nl_v2.py - About 2 days to fix

        File report.py has 804 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import logging
        from collections import defaultdict
        from copy import copy, deepcopy
        from datetime import datetime
        from typing import List, Union
        Severity: Major
        Found in websecmap/reporting/report.py - About 1 day to fix

          File internet_nl_v2_websecmap.py has 752 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          """
          Web Security Map implementation of internet.nl scans.
          """
          
          import hashlib
          Severity: Major
          Found in websecmap/scanners/scanner/internet_nl_v2_websecmap.py - About 1 day to fix

            Function create_url_reports has a Cognitive Complexity of 87 (exceeds 5 allowed). Consider refactoring.
            Open

            def create_url_reports(url: Url) -> List[UrlReport]:
                timeline = create_timeline(url)
                url_reports: List[Union[UrlReport, None]] = []
            
                """
            Severity: Minor
            Found in websecmap/reporting/report.py - About 1 day to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            File admin.py has 745 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import logging
            import re
            import urllib
            from datetime import datetime, timedelta
            from random import choice, choices, randint
            Severity: Major
            Found in websecmap/game/admin.py - About 1 day to fix

              File report.py has 715 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import calendar
              import logging
              from collections import OrderedDict
              from copy import deepcopy
              from datetime import date, datetime, timedelta
              Severity: Major
              Found in websecmap/map/report.py - About 1 day to fix

                File views.py has 711 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import logging
                from datetime import datetime
                
                import pytz
                import simplejson as json
                Severity: Major
                Found in websecmap/game/views.py - About 1 day to fix

                  File openstreetmap.py has 690 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import gzip
                  import json
                  import logging
                  import os.path
                  import re
                  Severity: Major
                  Found in websecmap/map/logic/openstreetmap.py - About 1 day to fix

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

                        assert fourth_report.calculation == {
                            "endpoint_issues_high": 0,
                            "endpoint_issues_low": 0,
                            "endpoint_issues_medium": 0,
                            "endpoints": [
                    Severity: Major
                    Found in websecmap/reporting/tests/test_create_url_report.py and 1 other location - About 1 day to fix
                    websecmap/reporting/tests/test_create_url_report.py on lines 251..326

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

                    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