hrntsm/Tunny

View on GitHub

Showing 185 of 198 total issues

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

traces.append(
    go.Scatter(
        x=[t.values[0] for t in good_trials],
        y=[t.values[1] for t in good_trials],
        mode="markers",
Severity: Major
Found in Examples/Python/plot_with_coloring_of_results.py and 1 other location - About 3 hrs to fix
Examples/Python/plot_with_coloring_of_results.py on lines 44..50

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 65.

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

using System.Linq;

using Tunny.Core.Settings;

namespace Tunny.WPF.ViewModels.Visualize
Severity: Major
Found in Tunny/WPF/ViewModels/Visualize/ContourViewModel.cs and 1 other location - About 3 hrs to fix
Tunny/WPF/ViewModels/Visualize/RankViewModel.cs on lines 1..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 216.

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

using System.Linq;

using Tunny.Core.Settings;

namespace Tunny.WPF.ViewModels.Visualize
Severity: Major
Found in Tunny/WPF/ViewModels/Visualize/RankViewModel.cs and 1 other location - About 3 hrs to fix
Tunny/WPF/ViewModels/Visualize/ContourViewModel.cs on lines 1..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 216.

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 ChangeTargetSampler has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public void ChangeTargetSampler(SamplerType samplerType)
        {
            ITrialNumberParam param;
            switch (samplerType)
            {
Severity: Major
Found in Tunny/WPF/ViewModels/Optimize/OptimizeViewModel.cs - About 2 hrs to fix

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

            protected override void RegisterInputParams(GH_InputParamManager pManager)
            {
                pManager.AddGenericParameter("Variables", "Vars", "Connect variable number slider here.", GH_ParamAccess.tree);
                pManager.AddGenericParameter("Objectives", "Objs", "Connect objective number component here.", GH_ParamAccess.tree);
                pManager.AddParameter(new Param_FishAttribute(), "Attributes", "Attrs", "Connect model attribute like some geometry or values here. Not required.", GH_ParamAccess.item);
    Severity: Major
    Found in Tunny/Component/Optimizer/FishingComponent.cs and 1 other location - About 2 hrs to fix
    Tunny/Component/Obsolete/FishingComponent_v0_11_1.cs on lines 25..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 192.

    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

            protected override void RegisterInputParams(GH_InputParamManager pManager)
            {
                pManager.AddGenericParameter("Variables", "Vars", "Connect variable number slider here.", GH_ParamAccess.tree);
                pManager.AddGenericParameter("Objectives", "Objs", "Connect objective number component here.", GH_ParamAccess.tree);
                pManager.AddParameter(new Param_FishAttribute(), "Attributes", "Attrs", "Connect model attribute like some geometry or values here. Not required.", GH_ParamAccess.item);
    Severity: Major
    Found in Tunny/Component/Obsolete/FishingComponent_v0_11_1.cs and 1 other location - About 2 hrs to fix
    Tunny/Component/Optimizer/FishingComponent.cs on lines 21..31

    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 192.

    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 RunHumanSidlerInputOptimize(OptimizationHandlingInfo optInfo, int nBatch, out Parameter[] parameter, out TrialGrasshopperItems result)
            {
                TLog.MethodStart();
                parameter = new Parameter[_variables.Count];
                result = new TrialGrasshopperItems();
    Severity: Major
    Found in Tunny/Solver/Algorithm.cs and 1 other location - About 2 hrs to fix
    Tunny/Solver/Algorithm.cs on lines 240..264

    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 192.

    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 RunPreferentialOptimize(OptimizationHandlingInfo optInfo, int nBatch, out Parameter[] parameter, out TrialGrasshopperItems result)
            {
                TLog.MethodStart();
                parameter = new Parameter[_variables.Count];
                result = new TrialGrasshopperItems();
    Severity: Major
    Found in Tunny/Solver/Algorithm.cs and 1 other location - About 2 hrs to fix
    Tunny/Solver/Algorithm.cs on lines 266..290

    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 192.

    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

    Class GrasshopperInOut has 24 methods (exceeds 20 allowed). Consider refactoring.
    Open

        public class GrasshopperInOut
        {
            private readonly GH_Document _document;
            private readonly List<Guid> _inputGuids;
            private readonly GH_Component _component;
    Severity: Minor
    Found in Tunny/Util/GrasshopperInOut.cs - About 2 hrs to fix

      File AnalysisChartViewModel.cs has 277 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      using System;
      using System.Collections.Generic;
      using System.Collections.ObjectModel;
      using System.Globalization;
      using System.Linq;
      Severity: Minor
      Found in Tunny/WPF/ViewModels/Output/AnalysisChartViewModel.cs - About 2 hrs to fix

        Method RunSingleOptimizeStep has 65 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                private TrialGrasshopperItems RunSingleOptimizeStep(OptimizationHandlingInfo optInfo, Parameter[] parameter, int trialNum, DateTime startTime)
                {
                    TLog.MethodStart();
                    dynamic optuna = Py.Import("optuna");
                    TrialWrapper trial;
        Severity: Major
        Found in Tunny/Solver/Algorithm.cs - About 2 hrs to fix

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

                  private Param_GenericObject SetGenericParameterInput()
                  {
                      int count = 1;
                      IEnumerable<string> attrInput = Params.Input.Select(x => x.NickName).Where(x => x.Contains("Attr"));
                      string nickname = $"Attr{count}";
          Severity: Major
          Found in Tunny/Component/Operation/ConstructFishAttribute.cs and 1 other location - About 2 hrs to fix
          Tunny/Component/Obsolete/ConstructFishAttribute_v0_12_0.cs on lines 163..179

          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 179.

          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

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

                  private Param_GenericObject SetGenericParameterInput()
                  {
                      int count = 1;
                      IEnumerable<string> attrInput = Params.Input.Select(x => x.NickName).Where(x => x.Contains("Attr"));
                      string nickname = $"Attr{count}";
          Severity: Major
          Found in Tunny/Component/Obsolete/ConstructFishAttribute_v0_12_0.cs and 1 other location - About 2 hrs to fix
          Tunny/Component/Operation/ConstructFishAttribute.cs on lines 123..139

          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 179.

          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 SetStudyId has 62 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  internal void SetStudyId(int studyId)
                  {
                      _selectedStudyId = studyId;
                      XAxisItems.Clear();
                      YAxisItems.Clear();
          Severity: Major
          Found in Tunny/WPF/ViewModels/Output/AnalysisChartViewModel.cs - About 2 hrs to fix

            Method GetTargetValue has 61 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    private double GetTargetValue(Trial trial, string target)
                    {
                        if (target == "ID")
                        {
                            return trial.TrialId;
            Severity: Major
            Found in Tunny/WPF/ViewModels/Output/AnalysisChartViewModel.cs - About 2 hrs to fix

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

                      public Dictionary<string, object> GetTrialUserAttrs(int trialId)
                      {
                          var trialUserAttrs = new Dictionary<string, object>();
                          using (var connection = new SQLiteConnection(_sqliteConnection.ToString()))
                          {
              Severity: Major
              Found in Optuna/Storage/RDB/Storage.cs and 3 other locations - About 2 hrs to fix
              Optuna/Storage/RDB/Storage.cs on lines 369..390
              Optuna/Storage/RDB/Storage.cs on lines 392..413
              Optuna/Storage/RDB/Storage.cs on lines 586..607

              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 168.

              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 Dictionary<string, object> GetStudySystemAttrs(int studyId)
                      {
                          var studySystemAttrs = new Dictionary<string, object>();
                          using (var connection = new SQLiteConnection(_sqliteConnection.ToString()))
                          {
              Severity: Major
              Found in Optuna/Storage/RDB/Storage.cs and 3 other locations - About 2 hrs to fix
              Optuna/Storage/RDB/Storage.cs on lines 369..390
              Optuna/Storage/RDB/Storage.cs on lines 563..584
              Optuna/Storage/RDB/Storage.cs on lines 586..607

              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 168.

              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 Dictionary<string, object> GetTrialSystemAttrs(int trialId)
                      {
                          var trialSystemAttrs = new Dictionary<string, object>();
                          using (var connection = new SQLiteConnection(_sqliteConnection.ToString()))
                          {
              Severity: Major
              Found in Optuna/Storage/RDB/Storage.cs and 3 other locations - About 2 hrs to fix
              Optuna/Storage/RDB/Storage.cs on lines 369..390
              Optuna/Storage/RDB/Storage.cs on lines 392..413
              Optuna/Storage/RDB/Storage.cs on lines 563..584

              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 168.

              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 Dictionary<string, object> GetStudyUserAttrs(int studyId)
                      {
                          var studyUserAttrs = new Dictionary<string, object>();
                          using (var connection = new SQLiteConnection(_sqliteConnection.ToString()))
                          {
              Severity: Major
              Found in Optuna/Storage/RDB/Storage.cs and 3 other locations - About 2 hrs to fix
              Optuna/Storage/RDB/Storage.cs on lines 392..413
              Optuna/Storage/RDB/Storage.cs on lines 563..584
              Optuna/Storage/RDB/Storage.cs on lines 586..607

              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 168.

              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

                      [Fact]
                      public void DesignExplorerCsvTest()
                      {
                          var reader = new CsvReader("TestFile/DesignExplorer.csv");
                          int[] result = reader.ReadSelectionCsv(CsvType.DesignExplorer);
              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 11..22

              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

              Severity
              Category
              Status
              Source
              Language