Function collect_results
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
def collect_results(self) -> None:
# TODO: collect run time + check collected_at
for sample in self.samples:
if sample.collect_flag == CollectFlag.WAITING_FOR_SIMILAR:
- 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 experiment.py
has 304 lines of code (exceeds 250 allowed). Consider refactoring. Open
import math
import yaml
import os
import re
import pathlib
Function manual_run
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def manual_run(self, hyperparam_values: HyperparamValues,
model_params: ModelParameters) -> Tuple[Sample, bool]:
assert isinstance(hyperparam_values, HyperparamValues)
output_dir_path = pathlib.Path("output")
- 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
with open(fname, "r") as f:
contents = f.read().rstrip("\n")
found = False
for line in contents.split("\n"):
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, task_name: str, batch_name: Optional[str],
Function from_dict
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def from_dict(data: dict) -> "Experiment":
hyperparameters = \
[Hyperparameter.from_dict(key, data["hyperparameters"][key])
for key in data["hyperparameters"].keys()]
- 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
TODO found Open
# TODO: gpy pouzito na 2 mistech?
- Exclude checks
TODO found Open
# TODO: finished samples only?
- Exclude checks
TODO found Open
# TODO: overit, ze by to fungovalo i na ok+running a mean_pred
- Exclude checks
TODO found Open
# TODO: set this at a proper global place
- Exclude checks
XXX found Open
data["task_name"] = "XXX"
- Exclude checks
XXX found Open
data["batch_name"] = "XXX"
- Exclude checks
TODO found Open
# TODO: remove once the new implementation is tested
- Exclude checks
TODO found Open
# TODO: opravit:
- Exclude checks
TODO found Open
# TODO: collect run time + check collected_at
- Exclude checks