Showing 16 of 16 total issues
File core.py
has 603 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Provides common base classes that allow modules to talk to each other."""
from dataclasses import dataclass
from datetime import date, datetime
from enum import Enum, IntEnum
from itertools import chain
File qido_rs.py
has 340 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Models QIDO-RS: Query based on ID for dicom Objects by Restful Services.
See: [QIDO-RS reference](https://www.dicomstandard.org/using/dicomweb/query-qido-rs/)
and [QIDO-RS at NEMA]
File rad69.py
has 325 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Retrieve data from servers using the rad69 protocol
see [rad69 document set]
(https://gazelle.ihe.net/content/rad-69-retrieve-imaging-document-set)
And the corresponding [transaction]
File datastructures.py
has 311 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Additional datastructures that do not belong to any specific dicomtrolley
class or function
"""
from datetime import datetime
Function prune_all
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def prune_all( # noqa: C901 # not too complex I think. Just elifs
self,
addresses: List[TreeAddress],
strategy: PruneStrategy = PruneStrategy.WHERE_POSSIBLE,
):
- 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 mint.py
has 267 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Models the MINT DICOM exchange protocol
See:
https://code.google.com/archive/p/medical-imaging-network-transport/downloads
"""
from typing import ClassVar, List, Sequence, Set
File caching.py
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Storing DICOM query results locally to avoid unneeded calls to server"""
from typing import Dict, Iterable, List, Optional, Sequence, Tuple
from dicomtrolley.core import (
Function send_c_find
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def send_c_find(self, query):
"""Perform a CFIND with the given query
Raises
------
- 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 get_dicom_qr_trolley
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_dicom_qr_trolley(
Function get_mint_trolley
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_mint_trolley(
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function __next__
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def __next__(self):
sized_chunk = bytearray()
while len(sized_chunk) < self.chunk_size:
try:
sized_chunk += next(self._chunk_iterator)
- 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 prune_leaf
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def prune_leaf(self, address: TreeAddress):
"""Prune node at this address only if it has no children
Raises
------
- 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 too many return
statements within this function. Open
return part
Function __init__
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __init__(
self,
initial_objects: Optional[List[DICOMObject]] = None,
expiry_seconds: Optional[int] = 600,
):
- 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"