File template.py
has 1001 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
"""The underlying data representation of an assay or shipping manifest template."""
import os
Function _convert_api_to_template
has a Cognitive Complexity of 94 (exceeds 10 allowed). Consider refactoring. Open
def _convert_api_to_template(name: str, schema: dict, assay_schema: dict):
# import here to avoid circular dependence where prism imports Template
from .prism.merger import InvalidMergeTargetException
# so many different ways of writing it
- 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 _first_in_context
has a Cognitive Complexity of 53 (exceeds 10 allowed). Consider refactoring. Open
def _first_in_context(path: list, context: dict):
"""
For matching a file path to its nearest equivalent key in a schema context
Recursive to try for more specific, more complex entries
- 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 _calc_merge_pointer
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring. Open
def _calc_merge_pointer(file_path: str, context: dict, key: str):
"""Return the merge_pointer in context that the file_path directs to
Params
------
- 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 process_field_value
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def process_field_value(
Function generate_all_templates
has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring. Open
def generate_all_templates(target_dir: str):
"""
Generate empty template .xlsx files for every available template schema and
write them to the target directory.
"""
- 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"