Showing 136 of 136 total issues
Function run
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
def run(web_type, args) -> None:
script_dir = os.path.dirname(os.path.abspath(inspect.stack()[0][1]))
app = Flask(__name__, template_folder=os.path.join(script_dir, "..", "templates"))
app.debug = True
- 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 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
Function run
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
def run(args) -> None:
# TODO: acquire in the same with?
with handle_cd_revertible(args.dir):
with acquire_lock():
experiment = Experiment.deserialize()
- 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 main
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def main():
# Fix random seed
np.random.seed(42)
# Parse arguments
- 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
File basic_types.py
has 293 lines of code (exceeds 250 allowed). Consider refactoring. Open
import abc
import math
import logging
from typing import Union, NamedTuple, List, Tuple
File web.py
has 290 lines of code (exceeds 250 allowed). Consider refactoring. Open
import inspect
import os
from collections import defaultdict
import math
import logging
Function plot_objective
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def plot_objective(model, x_slice, x_next, plot_limits, vmin, vmax,
hyperparameters, outer_grid, fig,
acq, zscale='linear', dimensions=None) -> None:
"""
* `zscale` [str, default='linear']
- 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 _maybe_discretize
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def _maybe_discretize(self, observation):
if self._separators is not None:
state = 0
for i in range(len(self._separators)):
state *= 1 + len(self._separators[i])
- 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 run_main
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run_main(args):
parser = argparse.ArgumentParser(prog="bopt")
parser.set_defaults()
cd_parser = argparse.ArgumentParser(add_help=None)
Function run
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def run(args) -> None:
pathlib.Path(args.dir).mkdir(parents=True, exist_ok=True)
pathlib.Path(os.path.join(args.dir, "output")).mkdir(parents=True, exist_ok=True)
with handle_cd_revertible(args.dir):
- 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 __init__
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, env, separators=None, tiles=None):
self._env = gym.make(env)
self._env.seed(42)
self._workers = None
- 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 create_slice_2d
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def create_slice_2d(i: int, j: int, experiment: bopt.Experiment,
resolution: int, n_dims: int, x_slice: List[float], model: GPy.models.GPRegression,
sample: bopt.Sample, show_marginal: int) -> Slice2D:
p1 = experiment.hyperparameters[i]
- 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 plot_objective
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
def plot_objective(model, x_slice, x_next, plot_limits, vmin, vmax,
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
Function create_slice_1d
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def create_slice_1d(i: int, experiment: bopt.Experiment, resolution: int,
n_dims: int, x_slice: List[float], model: GPy.models.GPRegression, sample: bopt.Sample,
show_marginal: int) -> Slice1D:
param = experiment.hyperparameters[i]
- 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 run
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def run(args) -> None:
# TODO: this is completely outdated and broken at this point
raise NotImplementedError()
with handle_cd_revertible(args.dir):
- 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 create_slice_2d
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_slice_2d(i: int, j: int, experiment: bopt.Experiment,
Function __init__
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self,
Function __str__
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def __str__(self) -> str:
from colored import fg, bg, attr
if self.job:
s = f"{self.job.job_id}\t"
- 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"