hrntsm/Tunny

View on GitHub

Showing 56 of 131 total issues

Method GetAttributes has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public Dictionary<string, List<string>> GetAttributes()
        {
            TLog.MethodStart();
            var attrs = new Dictionary<string, List<string>>();
            if (_attributes.Value == null)
Severity: Minor
Found in Tunny/Util/GrasshopperInOut.cs - About 1 hr to fix

    Method SetParamsValue has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            private static void SetParamsValue(List<IGH_Param> sources, List<double> numbers, List<Bitmap> images, List<GeometryBase> geometries)
            {
                TLog.MethodStart();
                foreach (IGH_StructureEnumerator ghEnumerator in sources.Select(objective => objective.VolatileData.AllData(false)))
                {
    Severity: Minor
    Found in Tunny/Input/Objective.cs - About 1 hr to fix

      Method FilterInputVariables has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              private bool FilterInputVariables()
              {
                  TLog.MethodStart();
                  var errorInputGuids = new List<Guid>();
                  foreach ((IGH_DocumentObject docObject, int _) in _inputGuids.Select((guid, i) => (_document.FindObject(guid, false), i)))
      Severity: Minor
      Found in Tunny/Util/GrasshopperInOut.cs - About 1 hr to fix

        Method SetTrialUserAttr has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                private static void SetTrialUserAttr(TrialGrasshopperItems result, dynamic trial, OptimizationHandlingInfo optSet)
                {
                    TLog.MethodStart();
                    if (result.GeometryJson.Length != 0)
                    {
        Severity: Minor
        Found in Tunny/Solver/Algorithm.cs - About 1 hr to fix

          Method HumanSliderInputOptimization has 9 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  private void HumanSliderInputOptimization(int nBatch, double timeout, string[] directions, dynamic sampler, dynamic storage, dynamic artifactBackend, out Parameter[] parameter, out TrialGrasshopperItems result, out dynamic study)
          Severity: Major
          Found in Tunny/Solver/Algorithm.cs - About 1 hr to fix

            Method NormalOptimization has 9 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    private void NormalOptimization(int nTrials, double timeout, string[] directions, dynamic sampler, dynamic storage, dynamic artifactBackend, out Parameter[] parameter, out TrialGrasshopperItems result, out dynamic study)
            Severity: Major
            Found in Tunny/Solver/Algorithm.cs - About 1 hr to fix

              Method GetStudyDirections has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      public StudyDirection[] GetStudyDirections(int studyId)
                      {
                          if (_studies.TryGetValue(studyId, out Study.Study value))
                          {
                              return value.Directions;
              Severity: Minor
              Found in Optuna/Storage/RDB/Storage.cs - About 1 hr to fix

                Function truncate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                def truncate(fig, study: Study) -> go.Figure:
                    user_attr = study.trials[0].user_attrs
                    has_geometry = "Geometry" in user_attr
                    if has_geometry == False:
                        return fig
                Severity: Minor
                Found in Optuna/Visualization/Python/plot_pareto_front.py - About 1 hr to fix

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

                        private void TTDesignExplorerToolStripMenuItem_Click(object sender, EventArgs e)
                        {
                            TLog.MethodStart();
                            string settingsPath = TEnvVariables.OptimizeSettingsPath;
                            string storagePath = string.Empty;
                Severity: Minor
                Found in Tunny/UI/LoadingInstruction.cs - About 1 hr to fix

                  Method InstallPackages has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          private static void InstallPackages(BackgroundWorker worker, string[] packageList)
                          {
                              TLog.MethodStart();
                              int num = packageList.Length;
                              for (int i = 0; i < num; i++)
                  Severity: Minor
                  Found in Tunny.Core/Handler/PythonInstaller.cs - About 1 hr to fix

                    Method SetObjectives has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

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

                      Method CheckVariableSetsIsContained has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              private bool CheckVariableSetsIsContained(IEnumerable<VariableBase> variables)
                              {
                                  int sameValueCount = 0;
                                  foreach (VariableBase variable in variables)
                                  {
                      Severity: Minor
                      Found in Tunny/Component/Operation/ConstructFishEgg.cs - About 1 hr to fix

                        Method CreateStudy has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                public static dynamic CreateStudy(dynamic optuna, string studyName, dynamic sampler, string[] directions, dynamic storage, bool loadIfExists = true)
                        Severity: Minor
                        Found in Optuna/Study/Study.cs - About 45 mins to fix

                          Method PreferentialOptimization has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                  private void PreferentialOptimization(int nBatch, dynamic storage, dynamic artifactBackend, out Parameter[] parameter, out TrialGrasshopperItems result, out dynamic study)
                          Severity: Minor
                          Found in Tunny/Solver/Algorithm.cs - About 45 mins to fix

                            Function plot_cluster_nd has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            def plot_cluster_nd(
                            Severity: Minor
                            Found in Optuna/Visualization/Python/plot_clustering.py - About 35 mins to fix

                              Function plot_pareto_front has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              def plot_pareto_front(
                              Severity: Minor
                              Found in Optuna/Visualization/Python/plot_pareto_front.py - About 35 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language