resource-watch/prep-nexgddp

View on GitHub

Showing 34 of 34 total issues

Avoid too many return statements within this function.
Open

        return jsonify(data=[result]), 200
Severity: Major
Found in nexgddp/routes/api/v1/nexgddp_router.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return error(status=400, detail=e.message)
    Severity: Major
    Found in nexgddp/routes/api/v1/nexgddp_router.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return error(status=404, detail='Table name not valid')
      Severity: Major
      Found in nexgddp/routes/api/v1/nexgddp_router.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return error(status=400, detail=e.message)
        Severity: Major
        Found in nexgddp/routes/api/v1/nexgddp_router.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return error(status=400, detail=e.message)
          Severity: Major
          Found in nexgddp/routes/api/v1/nexgddp_router.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return error(status=400, detail='No coordinates provided. Include geostore or lat & lon')
            Severity: Major
            Found in nexgddp/routes/api/v1/nexgddp_router.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                              return jsonify(data=query_results), 200
              Severity: Major
              Found in nexgddp/routes/api/v1/nexgddp_router.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return error(status=400, detail=e.message)
                Severity: Major
                Found in nexgddp/routes/api/v1/nexgddp_router.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return error(status=400, detail=e.message)
                  Severity: Major
                  Found in nexgddp/routes/api/v1/nexgddp_router.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return jsonify(data=output), 200
                    Severity: Major
                    Found in nexgddp/routes/api/v1/nexgddp_router.py - About 30 mins to fix

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

                      def worker_int(worker):
                          worker.log.info("worker received INT or QUIT signal")
                      
                          ## get traceback info
                          import threading, sys, traceback
                      Severity: Minor
                      Found in gunicorn.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 get_bbox_by_hash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def get_bbox_by_hash(func):
                          """Get geodata"""
                      
                          @wraps(func)
                          def wrapper(*args, **kwargs):
                      Severity: Minor
                      Found in nexgddp/middleware.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 get_latlon has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def get_latlon(func):
                          """Get geodata"""
                      
                          @wraps(func)
                          def wrapper(*args, **kwargs):
                      Severity: Minor
                      Found in nexgddp/middleware.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 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

                      Severity
                      Category
                      Status
                      Source
                      Language