Esri/solutions-geoprocessing-toolbox

View on GitHub

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

      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

      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

        Function RotateFeatureClass has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
        Open

        def RotateFeatureClass(inputFC, outputFC,
                               angle=0, pivot_point=None):
            """Rotate Feature Class
        
            inputFC     Input features
        Severity: Minor
        Found in clearing_operations/scripts/GRGUtilities.py - About 6 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

        File GRGTools.py has 439 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: Minor
        Found in clearing_operations/scripts/GRGTools.py - About 6 hrs to fix

          Function GRGFromPoint has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
          Open

          def GRGFromPoint(starting_point,
                           horizontal_cells,
                           vertical_cells,
                           cell_width,
                           cell_height,
          Severity: Minor
          Found in clearing_operations/scripts/GRGUtilities.py - About 5 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

          Function SymbolNametoSymbolIDExt has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
          Open

              def SymbolNametoSymbolIDExt(self, symbolName, echelonString, affiliation, expectedGeometry) :
          
                  # Attempts to handle the many name cases that show up in Military Features
                  # A straight Dictionary Name to SIDC case should always work, but the names
                  # don't always show up in that form, use SymbolNametoSymbolID for simple case
          Severity: Minor
          Found in military_features/scripts/SymbolDictionary.py - About 4 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

          Function _ZonesDictionary has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
          Open

          def _ZonesDictionary():
            '''
            The zonesDictionary object has 1197 unique keys (one for eqch MGRS grid zone).
            Rather than load it through a single, large json text file, we build it here programmatically, one time, on the client
            '''
          Severity: Minor
          Found in clearing_operations/scripts/RefGrid.py - About 4 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

          Function Build has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
          Open

            def Build(self, out_features):
              '''
              '''
          
              def _createFC(out_feature_path, geometry_type, spatial_reference):
          Severity: Minor
          Found in clearing_operations/scripts/RefGrid.py - About 4 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

          Function _handle100kGrids has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

          def _handle100kGrids(args, AOI):
            '''
            Creates 100K meter grids
            '''
            zonePolygon = args['polygon']
          Severity: Minor
          Found in clearing_operations/scripts/RefGrid.py - About 4 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

          File SymbolDictionary.py has 335 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: Minor
          Found in military_features/scripts/SymbolDictionary.py - About 4 hrs to fix

            SymbolDictionary has 25 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class SymbolDictionary(object):
                """ 
                Lookup methods & helpers for mappings between SIDC, Name, GeometryType, etc.
                Generally just does a straight lookup of the dictionary data file with
                some attempts to correct common lookup errors (ex. not including "H" when
            Severity: Minor
            Found in military_features/scripts/SymbolDictionary.py - About 2 hrs to fix

              Function CalculateSunPosition has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

              def CalculateSunPosition(date, observerPoint):
              
                  if debug == True:
                      arcpy.AddMessage("Determining sun position for date: " + str(date))
              
              
              Severity: Minor
              Found in sun_position_analysis/scripts/spa.py - 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

              Consider simplifying this complex logical expression.
              Open

                      if (ch == 'F') or (ch == 'H') or (ch == 'U') or (ch == 'N') :
                          return ch
                      elif (ch == 'M') or (ch == 'A') or (ch == 'D') or (ch == 'J') or (ch == 'K') :
                          return 'F'
                      elif (ch == 'S') :
              Severity: Critical
              Found in military_features/scripts/SymbolDictionary.py - About 2 hrs to fix
                Severity
                Category
                Status
                Source
                Language