cea-sec/miasm

View on GitHub
miasm/analysis/cst_propag.py

Summary

Maintainability
B
4 hrs
Test Coverage

Function compute_cst_propagation_states has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def compute_cst_propagation_states(lifter, ircfg, init_addr, init_infos):
    """
    Propagate "constant expressions" in a function.
    The attribute "constant expression" is true if the expression is based on
    constants or "init" regs values.
Severity: Minor
Found in miasm/analysis/cst_propag.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 eval_updt_irblock has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def eval_updt_irblock(self, irb, step=False):
        """
        Symbolic execution of the @irb on the current state
        @irb: IRBlock instance
        @step: display intermediate steps
Severity: Minor
Found in miasm/analysis/cst_propag.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 is_expr_cst has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def is_expr_cst(lifter, expr):
    """Return true if @expr is only composed of ExprInt and init_regs
    @lifter: Lifter instance
    @expr: Expression to test"""

Severity: Minor
Found in miasm/analysis/cst_propag.py - About 45 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 add_state has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def add_state(ircfg, todo, states, addr, state):
Severity: Minor
Found in miasm/analysis/cst_propag.py - About 35 mins to fix

    There are no issues that match your filters.

    Category
    Status