Showing 77 of 198 total issues
Method SelectSampler
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void SelectSampler(SelectSamplerType? selectSamplerType)
{
SamplerType samplerType;
switch (selectSamplerType)
{
Method GetCurrentSettings
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
internal Core.Settings.Optimize GetCurrentSettings(bool computeAutoValue = false)
{
TLog.MethodStart();
var sampler = new Sampler
{
Method GetTrial
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public Trial.Trial GetTrial(int trialId)
{
var trial = new Trial.Trial();
using (var connection = new SQLiteConnection(_sqliteConnection.ToString()))
{
Method ToPython
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public dynamic ToPython(SamplerType type, string storagePath, bool hasConstraints, PyDict cmaEsX0)
{
TLog.MethodStart();
dynamic optunaSampler;
switch (type)
Method SolveInstance
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected override void SolveInstance(IGH_DataAccess DA)
{
CheckVariablesInput(Params.Input[0].Sources.Select(ghParam => ghParam.InstanceGuid));
CheckObjectivesInput(Params.Input[1].Sources.Select(ghParam => ghParam.InstanceGuid));
CheckArtifactsInput(Params.Input[3].Sources.Select(ghParam => ghParam.InstanceGuid));
Method SetInputSliderValues
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void SetInputSliderValues(List<VariableBase> variables)
{
TLog.MethodStart();
int i = 0;
Method StorageLoadTest
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
[Theory]
[InlineData(@"TestFile/sqlite.db", "sqlite")]
[InlineData(@"TestFile/journal.log", "log")]
public void StorageLoadTest(string path, string type)
{
Method CreateNewStudy
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public int CreateNewStudy(StudyDirection[] studyDirections, string studyName)
{
long maxLength;
using (var connection = new SQLiteConnection(_sqliteConnection.ToString()))
{
Method Solve
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public void Solve()
{
TLog.MethodStart();
EndState = EndState.Error;
OptimizeProcess.IsForcedStopOptimize = false;
Method CheckOptimizeComplete
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private bool CheckOptimizeComplete(OptimizationHandlingInfo optInfo, int trialNum, DateTime startTime)
{
TLog.MethodStart();
int nTrials = optInfo.NTrials;
Method ToPython
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public dynamic ToPython()
{
TLog.MethodStart();
dynamic optunaPruner;
dynamic optuna = Py.Import("optuna");
Method GetAllStudySummaries
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static StudySummary[] GetAllStudySummaries(IOptunaStorage storage)
{
Study[] studies = storage.GetAllStudies();
var studySummaries = new StudySummary[studies.Length];
for (int i = 0; i < studies.Length; i++)
Function add_row_in_attr
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
def add_row_in_attr(trial: FrozenTrial, row: list[str]) -> None:
for value in trial.user_attrs.values():
if value is None:
continue
if isinstance(value, int) or isinstance(value, 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
Function set_in_attr_label
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
def set_in_attr_label(label: list[str], trials: list[FrozenTrial]) -> None:
for key, value in trials[0].user_attrs.items():
if value is None:
continue
- 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
Method SetSliderValues
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void SetSliderValues(decimal[] parameters)
{
TLog.MethodStart();
int i = 0;
Method GetAttrs
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static void GetAttrs(Dictionary<string, object> attrs, SQLiteDataReader reader)
{
string key = reader.GetString(0);
string value = reader.GetString(1);
if (!string.IsNullOrEmpty(value) && value.Contains("[") && value.Contains("]"))
Method ShowUIEndMessages
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static MessageBoxResult ShowUIEndMessages(EndState endState, bool isMultiObjective)
{
TLog.MethodStart();
MessageBoxResult msgResult;
MessageBoxButton button = isMultiObjective ? MessageBoxButton.OK : MessageBoxButton.YesNo;
Method SelectItemUnsafe
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public void SelectItemUnsafe(int index)
{
if (index < 0 || index >= ListItems.Count)
{
return;
Method GetAllStudies
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public Study.Study[] GetAllStudies()
{
using (var connection = new SQLiteConnection(_sqliteConnection.ToString()))
{
connection.Open();
Method RunAsync
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
internal async static Task RunAsync(OptimizeViewModel optimizeViewModel)
{
TLog.MethodStart();
SharedItems.Component?.GhInOutInstantiate();
SharedItems.OptimizeViewModel = optimizeViewModel;