KarrLab/wc_rules

View on GitHub
wc_rules/expressions/executable.py

Summary

Maintainability
B
6 hrs
Test Coverage
C
79%

Function get_attribute_calls has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def get_attribute_calls(self):
        attrcalls = defaultdict(SortedSet)
        for c in self.execs:
            for k,v in c.deps.attribute_calls.items():
                attrcalls[k].update(v)
Severity: Minor
Found in wc_rules/expressions/executable.py - About 1 hr to fix

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_helper_calls has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def get_helper_calls(self):
        helpercalls = defaultdict(SortedSet)
        for c in self.execs:
            for fnametuple,kwargs in c.deps.function_calls.items():
                if len(fnametuple)==2:
Severity: Minor
Found in wc_rules/expressions/executable.py - About 1 hr to fix

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 initialize_from_strings has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize_from_strings(cls,strings,classes,cmax=0):
        d = dict()
        allowed_forms = '\n'.join([x for c in classes for x in c.allowed_forms])
        for s in strings:
            for c in classes:
Severity: Minor
Found in wc_rules/expressions/executable.py - About 1 hr to fix

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 __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(self,keywords,builtins,fn,code,deps):
Severity: Minor
Found in wc_rules/expressions/executable.py - About 35 mins to fix

    Function __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self,action_execs,factories):
            self.execs = action_execs
    
            for e in self.execs:
                for fnametuple in e.deps.function_calls:
    Severity: Minor
    Found in wc_rules/expressions/executable.py - About 25 mins to fix

    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 exec has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def exec(self,match,*dicts):
            for c in self.execs:
                actions = c.exec(match,*dicts)
                if hasattr(c,'build_variable'):
                    assert isinstance(actions[-1],CollectReferences)
    Severity: Minor
    Found in wc_rules/expressions/executable.py - About 25 mins to fix

    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

    There are no issues that match your filters.

    Category
    Status