Showing 21 of 102 total issues
File models.py
has 360 lines of code (exceeds 250 allowed). Consider refactoring. Open
from decimal import Decimal
from django.contrib.auth import get_user_model
from django.contrib.gis.db import models
from django.contrib.gis.geos import Point
Function handle
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def handle(self, *args, **options):
self.stdout.write("Import repeater from repeatermap.de")
r = requests.get(options['url'], stream=False)
if r.ok:
- 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
Function handle
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def handle(self, *args, **options):
r = requests.get(options['url'], stream=False)
if r.ok:
repeaters = r.json()
for repeater in repeaters:
- 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
Function handle
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def handle(self, *args, **options):
r = requests.get(options['url'], stream=False)
if r.ok:
data = BytesIO(r.content)
- 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
Function finland
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def finland(self):
# Based on https://github.com/OH6AD/koolit
url: str = "https://eservices.viestintavirasto.fi/Licensesservices/Forms/AmateurLicenses.aspx"
payload: dict = {'__EVENTTARGET': '', 'ButtonDownload': ''}
callsigns = list()
- 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
Function run
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def run(self, url):
r = self.session.get(url, stream=False)
if r.status_code != 200:
raise Exception(f"Failed to download {url} status code {r.status_code}")
- 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
Function grid_to_point
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def grid_to_point(grid: str) -> Point:
"""
Converts Maidenhead locator in the corresponding WGS84 coordinates
Based on https://github.com/dh1tw/pyhamtools/blob/master/pyhamtools/locator.py
"""
- 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
Function germany
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def germany(self):
# update v parameter?
url: str = "https://www.bundesnetzagentur.de/SharedDocs/Downloads/DE/Sachgebiete/Telekommunikation/Unternehmen_Institutionen/Frequenzen/Amateurfunk/Rufzeichenliste/Rufzeichenliste_AFU.pdf?__blob=publicationFile&v=51"
regex = re.compile(r"D[A-Z][0-9][A-Z0-9]+")
callsigns = list()
- 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
Function address_to_point
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def address_to_point(address: str, provider: str = "arcgis", session=None, use_cache: bool = True) -> Point:
# use provider string as function name
_geocoder = getattr(geocoder, provider)
AddressLocationCache = apps.get_model('callsign', 'AddressLocationCache')
- 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
Function _handle_callsign
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _handle_callsign(self, callsign: str, source: str = "", official: bool = False, return_instance: bool = True) -> Tuple[Callsign, bool]:
self._callsign_counter += 1
raw_callsign = extract_callsign(callsign)
if not raw_callsign:
- 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
Function _filter_callsigns_bulk_create
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _filter_callsigns_bulk_create(self, callsigns: Iterable[str], extra_fields=None, source: str = "", official: bool = False) -> Iterator[Callsign]:
"""Create a list of Callsign instances from dirty callsigns.
Filter out already existing, blacklisted and invalid callsigns.
- 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
Function dispatch
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def dispatch(self, request, *args, **kwargs):
# Create an Repeater instance if does not exist
try:
self.get_object()
except Http404:
- 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
Function dispatch
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def dispatch(self, request, *args, **kwargs):
# Create an Club instance if does not exist
try:
self.get_object()
except Http404:
- 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
Function amateurradio_digital
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def amateurradio_digital(self, options):
self._write("Import amateurradio.digital data")
r = self.session.get(options['url'], stream=False)
- 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
Function _callsign_bulk_create
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _callsign_bulk_create(self, callsigns: Iterable[str], extra_fields=None, source: str = "", official: bool = False) -> List[Callsign]:
"""Create callsigns and set default meta data
Takes a list of dirty callsigns and adds the ones missing from database. Also set the default meta data, e.g.
prefix, location,...
- 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
Avoid deeply nested control flow statements. Open
for attr, a_value in clublog_user_data.items():
setattr(clublog_instance, attr, a_value)
clublog_instance.save()
Avoid deeply nested control flow statements. Open
if not callsign_instance._official_validated:
callsign_instance._official_validated = True
callsign_instance.save()
Function address_to_grid_based_point
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def address_to_grid_based_point(address: str,
Function validate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate(self, attrs):
username = attrs.get('username')
password = attrs.get('password')
if username and password:
- 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
Function extract_callsign
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def extract_callsign(value: str) -> str:
value: str = value.replace(" ", "").upper()
callsign: str = ""
if CALLSIGN_REGEX_COMPILE.search(value):
- 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"