hrntsm/Tunny

View on GitHub

Showing 123 of 131 total issues

Method Run has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        internal static void Run(object sender, DoWorkEventArgs e)
        {
            TLog.MethodStart();
            s_worker = sender as BackgroundWorker;
            Component = e.Argument as UIOptimizeComponentBase;
Severity: Minor
Found in Tunny/Handler/OutputLoop.cs - About 1 hr to fix

    Method GetAllStudySummaries has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    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++)
    Severity: Minor
    Found in Optuna/Study/Study.cs - About 1 hr to fix

      Method GetAttrs has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      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("]"))
      Severity: Minor
      Found in Optuna/Storage/RDB/Storage.cs - About 1 hr to fix

        Method SetSliderValues has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                private void SetSliderValues(decimal[] parameters)
                {
                    TLog.MethodStart();
                    int i = 0;
        
        
        Severity: Minor
        Found in Tunny/Util/GrasshopperInOut.cs - About 1 hr to fix

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

                  private NSGAIIISampler GetNsga3Settings(NSGAIIISampler nsgaIII)
                  {
                      TLog.MethodStart();
                      nsgaIII.MutationProb = nsga3MutationProbCheckBox.Checked
                          ? (double?)nsga3MutationProbUpDown.Value : null;
          Severity: Major
          Found in Tunny/UI/Tab/SettingsTab.cs and 1 other location - About 1 hr to fix
          Tunny/UI/Tab/SettingsTab.cs on lines 286..297

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

          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 NSGAIISampler GetNsga2Settings(NSGAIISampler nsgaII)
                  {
                      TLog.MethodStart();
                      nsgaII.MutationProb = nsga2MutationProbCheckBox.Checked
                          ? (double?)nsga2MutationProbUpDown.Value : null;
          Severity: Major
          Found in Tunny/UI/Tab/SettingsTab.cs and 1 other location - About 1 hr to fix
          Tunny/UI/Tab/SettingsTab.cs on lines 299..310

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

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

                  private static DialogResult ShowUIEndMessages(EndState endState, bool isMultiObjective)
                  {
                      TLog.MethodStart();
                      DialogResult dialogResult;
                      MessageBoxButtons button = isMultiObjective ? MessageBoxButtons.OK : MessageBoxButtons.YesNo;
          Severity: Minor
          Found in Tunny/Solver/Solver.cs - About 1 hr to fix

            Method SelectItemUnsafe has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    public void SelectItemUnsafe(int index)
                    {
                        if (index < 0 || index >= ListItems.Count)
                        {
                            return;
            Severity: Minor
            Found in Tunny/Component/Input/TunnyValueList.cs - About 1 hr to fix

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

              optuna.visualization.plot_slice(
                  study,
                  params=["x", "y"],
                  target=lambda t: t.values[0],
              Severity: Major
              Found in Examples/Python/plot.py and 2 other locations - About 1 hr to fix
              Examples/Python/plot.py on lines 44..47
              Examples/Python/plot.py on lines 55..56

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

              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 3 locations. Consider refactoring.
              Open

              optuna.visualization.plot_contour(
                  study,
                  params=["x", "y"],
                  target=lambda t: t.values[0],
              Severity: Major
              Found in Examples/Python/plot.py and 2 other locations - About 1 hr to fix
              Examples/Python/plot.py on lines 26..29
              Examples/Python/plot.py on lines 55..56

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

              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 3 locations. Consider refactoring.
              Open

              optuna.visualization.plot_parallel_coordinate(
                  study, params=["x", "y"], target=lambda t: t.values[0], target_name=name
              Severity: Major
              Found in Examples/Python/plot.py and 2 other locations - About 1 hr to fix
              Examples/Python/plot.py on lines 26..29
              Examples/Python/plot.py on lines 44..47

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

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

                      private static void ToComponentEndMessage(Algorithm optimize)
                      {
                          TLog.MethodStart();
                          string message;
                          switch (optimize.EndState)
              Severity: Minor
              Found in Tunny/Solver/Solver.cs - About 1 hr to fix

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

                        public dynamic ToPython(dynamic optuna, string storagePath, Dictionary<string, double> firstVariables)
                        {
                            Dictionary<string, double> x0 = UseFirstEggToX0 && firstVariables != null && firstVariables.Count > 0
                                ? firstVariables
                                : null;
                Severity: Minor
                Found in Optuna/Sampler/CmaEsSampler.cs - About 1 hr to fix

                  Method GetAllStudies has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          public Study.Study[] GetAllStudies()
                          {
                              using (var connection = new SQLiteConnection(_sqliteConnection.ToString()))
                              {
                                  connection.Open();
                  Severity: Minor
                  Found in Optuna/Storage/RDB/Storage.cs - About 1 hr to fix

                    Method SetOutputIndices has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            private bool SetOutputIndices(OutputMode mode)
                            {
                                TLog.MethodStart();
                                bool result = true;
                                var indices = new List<int>();
                    Severity: Minor
                    Found in Tunny/UI/Tab/OutputTab.cs - About 1 hr to fix

                      Method SetArtifacts has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              private bool SetArtifacts()
                              {
                                  TLog.MethodStart();
                                  Artifacts = new Artifact();
                                  if (_component.Params.Input[3].SourceCount == 0)
                      Severity: Minor
                      Found in Tunny/Util/GrasshopperInOut.cs - About 1 hr to fix

                        Method AddVariablesToFishEgg has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                private void AddVariablesToFishEgg(IEnumerable<VariableBase> variables)
                                {
                                    foreach (VariableBase variable in variables)
                                    {
                                        string name = variable.NickName;
                        Severity: Minor
                        Found in Tunny/Component/Operation/ConstructFishEgg.cs - About 1 hr to fix

                          Method ToString has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  public override string ToString()
                                  {
                                      var sb = new StringBuilder();
                                      foreach (KeyValuePair<string, object> attr in Value)
                                      {
                          Severity: Minor
                          Found in Tunny/Type/GH_FishAttribute.cs - About 1 hr to fix

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

                                    public void Contour(string objectiveName, int objectiveIndex, string[] variableNames)
                                    {
                                        PyModule ps = Py.CreateScope();
                                        ps.Exec(ReadFileFromResource.Text("Optuna.Visualization.Python.plot_contour.py"));
                                        dynamic visualize = ps.Get("plot_contour");
                            Severity: Major
                            Found in Optuna/Visualization/Visualization.cs and 1 other location - About 1 hr to fix
                            Optuna/Visualization/Visualization.cs on lines 54..60

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

                            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

                                    public dynamic CreateNewTStorage(bool useInnerPythonEngine, Settings.Storage storageSetting)
                                    {
                                        TLog.MethodStart();
                                        string sqlitePath = storageSetting.GetOptunaStoragePathByExtension();
                                        if (useInnerPythonEngine)
                            Severity: Major
                            Found in Tunny.Core/Storage/SqliteStorage.cs and 1 other location - About 1 hr to fix
                            Tunny.Core/Storage/JournalStorage.cs on lines 42..61

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

                            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