failmap/admin

View on GitHub

Showing 577 of 577 total issues

Avoid too many return statements within this function.
Open

    return True
Severity: Major
Found in websecmap/map/logic/admin.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return standard_calculation_for_internet_nl(scan=scan, explanation=scan.explanation, error_in_test=True)
    Severity: Major
    Found in websecmap/reporting/severity.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return operation_response(
      Severity: Major
      Found in websecmap/map/logic/admin.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return standard_calculation(scan=scan, explanation=f"{scan.rating} {scan.evidence}", high=0, medium=1, low=0)
        Severity: Major
        Found in websecmap/reporting/severity.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return standard_calculation(scan=scan, explanation=explanation, high=0, medium=1, low=0)
          Severity: Major
          Found in websecmap/reporting/severity.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return '0.0.0'
            Severity: Major
            Found in setup.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return True
              Severity: Major
              Found in websecmap/api/views.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return existing_second_level_url.add_subdomain(extracted.subdomain, "added via SIDN")
                Severity: Major
                Found in websecmap/api/apis/sidn.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return operation_response(error=True, message="No longitude given, cannot add organization.")
                  Severity: Major
                  Found in websecmap/map/logic/admin.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return operation_response(error=True, message="Latitude is between -180 and 180.")
                    Severity: Major
                    Found in websecmap/map/logic/admin.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return response
                      Severity: Major
                      Found in websecmap/map/logic/admin.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                            return amount_of_issues, judgement_issues
                        Severity: Major
                        Found in websecmap/reporting/report.py - About 30 mins to fix

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

                                  scans = list(
                                      EndpointGenericScan.objects.all().filter(
                                          endpoint__url__urlsubmission__added_by_team=team.id,
                                          endpoint__url__urlsubmission__has_been_accepted=True,
                                          rating_determined_on__lte=contest.until_moment,
                          Severity: Minor
                          Found in websecmap/game/views.py and 1 other location - About 30 mins to fix
                          websecmap/game/views.py on lines 194..198

                          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

                                  scans += list(
                                      UrlGenericScan.objects.all().filter(
                                          url__urlsubmission__added_by_team=team.id,
                                          url__urlsubmission__has_been_accepted=True,
                                          rating_determined_on__lte=contest.until_moment,
                          Severity: Minor
                          Found in websecmap/game/views.py and 1 other location - About 30 mins to fix
                          websecmap/game/views.py on lines 185..189

                          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

                          Function compose_discover_task has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def compose_discover_task(urls: List[Url]):
                              tasks = []
                          
                              for ip_version in [4, 6]:
                                  for port in PREFERRED_PORT_ORDER:
                          Severity: Minor
                          Found in websecmap/scanners/scanner/http.py - About 25 mins 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

                          Function accept has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def accept(self, request, queryset):
                                  for urlsubmission in queryset:
                          
                                      # don't add the same thing over and over, allows to re-select the ones already added without a problem
                                      # once rejected, can't be accepted via buttons: needs to be a manual action
                          Severity: Minor
                          Found in websecmap/game/admin.py - About 25 mins 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

                          Function handle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def handle(self, *args, **options):
                                  """Command handle logic, eg: logging."""
                                  # set django loglevel based on `-v` argument
                                  verbosity = int(options["verbosity"])
                                  root_logger = logging.getLogger("")
                          Severity: Minor
                          Found in websecmap/app/management/commands/_private.py - About 25 mins 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

                          Function validate_record has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def validate_record(record):
                          
                              if not record.get("Name", ""):
                                  ValueError('Missing "Name" column or column was empty.')
                          
                          
                          Severity: Minor
                          Found in websecmap/organizations/datasources/excel.py - About 25 mins 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

                          Function pickup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def pickup(activity: str, scanner: str, amount: int = 10) -> List[Url]:
                              """
                              Amount should not be too high: then this loses it's power and make scans invisible again. But it helps
                              with faster scanning as fewer queries are needed.
                          
                          
                          Severity: Minor
                          Found in websecmap/scanners/plannedscan.py - About 25 mins 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

                          Function update_feature has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def update_feature(feature, scan):
                              # log.debug('Updating feature %s, with scan %s' % (feature['properties']['organization_id'], scan))
                              calculation = get_severity(scan)
                          
                              feature["properties"]["high"] += calculation["high"]
                          Severity: Minor
                          Found in websecmap/game/views.py - About 25 mins 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

                          Severity
                          Category
                          Status
                          Source
                          Language