Esri/solutions-geoprocessing-toolbox

View on GitHub

Showing 259 of 259 total issues

Function geometrytoControlPoints has a Cognitive Complexity of 147 (exceeds 5 allowed). Consider refactoring.
Open

    def geometrytoControlPoints(self, sic, control_points, attributes) : 

        if (sic is None) or (control_points is None) :
            return None, DictionaryConstants.CONVERSION_ERROR_VALIDATION

Severity: Minor
Found in military_features/scripts/GeometryConverter.py - About 2 days 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

Function writeMessageFile has a Cognitive Complexity of 127 (exceeds 5 allowed). Consider refactoring.
Open

def writeMessageFile() :
    
    global DEBUG_GEOMETRY_CONVERSION, appendFile, foundEmptySIDC, FORCE_UNIQUE_IDs

    try :
Severity: Minor
Found in military_features/scripts/WriteMessageFromFeature.py - About 2 days 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

Function controlPointsToGeometry has a Cognitive Complexity of 104 (exceeds 5 allowed). Consider refactoring.
Open

    def controlPointsToGeometry(self, sic, control_points, attributes) :        

        inPoints = control_points.split(';')
        outPoints = None

Severity: Minor
Found in military_features/scripts/GeometryConverter.py - About 2 days 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

Function writeFeaturesFromMessageFile has a Cognitive Complexity of 103 (exceeds 5 allowed). Consider refactoring.
Open

def writeFeaturesFromMessageFile() :

    foundEmptyRuleId = False  # used to detect if we can not set a RuleID for any rows

    # Get the input message file
Severity: Minor
Found in military_features/scripts/WriteFeatureFromMessage.py - About 2 days 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

File GeometryConverter.py has 817 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#----------------------------------------------------------------------------------
# Copyright 2013 Esri
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Severity: Major
Found in military_features/scripts/GeometryConverter.py - About 1 day to fix

    File GRGUtilities.py has 643 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # coding: utf-8
    '''
    ------------------------------------------------------------------------------
     Copyright 2017 Esri
     Licensed under the Apache License, Version 2.0 (the "License");
    Severity: Major
    Found in clearing_operations/scripts/GRGUtilities.py - About 1 day to fix

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

              elif geoConversion == DictionaryConstants.GCT_PARALLELLINESWITHTICKS :
                  print "GCT_PARALLELLINESWITHTICKS"
                  print "Take input points 1, 2, 3, 4 then derive 1 (midpt of 1,3), 2 (midpt of 2, 4)"
      
                  if pointCount < 4 :
      Severity: Major
      Found in military_features/scripts/GeometryConverter.py and 1 other location - About 1 day to fix
      military_features/scripts/GeometryConverter.py on lines 1008..1025

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

      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

              elif geoConversion == DictionaryConstants.GCT_HORNS    :                
                  print "GCT_HORNS"
                  print "Take input points 1, 2, 3, 4 then derive 1 (midpt of 1,2), 2 (midpt of 3, 4)"
      
                  if pointCount < 4 :
      Severity: Major
      Found in military_features/scripts/GeometryConverter.py and 1 other location - About 1 day to fix
      military_features/scripts/GeometryConverter.py on lines 1055..1072

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

      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

      Function GRGFromArea has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
      Open

      def GRGFromArea(AOI,
                      cellWidth,
                      cellHeight,
                      cellUnits,
                      labelStartPos,
      Severity: Minor
      Found in clearing_operations/scripts/GRGUtilities.py - About 1 day 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

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

              try:
                  # Check that area to number is a polygon
                  descArea = arcpy.Describe(areaToNumber)
                  areaGeom = descArea.shapeType
                  arcpy.AddMessage("Shape type: " + str(areaGeom))
      Severity: Major
      Found in clearing_operations/scripts/NumberFeaturesTool.py and 4 other locations - About 1 day to fix
      clearing_operations/scripts/GRGUtilities.py on lines 309..566
      military_features/scripts/AppendMilitaryFeatures.py on lines 28..126
      military_features/scripts/CalcRepRuleField.py on lines 29..115
      military_features/scripts/CalcSIDCField.py on lines 33..225

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

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

          try:
              #UPDATE
              appEnvironment = Utilities.GetApplication()
              if DEBUG == True: arcpy.AddMessage("App environment: " + appEnvironment)
      
      
      Severity: Major
      Found in clearing_operations/scripts/GRGUtilities.py and 4 other locations - About 1 day to fix
      clearing_operations/scripts/NumberFeaturesTool.py on lines 153..290
      military_features/scripts/AppendMilitaryFeatures.py on lines 28..126
      military_features/scripts/CalcRepRuleField.py on lines 29..115
      military_features/scripts/CalcSIDCField.py on lines 33..225

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

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

      try:
          # SCRIPT ARGUMENTS =================================
          inputMilitaryFeature = arcpy.GetParameterAsText(0)
          sidcField = arcpy.GetParameterAsText(1)
          standard = arcpy.GetParameterAsText(2)
      Severity: Major
      Found in military_features/scripts/CalcRepRuleField.py and 4 other locations - About 1 day to fix
      clearing_operations/scripts/GRGUtilities.py on lines 309..566
      clearing_operations/scripts/NumberFeaturesTool.py on lines 153..290
      military_features/scripts/AppendMilitaryFeatures.py on lines 28..126
      military_features/scripts/CalcSIDCField.py on lines 33..225

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

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

      try:
          
          # SCRIPT ARGUMENTS =================================
          inputTable = arcpy.GetParameterAsText(0)
          targetGeodatabase = arcpy.GetParameterAsText(1)
      Severity: Major
      Found in military_features/scripts/AppendMilitaryFeatures.py and 4 other locations - About 1 day to fix
      clearing_operations/scripts/GRGUtilities.py on lines 309..566
      clearing_operations/scripts/NumberFeaturesTool.py on lines 153..290
      military_features/scripts/CalcRepRuleField.py on lines 29..115
      military_features/scripts/CalcSIDCField.py on lines 33..225

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

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

      try :
      
          # Get input feature class
          inputFC = arcpy.GetParameter(0)
          if (inputFC is "" or inputFC is None):
      Severity: Major
      Found in military_features/scripts/CalcSIDCField.py and 4 other locations - About 1 day to fix
      clearing_operations/scripts/GRGUtilities.py on lines 309..566
      clearing_operations/scripts/NumberFeaturesTool.py on lines 153..290
      military_features/scripts/AppendMilitaryFeatures.py on lines 28..126
      military_features/scripts/CalcRepRuleField.py on lines 29..115

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

      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

              elif geoConversion == DictionaryConstants.GCT_T :                        
                  print "GCT_T"
                  print "Points ordered 1, 2 -> 1, 2, derived 3(3/4 length of Line 12)"
      
                  if pointCount < 2 :
      Severity: Major
      Found in military_features/scripts/GeometryConverter.py and 1 other location - About 1 day to fix
      military_features/scripts/GeometryConverter.py on lines 610..636

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

      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

              elif (geoConversion == DictionaryConstants.GCT_PARALLELLINES) or \
                  (geoConversion == DictionaryConstants.GCT_PARALLELLINESMIDLINE)  :    
                  print "GCT_PARALLELLINESMIDLINE"
                  print "Points ordered 1, 2 -> 1, 2, derived 3(at mid point of 1, 2)"
      
      
      Severity: Major
      Found in military_features/scripts/GeometryConverter.py and 1 other location - About 1 day to fix
      military_features/scripts/GeometryConverter.py on lines 691..711

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

      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

      File RefGrid.py has 506 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # coding: utf-8
      '''
      RefGrid.py
      '''
      import re
      Severity: Major
      Found in clearing_operations/scripts/RefGrid.py - About 1 day to fix

        Function NumberFeatures has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
        Open

            def NumberFeatures(self,
                               areaToNumber,
                               pointFeatures,
                               numberingField,
                               outputFeatureClass):
        Severity: Minor
        Found in clearing_operations/scripts/NumberFeaturesTool.py - About 7 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

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

        try:
            
            arcpy.AddMessage("Checking input feature class " + featClass + "...")
        
            hasError = 0
        Severity: Major
        Found in geonames/scripts/CheckInput.py and 1 other location - About 7 hrs to fix
        geonames/scripts/LoadGeonames.py on lines 43..347

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

        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

        try:
            # Defines how many features have to be inserted before it will
            # report status
            reportNum = 10000
            
        Severity: Major
        Found in geonames/scripts/LoadGeonames.py and 1 other location - About 7 hrs to fix
        geonames/scripts/CheckInput.py on lines 34..129

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

        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