DownloadableFiles
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class DownloadableFiles(CommonColumns):
"""
Store required fields from:
https://github.com/CIMAC-CIDC/cidc-schemas/blob/master/cidc_schemas/schemas/artifacts/artifact_core.json
"""
Function _change_download_permissions
has a Cognitive Complexity of 19 (exceeds 10 allowed). Consider refactoring. Open
def _change_download_permissions(
trial_id: str, upload_type: str, grant: bool, session: Session
) -> None:
"""
Allows for widespread granting/revoking of existing download permissions in GCS ACL
- 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 insert
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring. Open
def insert(
self,
session: Session,
commit: bool = True,
) -> 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
Function create
has 8 arguments (exceeds 6 allowed). Consider refactoring. Open
def create(
Function create_from_blob
has 7 arguments (exceeds 6 allowed). Consider refactoring. Open
def create_from_blob(
Function is_valid_transition
has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring. Open
def is_valid_transition(
cls, current: str, target: str, is_manifest: bool = False
) -> bool:
"""
Enforce logic about which state transitions are valid. E.g.,
- 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 True
Function build_file_filter
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
def build_file_filter(
trial_ids: List[str] = [], facets: List[List[str]] = [], user: Users = None
) -> Callable[[Query], Query]:
"""
Build a file filter function based on the provided parameters. The resultant
- 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 list
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Wontfix
def list(
cls,
session: Session,
include_file_bundles: bool = False,
include_counts: bool = 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"