Showing 36 of 82 total issues
Method GetTagsCaseData
has 141 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static List<List<List<string>>> GetTagsCaseData()
{
var branch0 = new List<List<string>>() { };
var branch1 = new List<List<string>>() { };
Method CaribouSolveInstance
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected override void CaribouSolveInstance(IGH_DataAccess da)
{
logger.Reset();
#region Input Parsing
Method GetLayout
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private TreeGridView GetLayout(TreeGridItemCollection selectableItems)
{
var isMacOS = Eto.Platform.Detect.IsMac;
var featureSelect = new TreeGridView()
Method FindWaysInXML
has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring. Open
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>();
- Read upRead up
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
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;
- Read upRead up
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
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());
Method FindWaysInXML
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
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>();
Method BuildingBrepsFromCoords
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
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;
Method CaribouSolveInstance
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected override void CaribouSolveInstance(IGH_DataAccess da)
{
if (this.state == 0)
{
if (this.BaseWorker == null)
Method GetSelectableTagsFromInputTree
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
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();
Method FindNodesInXML
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static void FindNodesInXML(XmlReader reader, ref RequestHandler request, int fileIndex, bool onlyBuildings)
{
string currentNodeId = "";
double currentLat = 0;
double currentLon = 0;
Method GetKeys
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
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.") },
Method GetBounds
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static void GetBounds(ref RequestHandler result, bool readPathAsContents = false)
{
double? currentMinLat = null;
double? currentMinLon = null;
double? currentMaxLat = null;
Method MakeReportForRequests
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static GH_Structure<GH_String> MakeReportForRequests(
Dictionary<OSMTag, int> foundItemsForResult)
{
var output = new GH_Structure<GH_String>();
var tInfo = CultureInfo.CurrentCulture.TextInfo;
Method _OnFormatCell
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
void _OnFormatCell(object sender, GridCellFormatEventArgs e)
{
switch (e.Column.HeaderText)
{
case TagTypeLabel:
Method SetData
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public void SetData(IGH_DataAccess da)
{
try
{
WorkerSetData(da); // Worker must implement a custom SetData as per below
Method RequestsThatWantItem
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private List<OSMTag> RequestsThatWantItem(string nodeId, Dictionary<string, string> tagsOfFoundNode)
{
var matches = new List<OSMTag>();
var ci = CultureInfo.InvariantCulture;
Method ParseHeight
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static double ParseHeight(Dictionary<string, string> tags, double unitScale)
{
var height = 0.0; // null result
if (tags.ContainsKey("height"))
{
Method GetSanitisedHeight
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static double GetSanitisedHeight(string heightKey)
{
double parsedHeight;
try
Method GetTreeCollection
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static TreeGridItemCollection GetTreeCollection()
{
var selectableOSMs = new TreeGridItemCollection();
var indexOfParents = new Dictionary<string, int>();