philipbelesky/Caribou

View on GitHub

Showing 82 of 82 total issues

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

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

                private void CheckResult()
                {
                    Assert.AreEqual(expectedMinBounds, results.MinBounds);
                    Assert.AreEqual(expectedMaxBounds, results.MaxBounds);
                    Assert.AreEqual(expectedMinBounds.Latitude, results.MinBounds.Latitude);
        Severity: Major
        Found in Caribou.Tests/Models/TestSingleBoundsParsing.cs and 1 other location - About 1 hr to fix
        Caribou.Tests/Models/TestMultipleBoundsParsing.cs on lines 39..45

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

        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 void CheckResult()
                {
                    Assert.AreEqual(expectedMinBounds, results.MinBounds);
                    Assert.AreEqual(expectedMaxBounds, results.MaxBounds);
                    Assert.AreEqual(expectedMinBounds.Latitude, results.MinBounds.Latitude);
        Severity: Major
        Found in Caribou.Tests/Models/TestMultipleBoundsParsing.cs and 1 other location - About 1 hr to fix
        Caribou.Tests/Models/TestSingleBoundsParsing.cs on lines 70..76

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

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

          Method CaribouSolveInstance has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
          Open

                  protected override void CaribouSolveInstance(IGH_DataAccess da)
                  {
                      logger.Reset();
          
                      #region Input Parsing
          Severity: Minor
          Found in Caribou/Components/PickTagsComponent.cs - About 55 mins 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

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

                  protected static int CountNodesForMetaData(RequestHandler results, OSMTag request)
                  {
                      var allResults = results.FoundData[request];
                      var nodeResults = allResults.Where(o => o.Kind == OSMGeometryType.Node);
                      return nodeResults.Count();
          Severity: Minor
          Found in Caribou.Tests/Parsing/BaseParsingTest.cs and 1 other location - About 45 mins to fix
          Caribou.Tests/Parsing/BaseParsingTest.cs on lines 42..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 74.

          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 static int CountWaysForMetaData(RequestHandler results, OSMTag request)
                  {
                      var allResults = results.FoundData[request];
                      var nodeResults = allResults.Where(o => o.Kind == OSMGeometryType.Way);
                      return nodeResults.Count();
          Severity: Minor
          Found in Caribou.Tests/Parsing/BaseParsingTest.cs and 1 other location - About 45 mins to fix
          Caribou.Tests/Parsing/BaseParsingTest.cs on lines 35..40

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

          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

          with open('PrimaryValuesData.json', 'w') as fp:
              json.dump(data['definedValues'], fp, indent=4, sort_keys=True)
          Severity: Major
          Found in OSM Feature Data/tagfinder_parse.py and 2 other locations - About 40 mins to fix
          OSM Feature Data/tagfinder_parse.py on lines 90..91
          OSM Feature Data/tagfinder_parse.py on lines 93..94

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

          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

          with open('KeyData.json', 'w') as fp:
              json.dump(data['key'], fp, indent=4, sort_keys=True)
          Severity: Major
          Found in OSM Feature Data/tagfinder_parse.py and 2 other locations - About 40 mins to fix
          OSM Feature Data/tagfinder_parse.py on lines 87..88
          OSM Feature Data/tagfinder_parse.py on lines 90..91

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

          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

          with open('KeyValueData.json', 'w') as fp:
              json.dump(data['value'], fp, indent=4, sort_keys=True)
          Severity: Major
          Found in OSM Feature Data/tagfinder_parse.py and 2 other locations - About 40 mins to fix
          OSM Feature Data/tagfinder_parse.py on lines 87..88
          OSM Feature Data/tagfinder_parse.py on lines 93..94

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

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

                  public static Button GetExpandAll(int buttonWidth, int buttonHeight, Action expandAll)
                  {
                      var allButton = new Button()
                      {
                          Text = "⬇️ Expand All",
          Severity: Major
          Found in Caribou/Forms/UI/ControlStrip.cs and 5 other locations - About 40 mins to fix
          Caribou/Forms/UI/ConfirmStrip.cs on lines 8..18
          Caribou/Forms/UI/ConfirmStrip.cs on lines 20..30
          Caribou/Forms/UI/ControlStrip.cs on lines 21..31
          Caribou/Forms/UI/ControlStrip.cs on lines 33..43
          Caribou/Forms/UI/ControlStrip.cs on lines 56..66

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

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

                  public static Button GetCancel(int buttonWidth, int buttonHeight, Action cancelAndClose)
                  {
                      var cancelButton = new Button()
                      {
                          Text = "❌ Cancel Update",
          Severity: Major
          Found in Caribou/Forms/UI/ConfirmStrip.cs and 5 other locations - About 40 mins to fix
          Caribou/Forms/UI/ConfirmStrip.cs on lines 8..18
          Caribou/Forms/UI/ControlStrip.cs on lines 21..31
          Caribou/Forms/UI/ControlStrip.cs on lines 33..43
          Caribou/Forms/UI/ControlStrip.cs on lines 44..54
          Caribou/Forms/UI/ControlStrip.cs on lines 56..66

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

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

                  public static Button GetUpdate(int buttonWidth, int buttonHeight, Action updateAndClose)
                  {
                      var updateButton = new Button()
                      {
                          Text = "✅ Update Selection",
          Severity: Major
          Found in Caribou/Forms/UI/ConfirmStrip.cs and 5 other locations - About 40 mins to fix
          Caribou/Forms/UI/ConfirmStrip.cs on lines 20..30
          Caribou/Forms/UI/ControlStrip.cs on lines 21..31
          Caribou/Forms/UI/ControlStrip.cs on lines 33..43
          Caribou/Forms/UI/ControlStrip.cs on lines 44..54
          Caribou/Forms/UI/ControlStrip.cs on lines 56..66

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

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

                  public static Button GetCollapseAll(int buttonWidth, int buttonHeight, Action collapseAll)
                  {
                      var collapseButton = new Button()
                      {
                          Text = "⬆️ Collapse All",
          Severity: Major
          Found in Caribou/Forms/UI/ControlStrip.cs and 5 other locations - About 40 mins to fix
          Caribou/Forms/UI/ConfirmStrip.cs on lines 8..18
          Caribou/Forms/UI/ConfirmStrip.cs on lines 20..30
          Caribou/Forms/UI/ControlStrip.cs on lines 21..31
          Caribou/Forms/UI/ControlStrip.cs on lines 33..43
          Caribou/Forms/UI/ControlStrip.cs on lines 44..54

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

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

                  public static Button GetSelectAll(int buttonWidth, int buttonHeight, Action selectAll)
                  {
                      var allButton = new Button()
                      {
                          Text = "🔘 Select All",
          Severity: Major
          Found in Caribou/Forms/UI/ControlStrip.cs and 5 other locations - About 40 mins to fix
          Caribou/Forms/UI/ConfirmStrip.cs on lines 8..18
          Caribou/Forms/UI/ConfirmStrip.cs on lines 20..30
          Caribou/Forms/UI/ControlStrip.cs on lines 33..43
          Caribou/Forms/UI/ControlStrip.cs on lines 44..54
          Caribou/Forms/UI/ControlStrip.cs on lines 56..66

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

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

                  public static Button GetSelectNone(int buttonWidth, int buttonHeight, Action selectNone)
                  {
                      var noneButton = new Button()
                      {
                          Text = "⚪ Select None",
          Severity: Major
          Found in Caribou/Forms/UI/ControlStrip.cs and 5 other locations - About 40 mins to fix
          Caribou/Forms/UI/ConfirmStrip.cs on lines 8..18
          Caribou/Forms/UI/ConfirmStrip.cs on lines 20..30
          Caribou/Forms/UI/ControlStrip.cs on lines 21..31
          Caribou/Forms/UI/ControlStrip.cs on lines 44..54
          Caribou/Forms/UI/ControlStrip.cs on lines 56..66

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

          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 CheckBounds has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  private static void CheckBounds(XmlNode node, ref double? currentMinLat, ref double? currentMinLon,
                                                                   ref double? currentMaxLat, ref double? currentMaxLon)
          Severity: Minor
          Found in Caribou/Processing/ParseViaXMLDocument.cs - About 35 mins to fix

            Method CheckBounds has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    public static void CheckBounds(Tuple<Coord, Coord> bounds, 
                        ref double? currentMinLat, ref double? currentMinLon, ref double? currentMaxLat, ref double? currentMaxLon)
            Severity: Minor
            Found in Caribou/Processing/ParseViaXMLReader.cs - About 35 mins to fix
              Severity
              Category
              Status
              Source
              Language