agrenott/pyhgtmap

View on GitHub

Showing 56 of 56 total issues

Function transform_lon_lats has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def transform_lon_lats(
Severity: Minor
Found in pyhgtmap/hgt/__init__.py - About 35 mins to fix

    Function write_nodes has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def write_nodes(
    Severity: Minor
    Found in pyhgtmap/output/osmUtil.py - About 35 mins to fix

      Function makeVersionChunk has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def makeVersionChunk(self, first=False):
              data = []
              # version
              data.append(int2str(1))
              # timestamp = self.timestamp or 0, if self.timestamp, write changeset and
      Severity: Minor
      Found in pyhgtmap/output/o5mUtil.py - About 35 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

      Avoid too many return statements within this function.
      Open

                  return None
      Severity: Major
      Found in pyhgtmap/NASASRTMUtil.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return True, True
        Severity: Major
        Found in pyhgtmap/NASASRTMUtil.py - About 30 mins to fix

          Function get_transform has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def get_transform(
              file_proj: osr.SpatialReference, reverse=False
          ) -> TransformFunType | None:
              """
              Returns a function to transform coordinate system of a list of points,
          Severity: Minor
          Found in pyhgtmap/hgt/file.py - About 25 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

          Function parse_hgt_filename has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def parse_hgt_filename(
              filename: str,
              corrx: float,
              corry: float,
          ) -> BBox:
          Severity: Minor
          Found in pyhgtmap/hgt/file.py - About 25 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

          Function __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def __init__(
                  self,
                  fName: str,
                  osmVersion: float,
                  pyhgtmap_version: str,
          Severity: Minor
          Found in pyhgtmap/output/osmUtil.py - About 25 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

          Function check_cached_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def check_cached_file(self, file_name: str, resolution: int) -> None:
                  """
                  Check HGT file exists and its size corresponds to current resolution.
                  Raises exception if not.
                  Only check existence of TIF file.
          Severity: Minor
          Found in pyhgtmap/sources/__init__.py - About 25 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

          Function try_parallelizing has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def try_parallelizing(self, func: Callable, *args, **kwargs) -> None:
                  """
                  Try to parallelize func over multiple processes if enabled, else execute in current process.
                  """
                  if self.parallel and not self.single_output:
          Severity: Minor
          Found in pyhgtmap/hgt/processor.py - About 25 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

          Function parse_geotiff_bbox has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def parse_geotiff_bbox(
              filename: str,
              corrx: float,
              corry: float,
              doTransform: bool,
          Severity: Minor
          Found in pyhgtmap/hgt/file.py - About 25 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

          Function gdrive has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def gdrive(self) -> GoogleDrive:
                  """Lazily connect to Google Drive API, using OAuth2."""
                  # Ensure config drectory exists
                  pathlib.Path(self.config_dir).mkdir(parents=True, exist_ok=True)
          
          
          Severity: Minor
          Found in pyhgtmap/sources/sonny.py - About 25 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

          Function process_files has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def process_files(self, files: list[tuple[str, bool]]) -> None:
                  """Main entry point of this class, processing a bunch of HGT files.
          
                  Args:
                      files (List[Tuple[str, bool]]): List of [source file name, check poly toggle]
          Severity: Minor
          Found in pyhgtmap/hgt/processor.py - About 25 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

          Function parseSRTMv3CoverageKml has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def parseSRTMv3CoverageKml(kmlContents):
              polygons = []
              # KML file is pure XML
              polygonSoup = BeautifulSoup(kmlContents, "lxml-xml").findAll("Polygon")
              for p in polygonSoup:
          Severity: Minor
          Found in pyhgtmap/NASASRTMUtil.py - About 25 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

          Function download_missing_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def download_missing_file(
                  self,
                  area: str,
                  resolution: int,
                  output_file_name: str,
          Severity: Minor
          Found in pyhgtmap/sources/viewfinder.py - About 25 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

          Function writeNodes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def writeNodes(
              output: Output,
              tile_contours: TileContours,
              timestampString,  # dummy option
              start_node_id,
          Severity: Minor
          Found in pyhgtmap/output/o5mUtil.py - About 25 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

          Severity
          Category
          Status
          Source
          Language