hrntsm/Tunny

View on GitHub

Feature/improve log loading
#424

hrntsm wants to merge feature/improve-log-loading into develop
Failed
12 issues to fix.

Showing 12 of 12 total issues

Method ProcessLogEntry has a Cognitive Complexity of 52 (exceeds 20 allowed). Consider refactoring.
New

private void ProcessLogEntry(JournalOperation opCode, JObject logObject)
{
switch (opCode)
{
case JournalOperation.CreateStudy:
Severity: Minor
Found in Optuna/Storage/Journal/Storage.cs - About 5 hrs to fix

Method LoadDataFromFile has 29 lines of code (exceeds 25 allowed). Consider refactoring.
New

private void LoadDataFromFile()
{
const int BufferSize = 65536;
var jsonBatch = new List<string>(1000);
 
 
Severity: Minor
Found in Optuna/Storage/Journal/Storage.cs - About 1 hr to fix

    Method ProcessLogEntry has 139 lines of code (exceeds 25 allowed). Consider refactoring.
    New

    private void ProcessLogEntry(JournalOperation opCode, JObject logObject)
    {
    switch (opCode)
    {
    case JournalOperation.CreateStudy:
    Severity: Major
    Found in Optuna/Storage/Journal/Storage.cs - About 5 hrs to fix

      Similar blocks of code found in 4 locations. Consider refactoring.
      New

      public void SetStudySystemAttr(int studyId, string key, object value)
      {
      EnsureInitialized();
       
      if (!_studies.TryGetValue(studyId, out Study.Study study))
      Severity: Major
      Found in Optuna/Storage/Journal/Storage.cs and 3 other locations - About 50 mins to fix
      Optuna/Storage/Journal/Storage.cs on lines 573..583
      Optuna/Storage/Journal/Storage.cs on lines 620..630
      Optuna/Storage/Journal/Storage.cs on lines 632..642

      Similar blocks of code found in 4 locations. Consider refactoring.
      New

      public void SetStudyUserAttr(int studyId, string key, object value)
      {
      EnsureInitialized();
       
      if (!_studies.TryGetValue(studyId, out Study.Study study))
      Severity: Major
      Found in Optuna/Storage/Journal/Storage.cs and 3 other locations - About 50 mins to fix
      Optuna/Storage/Journal/Storage.cs on lines 561..571
      Optuna/Storage/Journal/Storage.cs on lines 620..630
      Optuna/Storage/Journal/Storage.cs on lines 632..642

      Similar blocks of code found in 4 locations. Consider refactoring.
      New

      public void SetTrialSystemAttr(int trialId, string key, object value)
      {
      EnsureInitialized();
       
      if (!_trialCache.TryGetValue(trialId, out Trial.Trial trial))
      Severity: Major
      Found in Optuna/Storage/Journal/Storage.cs and 3 other locations - About 50 mins to fix
      Optuna/Storage/Journal/Storage.cs on lines 561..571
      Optuna/Storage/Journal/Storage.cs on lines 573..583
      Optuna/Storage/Journal/Storage.cs on lines 632..642

      Similar blocks of code found in 4 locations. Consider refactoring.
      New

      public void SetTrialUserAttr(int trialId, string key, object value)
      {
      EnsureInitialized();
       
      if (!_trialCache.TryGetValue(trialId, out Trial.Trial trial))
      Severity: Major
      Found in Optuna/Storage/Journal/Storage.cs and 3 other locations - About 50 mins to fix
      Optuna/Storage/Journal/Storage.cs on lines 561..571
      Optuna/Storage/Journal/Storage.cs on lines 573..583
      Optuna/Storage/Journal/Storage.cs on lines 620..630

      Similar blocks of code found in 3 locations. Consider refactoring.
      New

      public Dictionary<string, object> GetTrialParams(int trialId)
      {
      EnsureInitialized();
       
      if (!_trialCache.TryGetValue(trialId, out Trial.Trial trial))
      Severity: Major
      Found in Optuna/Storage/Journal/Storage.cs and 2 other locations - About 1 hr to fix
      Optuna/Storage/Journal/Storage.cs on lines 532..542
      Optuna/Storage/Journal/Storage.cs on lines 544..554

      Similar blocks of code found in 3 locations. Consider refactoring.
      New

      public Dictionary<string, object> GetTrialSystemAttrs(int trialId)
      {
      EnsureInitialized();
       
      if (!_trialCache.TryGetValue(trialId, out Trial.Trial trial))
      Severity: Major
      Found in Optuna/Storage/Journal/Storage.cs and 2 other locations - About 1 hr to fix
      Optuna/Storage/Journal/Storage.cs on lines 520..530
      Optuna/Storage/Journal/Storage.cs on lines 544..554

      Similar blocks of code found in 3 locations. Consider refactoring.
      New

      public Dictionary<string, object> GetTrialUserAttrs(int trialId)
      {
      EnsureInitialized();
       
      if (!_trialCache.TryGetValue(trialId, out Trial.Trial trial))
      Severity: Major
      Found in Optuna/Storage/Journal/Storage.cs and 2 other locations - About 1 hr to fix
      Optuna/Storage/Journal/Storage.cs on lines 520..530
      Optuna/Storage/Journal/Storage.cs on lines 532..542

      Similar blocks of code found in 2 locations. Consider refactoring.
      New

      public Dictionary<string, object> GetStudySystemAttrs(int studyId)
      {
      EnsureInitialized();
       
      if (!_studies.TryGetValue(studyId, out Study.Study study))
      Severity: Minor
      Found in Optuna/Storage/Journal/Storage.cs and 1 other location - About 40 mins to fix
      Optuna/Storage/Journal/Storage.cs on lines 449..459

      Similar blocks of code found in 2 locations. Consider refactoring.
      New

      public Dictionary<string, object> GetStudyUserAttrs(int studyId)
      {
      EnsureInitialized();
       
      if (!_studies.TryGetValue(studyId, out Study.Study study))
      Severity: Minor
      Found in Optuna/Storage/Journal/Storage.cs and 1 other location - About 40 mins to fix
      Optuna/Storage/Journal/Storage.cs on lines 437..447
      Category
      Status
      FileMaintainability
      Optuna/Storage/Journal/Storage.cs
      D
      F
      +3 days