cea-sec/miasm

View on GitHub
miasm/analysis/expression_range.py

Summary

Maintainability
B
5 hrs
Test Coverage

Function expr_range has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

def expr_range(expr):
    """Return a ModularIntervals containing the range of possible values of
    @expr"""
    max_bound = (1 << expr.size) - 1
    if expr.is_int():
Severity: Minor
Found in miasm/analysis/expression_range.py - About 3 hrs 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

Avoid too many return statements within this function.
Open

            return - expr_range(expr.args[0])
Severity: Major
Found in miasm/analysis/expression_range.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return ModularIntervals(expr.size, [(0, max_bound)])
    Severity: Major
    Found in miasm/analysis/expression_range.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return reduce(
      Severity: Major
      Found in miasm/analysis/expression_range.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                        return op % mod.intervals.hull()[0]
        Severity: Major
        Found in miasm/analysis/expression_range.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return expr_range(expr.src1).union(expr_range(expr.src2))
          Severity: Major
          Found in miasm/analysis/expression_range.py - About 30 mins to fix

            There are no issues that match your filters.

            Category
            Status