tools/testing/selftests/bpf/test_bpftool_synctypes.py
File test_bpftool_synctypes.py
has 486 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
#!/usr/bin/env python3
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
#
# Copyright (C) 2021 Isovalent, Inc.
Function main
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def main():
# No arguments supported at this time, but print usage for -h|--help
argParser = argparse.ArgumentParser(description="""
Verify that bpftool's code, help messages, documentation and bash
completion are all in sync on program types, map types, attach types, and
Function parse
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def parse(self, pattern, end_marker):
"""
Parse a block and return a set of values. Values to extract must be
on separate lines in the file.
@pattern: pattern used to identify the values to extract
- 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 parse
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def parse(self):
"""
Parse a block and return data as a dictionary. Items to extract must be
on separate lines in the file.
"""
- 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"