hrntsm/Tunny

View on GitHub

Showing 185 of 198 total issues

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

        [Fact]
        public void DashboardCsvTest()
        {
            var reader = new CsvReader("TestFile/Dashboard.csv");
            int[] result = reader.ReadSelectionCsv(CsvType.Dashboard);
Severity: Major
Found in Tunny.CoreTests/Util/CsvReaderTests.cs and 1 other location - About 2 hrs to fix
Tunny.CoreTests/Util/CsvReaderTests.cs on lines 24..35

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 167.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

                    case JournalOperation.SetStudySystemAttr:
                        {
                            int studyId = (int)logObject["study_id"];
                            var systemAttr = (JObject)logObject["system_attr"];
                            foreach (KeyValuePair<string, JToken> item in systemAttr)
Severity: Major
Found in Optuna/Storage/Journal/Storage.cs and 1 other location - About 2 hrs to fix
Optuna/Storage/Journal/Storage.cs on lines 67..81

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 166.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

                    case JournalOperation.SetStudyUserAttr:
                        {
                            int studyId = (int)logObject["study_id"];
                            var userAttr = (JObject)logObject["user_attr"];
                            foreach (KeyValuePair<string, JToken> item in userAttr)
Severity: Major
Found in Optuna/Storage/Journal/Storage.cs and 1 other location - About 2 hrs to fix
Optuna/Storage/Journal/Storage.cs on lines 82..96

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 166.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

        [Theory]
        [InlineData("0.5", true)]
        [InlineData("1.0", true)]
        [InlineData("0.0", false)]
        [InlineData("1.1", false)]
Severity: Major
Found in Tunny.CoreTests/Input/InputValidatorTests.cs and 1 other location - About 2 hrs to fix
Tunny.CoreTests/Input/InputValidatorTests.cs on lines 39..52

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 158.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

        [Theory]
        [InlineData("1", true)]
        [InlineData("0", true)]
        [InlineData("-1", true)]
        [InlineData("auto", true)]
Severity: Major
Found in Tunny.CoreTests/Input/InputValidatorTests.cs and 1 other location - About 2 hrs to fix
Tunny.CoreTests/Input/InputValidatorTests.cs on lines 84..97

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 158.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method SelectSampler has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        private void SelectSampler(SelectSamplerType? selectSamplerType)
        {
            SamplerType samplerType;
            switch (selectSamplerType)
            {
Severity: Major
Found in Tunny/WPF/ViewModels/MainWindowViewModel.cs - About 2 hrs to fix

    Method GetCurrentSettings has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            internal Core.Settings.Optimize GetCurrentSettings(bool computeAutoValue = false)
            {
                TLog.MethodStart();
                var sampler = new Sampler
                {
    Severity: Major
    Found in Tunny/WPF/ViewModels/Optimize/OptimizeViewModel.cs - About 2 hrs to fix

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

              public string SelectedYAxis
              {
                  get => _selectedYAxis;
                  set
                  {
      Severity: Major
      Found in Tunny/WPF/ViewModels/Output/AnalysisChartViewModel.cs and 3 other locations - About 1 hr to fix
      Tunny/WPF/ViewModels/Optimize/LiveChartViewModel.cs on lines 19..47
      Tunny/WPF/ViewModels/Optimize/LiveChartViewModel.cs on lines 49..77
      Tunny/WPF/ViewModels/Output/AnalysisChartViewModel.cs on lines 38..66

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 144.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

              public string SelectedXTarget
              {
                  get => _selectedXTarget;
                  set
                  {
      Severity: Major
      Found in Tunny/WPF/ViewModels/Optimize/LiveChartViewModel.cs and 3 other locations - About 1 hr to fix
      Tunny/WPF/ViewModels/Optimize/LiveChartViewModel.cs on lines 49..77
      Tunny/WPF/ViewModels/Output/AnalysisChartViewModel.cs on lines 38..66
      Tunny/WPF/ViewModels/Output/AnalysisChartViewModel.cs on lines 70..98

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 144.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

              public string SelectedXAxis
              {
                  get => _selectedXAxis;
                  set
                  {
      Severity: Major
      Found in Tunny/WPF/ViewModels/Output/AnalysisChartViewModel.cs and 3 other locations - About 1 hr to fix
      Tunny/WPF/ViewModels/Optimize/LiveChartViewModel.cs on lines 19..47
      Tunny/WPF/ViewModels/Optimize/LiveChartViewModel.cs on lines 49..77
      Tunny/WPF/ViewModels/Output/AnalysisChartViewModel.cs on lines 70..98

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 144.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

              public string SelectedYTarget
              {
                  get => _selectedYTarget;
                  set
                  {
      Severity: Major
      Found in Tunny/WPF/ViewModels/Optimize/LiveChartViewModel.cs and 3 other locations - About 1 hr to fix
      Tunny/WPF/ViewModels/Optimize/LiveChartViewModel.cs on lines 19..47
      Tunny/WPF/ViewModels/Output/AnalysisChartViewModel.cs on lines 38..66
      Tunny/WPF/ViewModels/Output/AnalysisChartViewModel.cs on lines 70..98

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 144.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Method GetTrial has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              public Trial.Trial GetTrial(int trialId)
              {
                  var trial = new Trial.Trial();
                  using (var connection = new SQLiteConnection(_sqliteConnection.ToString()))
                  {
      Severity: Minor
      Found in Optuna/Storage/RDB/Storage.cs - About 1 hr to fix

        Method ToPython has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                public dynamic ToPython(SamplerType type, string storagePath, bool hasConstraints, PyDict cmaEsX0)
                {
                    TLog.MethodStart();
                    dynamic optunaSampler;
                    switch (type)
        Severity: Minor
        Found in Tunny.Core/Settings/Sampler.cs - About 1 hr to fix

          Method SolveInstance has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          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));
          Severity: Minor
          Found in Tunny/Component/Optimizer/BoneFishComponent.cs - About 1 hr to fix

            Method SetInputSliderValues has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    private void SetInputSliderValues(List<VariableBase> variables)
                    {
                        TLog.MethodStart();
                        int i = 0;
            
            
            Severity: Minor
            Found in Tunny/Util/GrasshopperInOut.cs - About 1 hr to fix

              Method StorageLoadTest has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      [Theory]
                      [InlineData(@"TestFile/sqlite.db", "sqlite")]
                      [InlineData(@"TestFile/journal.log", "log")]
                      public void StorageLoadTest(string path, string type)
                      {
              Severity: Minor
              Found in OptunaTests/Storage/StorageSameBevaviorTests.cs - About 1 hr to fix

                Method CreateNewStudy has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        public int CreateNewStudy(StudyDirection[] studyDirections, string studyName)
                        {
                            long maxLength;
                            using (var connection = new SQLiteConnection(_sqliteConnection.ToString()))
                            {
                Severity: Minor
                Found in Optuna/Storage/RDB/Storage.cs - About 1 hr to fix

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

                              if (Directory.Exists(Path.Combine(TEnvVariables.ExampleDirPath, "Human-in-the-loop")))
                              {
                                  var hitlExample = new ToolStripMenuItem("Human-in-the-loop", null, null, "TutorialHITLStripMenuItem");
                                  string[] hitlFiles = Directory.GetFiles(Path.Combine(TEnvVariables.ExampleDirPath, "Human-in-the-loop"), "*.gh");
                                  SetMenuItemsFromFilePath(hitlExample, hitlFiles);
                  Tunny/Component/LoadingInstruction/RegisterTunnyToolbarItems.cs on lines 110..116

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 130.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

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

                              if (Directory.Exists(Path.Combine(TEnvVariables.ExampleDirPath, "Optimization")))
                              {
                                  var optExample = new ToolStripMenuItem("Optimization", null, null, "TutorialOptimizationStripMenuItem");
                                  string[] optFiles = Directory.GetFiles(Path.Combine(TEnvVariables.ExampleDirPath, "Optimization"), "*.gh");
                                  SetMenuItemsFromFilePath(optExample, optFiles);
                  Tunny/Component/LoadingInstruction/RegisterTunnyToolbarItems.cs on lines 117..123

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 130.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

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

                          private void SetTrialSystemAttrFromJObject(int trialId, JObject systemAttr)
                          {
                              foreach (KeyValuePair<string, JToken> item in systemAttr)
                              {
                                  string[] values = item.Value.Select(v => v.ToString()).ToArray();
                  Severity: Major
                  Found in Optuna/Storage/Journal/Storage.cs and 1 other location - About 1 hr to fix
                  Optuna/Storage/Journal/Storage.cs on lines 205..216

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 128.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Severity
                  Category
                  Status
                  Source
                  Language