website/analyses/motifs.py
Function gather_muts_and_sites
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
Open
def gather_muts_and_sites(
self, mutations: BaseQuery, sites: BaseQuery,
show_progress=True, occurrences_in: List[MutationSource] = None, intersection=None
) -> MotifsData:
"""If occurrences_in is provided, the count of mutations will
- 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 count_by_sources
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def count_by_sources(
Avoid deeply nested control flow statements. Open
Open
if is_affected(mutated_sequence, motif):
sites_with_broken_motif[motif_name].add(site)
muts_breaking_sites_motif[motif_name][mutation] = count
Function count_by_active_driver
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def count_by_active_driver(
Function gather_muts_and_sites
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def gather_muts_and_sites(
Function select_sites_with_motifs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def select_sites_with_motifs(sites: Iterable, motifs) -> Mapping[MotifName, set]:
sites_with_motif = defaultdict(set)
for site in sites:
- 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"