File api.py
has 381 lines of code (exceeds 250 allowed). Consider refactoring. Open
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
Function _send_chart_response
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def _send_chart_response(
self,
result: dict[Any, Any],
form_data: dict[str, Any] | None = None,
datasource: BaseDatasource | Query | None = None,
- Read upRead up
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_data
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_data(self, pk: int) -> Response:
"""
Take a chart ID and uses the query context stored when the chart was saved
to return payload data response.
---
- Read upRead up
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 data
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def data(self) -> Response:
"""
Take a query context constructed in the client and return payload
data response for the given query
---
- Read upRead up
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_data_response
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _get_data_response(
Avoid too many return
statements within this function. Open
return Response(
Avoid too many return
statements within this function. Open
return self._run_async(json_body, command)
Avoid too many return
statements within this function. Open
return self.response_400(message=f"Unsupported result_format: {result_format}")
Avoid too many return
statements within this function. Open
return self._get_data_response(
Avoid too many return
statements within this function. Open
return self._run_async(json_body, command)
Avoid too many return
statements within this function. Open
return self._get_data_response(
Avoid too many return
statements within this function. Open
return resp
Avoid too many return
statements within this function. Open
return self.response_400(