Showing 19 of 35 total issues
File recondition.py
has 482 lines of code (exceeds 250 allowed). Consider refactoring. Open
from abc import ABC
from dataclasses import dataclass
from dataclasses import field
from inspect import isclass
from typing import Generic
Function resolve_operands
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
def resolve_operands(
opcode_class: type[OpCode],
operands: list[str],
opcode_lookup_table: dict[str, OpCode],
) -> tuple[OpCode | str | int | float, ...]:
- 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
File context.py
has 361 lines of code (exceeds 250 allowed). Consider refactoring. Open
import inspect
import random
from dataclasses import dataclass
from dataclasses import field
from types import NoneType
File shader_utils.py
has 354 lines of code (exceeds 250 allowed). Consider refactoring. Open
import random
import subprocess
import tempfile
from dataclasses import field
from enum import Enum
Function start
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def start(self):
MP_pool: Pool = multiprocessing.Pool(4, init_MP_pool)
thread_pool_executor: ThreadPoolExecutor = ThreadPoolExecutor(max_workers=4)
if self.config.misc.broadcast_generated_shaders:
- 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 recondition
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def recondition(
context: Context,
opcode: UndefOpCodeVulnerableOpCode,
) -> ReconditioningEffects:
if not isclass(opcode):
- 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 fuzz
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def fuzz(cls, context: "Context") -> FuzzResult[Self]:
(
source_type,
destination_type,
source_constraint,
- 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 fuzz_block
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def fuzz_block(
context: "Context",
exit_label: Optional[OpLabel],
limiter: Optional[int] = 4096,
) -> tuple[OpCode]:
- 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 fuzz
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def fuzz(cls, context: "Context") -> FuzzResult[Self]:
(
source_type,
destination_type,
source_constraint,
- 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 gen_shader
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def gen_shader(self) -> SPIRVShader:
execution_model = ExecutionModel.GLCompute
context: Context = Context.create_global_context(execution_model, self.config)
void_type: OpTypeVoid = OpTypeVoid()
main_type: OpTypeFunction = OpTypeFunction(
Function gen_constants
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def gen_constants(self):
n_constants = self.config.limits.n_constants
n_scalars = (
self.config.strategy.w_scalar_constant
* n_constants
- 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 to_spasm
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def to_spasm(self, context: "Context") -> str:
attrs = self.members()
if self.__class__.__name__ == "OpStore":
pass
if isinstance(self, VoidOp):
- 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 resolve_attribute_spasm
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def resolve_attribute_spasm(self, attr, context: "Context") -> str:
if (
attr.__class__.__name__ == "Context"
or attr is None
or attr.__class__.__name__ == "EmptyType"
- 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
Avoid deeply nested control flow statements. Open
if resolved_operand == "None":
resolved_operand = "NONE"
resolved_operand = enum_class(resolved_operand)
Function create_on_demand_numerical_constant
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_on_demand_numerical_constant(
Function is_interesting
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def is_interesting(spv_file_path: str, n_reports: int) -> int:
if validate_spv_file(spv_file_path).exit_code != 0:
return 1
with NamedTemporaryFile(suffix=".spasm") as disassembled_spasm_file:
if not disassemble_spv_file(spv_file_path, disassembled_spasm_file.name):
- 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
Avoid too many return
statements within this function. Open
return 1
Function gen_global_variables
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def gen_global_variables(self):
n = len(self.globals)
for i in range(self.rng.randint(1, 3)):
variable = self.create_on_demand_variable(StorageClass.StorageBuffer)
if len(self.globals) != n:
- 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 gen_types
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def gen_types(self):
for _ in range(self.config.limits.n_types - 1):
try:
fuzzed_type: FuzzResult = Type.fuzz(self)
except (RecursionError, AbortFuzzing):
- 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"