resource-watch/prep-nexgddp

View on GitHub
nexgddp/services/query_service.py

Summary

Maintainability
C
1 day
Test Coverage
F
39%

File query_service.py has 373 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""QUERY SERVICE"""

import logging
import os
import tempfile
Severity: Minor
Found in nexgddp/services/query_service.py - About 4 hrs to fix

    Function get_tile_diff_query has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def get_tile_diff_query(bbox, year, model, scenario, indicator, bounds, year_b, dset_b):
    Severity: Major
    Found in nexgddp/services/query_service.py - About 50 mins to fix

      Function get_all_data has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_all_data(scenario, model, years, bbox):
              logging.info('[QueryService] Getting * data from rasdaman')
              year_min = sorted(years)[0]
              year_max = sorted(years)[-1]
              results = []
      Severity: Minor
      Found in nexgddp/services/query_service.py - About 45 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 get_tile_query has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def get_tile_query(bbox, year, model, scenario, indicator, bounds):
      Severity: Minor
      Found in nexgddp/services/query_service.py - About 35 mins to fix

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

            def get_stats(scenario, model, years, indicator, bbox, function):
        Severity: Minor
        Found in nexgddp/services/query_service.py - About 35 mins to fix

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

              def get_tile_mask_query(bbox, year, model, scenario, indicator, no_data):
          Severity: Minor
          Found in nexgddp/services/query_service.py - About 35 mins to fix

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

                def get_temporal_series(scenario, model, years, indicator, bbox):
                    logging.info('[QueryService] Getting temporal series from rasdaman')
                    year_min = sorted(years)[0].replace("'", '') if type(sorted(years)[0]) == 'string' else sorted(years)[0]
                    year_max = sorted(years)[-1].replace("'", '') if type(sorted(years)[-1]) == 'string' else sorted(years)[-1]
                    logging.info(year_min)
            Severity: Minor
            Found in nexgddp/services/query_service.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

            There are no issues that match your filters.

            Category
            Status