philipbelesky/Caribou

View on GitHub

Showing 36 of 82 total issues

Method GetTagsCaseData has 141 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public static List<List<List<string>>> GetTagsCaseData()
        {
            var branch0 = new List<List<string>>() { };
            var branch1 = new List<List<string>>() { };

Severity: Major
Found in Caribou.Tests/Cases/TagsTestClases.cs - About 5 hrs to fix

    Method CaribouSolveInstance has 90 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            protected override void CaribouSolveInstance(IGH_DataAccess da)
            {
                logger.Reset();
    
                #region Input Parsing
    Severity: Major
    Found in Caribou/Components/PickTagsComponent.cs - About 3 hrs to fix

      Method GetLayout has 79 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              private TreeGridView GetLayout(TreeGridItemCollection selectableItems)
              {
                  var isMacOS = Eto.Platform.Detect.IsMac;
      
                  var featureSelect = new TreeGridView()
      Severity: Major
      Found in Caribou/Forms/UI/TableStrip.cs - About 3 hrs to fix

        Method FindWaysInXML has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring.
        Open

                public static void FindWaysInXML(XmlReader reader, ref RequestHandler request, int fileIndex, bool onlyBuildings)
                {
                    string currentWayId = "";
                    var currentWayMetaData = new Dictionary<string, string>();
                    var currentWayNodes = new List<Coord>();
        Severity: Minor
        Found in Caribou/Processing/ParseViaXMLReader.cs - About 3 hrs 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 BuildingBrepsFromCoords has a Cognitive Complexity of 35 (exceeds 20 allowed). Consider refactoring.
        Open

                public static Dictionary<OSMTag, List<Brep>> BuildingBrepsFromCoords(ref RequestHandler result, bool outputHeighted)
                {
                    var geometryResult = new Dictionary<OSMTag, List<Brep>>();
                    var unitScale = RhinoMath.UnitScale(UnitSystem.Meters, RhinoDoc.ActiveDoc.ModelUnitSystem); // OSM conversion assumes meters
                    var tolerance = RhinoDoc.ActiveDoc.ModelAbsoluteTolerance; 
        Severity: Minor
        Found in Caribou/Processing/TranslateToXYManually.cs - About 2 hrs 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 DoWork has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                public override void DoWork(Action<string, double> reportProgress, Action done)
                {
                    logger.Reset();
                    logger.indexOfDebugOutput = 4; // Dynamic nature of class params requires manually specifying debug log output index
                    string typeName = Enum.GetName(typeof(OSMGeometryType), this.WorkerType());
        Severity: Major
        Found in Caribou/Workers/BaseLoadAndParseWorker.cs - About 2 hrs to fix

          Method FindWaysInXML has 56 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  public static void FindWaysInXML(XmlReader reader, ref RequestHandler request, int fileIndex, bool onlyBuildings)
                  {
                      string currentWayId = "";
                      var currentWayMetaData = new Dictionary<string, string>();
                      var currentWayNodes = new List<Coord>();
          Severity: Major
          Found in Caribou/Processing/ParseViaXMLReader.cs - About 2 hrs to fix

            Method BuildingBrepsFromCoords has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    public static Dictionary<OSMTag, List<Brep>> BuildingBrepsFromCoords(ref RequestHandler result, bool outputHeighted)
                    {
                        var geometryResult = new Dictionary<OSMTag, List<Brep>>();
                        var unitScale = RhinoMath.UnitScale(UnitSystem.Meters, RhinoDoc.ActiveDoc.ModelUnitSystem); // OSM conversion assumes meters
                        var tolerance = RhinoDoc.ActiveDoc.ModelAbsoluteTolerance; 
            Severity: Minor
            Found in Caribou/Processing/TranslateToXYManually.cs - About 2 hrs to fix

              Method CaribouSolveInstance has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      protected override void CaribouSolveInstance(IGH_DataAccess da)
                      {
                          if (this.state == 0)
                          {
                              if (this.BaseWorker == null)
              Severity: Minor
              Found in Caribou/CaribouAsyncComponent.cs - About 1 hr to fix

                Method GetSelectableTagsFromInputTree has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        protected TreeGridItemCollection GetSelectableTagsFromInputTree(OSMListWithPaths requests)
                        {
                            var indexOfParents = new Dictionary<string, int>();
                            var sortedTags = requests.items.OrderBy(t => t.ToString()).ToList();
                            var selectableTags = new TreeGridItemCollection();
                Severity: Minor
                Found in Caribou/Components/PickTagsComponent.cs - About 1 hr to fix

                  Method FindNodesInXML has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          public static void FindNodesInXML(XmlReader reader, ref RequestHandler request, int fileIndex, bool onlyBuildings)
                          {
                              string currentNodeId = "";
                              double currentLat = 0;
                              double currentLon = 0;
                  Severity: Minor
                  Found in Caribou/Processing/ParseViaXMLReader.cs - About 1 hr to fix

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

                            private static Dictionary<string, OSMTag> GetKeys()
                            {
                                return new Dictionary<string, OSMTag>()
                                {
                                    { "aerialway",  new OSMTag("aerialway", "Aerialway", "Forms of transportation for people or goods that use aerial wires, e.g. cable-cars & chair-lifts.") },
                    Severity: Minor
                    Found in Caribou/Models/OSMPrimaryTypes.cs - About 1 hr to fix

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

                              public static void GetBounds(ref RequestHandler result, bool readPathAsContents = false)
                              {
                                  double? currentMinLat = null;
                                  double? currentMinLon = null;
                                  double? currentMaxLat = null;
                      Severity: Minor
                      Found in Caribou/Processing/ParseViaXMLReader.cs - About 1 hr to fix

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

                                public static GH_Structure<GH_String> MakeReportForRequests(
                                    Dictionary<OSMTag, int> foundItemsForResult)
                                {
                                    var output = new GH_Structure<GH_String>();
                                    var tInfo = CultureInfo.CurrentCulture.TextInfo;
                        Severity: Minor
                        Found in Caribou/Models/TreeFormatters.cs - About 1 hr to fix

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

                                  void _OnFormatCell(object sender, GridCellFormatEventArgs e)
                                  {
                                      switch (e.Column.HeaderText)
                                      {
                                          case TagTypeLabel:
                          Severity: Minor
                          Found in Caribou/Forms/UI/TableStrip.cs - About 1 hr to fix

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

                                    public void SetData(IGH_DataAccess da)
                                    {
                                        try
                                        {
                                            WorkerSetData(da); // Worker must implement a custom SetData as per below
                            Severity: Minor
                            Found in Caribou/WorkerInstance.cs - About 1 hr to fix

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

                                      private List<OSMTag> RequestsThatWantItem(string nodeId, Dictionary<string, string> tagsOfFoundNode)
                                      {
                                          var matches = new List<OSMTag>();
                                          var ci = CultureInfo.InvariantCulture;
                              
                              
                              Severity: Minor
                              Found in Caribou/Models/RequestHandler.cs - About 1 hr to fix

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

                                        public static double ParseHeight(Dictionary<string, string> tags, double unitScale)
                                        {
                                            var height = 0.0; // null result
                                            if (tags.ContainsKey("height"))
                                            {
                                Severity: Minor
                                Found in Caribou/Processing/GetBuildingHeights.cs - About 1 hr to fix

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

                                          static double GetSanitisedHeight(string heightKey)
                                          {
                                              double parsedHeight;
                                  
                                              try
                                  Severity: Minor
                                  Found in Caribou/Processing/GetBuildingHeights.cs - About 1 hr to fix

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

                                            public static TreeGridItemCollection GetTreeCollection()
                                            {
                                                var selectableOSMs = new TreeGridItemCollection();
                                                var indexOfParents = new Dictionary<string, int>();
                                    
                                    
                                    Severity: Minor
                                    Found in Caribou/Models/OSMPrimaryTypes.cs - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language