Showing 267 of 577 total issues
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
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)
- Read upRead up
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
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
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
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
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]] = []
"""
- Read upRead up
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
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
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
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
Function calculate_vulnerability_statistics
has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring. Open
def calculate_vulnerability_statistics(days: int = 366, countries: List = None, organization_types: List = None):
log.info("Calculation vulnerability graphs")
map_configurations = filter_map_configs(countries=countries, organization_types=organization_types)
- Read upRead up
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 views.py
has 608 lines of code (exceeds 250 allowed). Consider refactoring. Open
import json
import logging
from datetime import datetime
from wsgiref.util import FileWrapper
Function get_improvements
has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring. Open
def get_improvements(country, organization_type, weeks_back, weeks_duration):
# todo: adjustable timespan
# todo: adjustable weeks_back
weeks_back = int(weeks_back)
- Read upRead up
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 http.py
has 602 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
Scans for HTTP sites.
If there is a HTTP site on port 80, but there is not a TLS equivalent: give points.
Every http site that does want to instantly upgrade gets 10 points? (how to determine?)
File __init__.py
has 579 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
A list of all scan types that are reliable and can be used in production environments (reporting, etc).
If you want to add a new scanner, you'll have to go through the following steps.
- Add it to the correct list below (todo: automate discovery of what scanners are available)
File admin.py
has 570 lines of code (exceeds 250 allowed). Consider refactoring. Open
import importlib
import logging
from datetime import datetime
from json import loads
Function get_map_data
has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring. Open
def get_map_data(
country: str = "NL", organization_type: str = "municipality", days_back: int = 0, displayed_issue: str = None
):
# A bug in the live version (possibly due to |safe) gives a Country(code='NL')} instead of
- Read upRead up
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 531 lines of code (exceeds 250 allowed). Consider refactoring. Open
import string
from datetime import datetime, timedelta
from random import choice
import pytz
File models.py
has 515 lines of code (exceeds 250 allowed). Consider refactoring. Open
# coding=UTF-8
from datetime import datetime, timedelta
import pytz
from django.core.exceptions import ObjectDoesNotExist