trailofbits/protofuzz

View on GitHub

Showing 5 of 17 total issues

Function _fuzzdb_get_strings has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

def _fuzzdb_get_strings(max_len=0):
    """Return strings from fuzzdb."""
    ignored = ["integer-overflow"]

    for subdir in pkg_resources.resource_listdir("protofuzz", BASE_PATH):
Severity: Minor
Found in protofuzz/values.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

Function _prototype_to_generator has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def _prototype_to_generator(descriptor, cls):
    """Return map of descriptor to a protofuzz generator."""
    _fd = D.FieldDescriptor
    generator = None

Severity: Minor
Found in protofuzz/protofuzz.py - About 55 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 find_protoc has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def find_protoc(path=os.environ["PATH"]):
    """Traverse a path ($PATH by default) to find the protoc compiler."""
    protoc_filenames = ["protoc", "protoc.exe"]

    bin_search_paths = path.split(os.pathsep) or []
Severity: Minor
Found in protofuzz/pbimport.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 step_generator has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def step_generator(self, generators):
        if len(generators) < 1:
            yield ()
        else:
            first, rest = generators[0], generators[1:]
Severity: Minor
Found in protofuzz/gen.py - About 35 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 get_integers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def get_integers(bitwidth, unsigned, limit=0):
    """Return integers from fuzzdb database.

    bitwidth - The bitwidth that has to contain the integer
    unsigned - Whether the type is unsigned
Severity: Minor
Found in protofuzz/values.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

Severity
Category
Status
Source
Language