Showing 17 of 17 total issues
Api
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class Api(object):
"""A Python interface to the DHIS2 API
Example usage:
Function get_sqlview
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def get_sqlview(
self,
uid: str,
execute: bool = False,
var: dict = 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_paged
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def get_paged(
self,
endpoint: str,
params: Union[dict, List[tuple]] = None,
page_size: Union[int, str] = 50,
- 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 post_partitioned
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def post_partitioned(
self,
endpoint: str,
json: dict,
params: Union[dict, List[tuple]] = 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 _validate_request
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _validate_request(
endpoint: str,
file_type: str = "json",
data: dict = None,
params: Union[dict, List[tuple]] = 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 import_response_ok
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def import_response_ok(response: dict) -> bool:
"""
Assess DHIS2 response for import of events / trackedEntityInstances / metadata / dataValues.
Useful if a `requests.Response` returns HTTP 200 OK but the response dict reports ignored values.
:param response: The response of an import request.
- 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 _make_request
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _make_request(
self, method: str, endpoint: str, **kwargs: Any
) -> requests.Response:
"""
Do the actual request with supplied HTTP method
- 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 _set_log_format
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _set_log_format(color: bool, include_caller: bool) -> str:
"""
Set log format
:param color: Log message is colored
:param include_caller: At the end, put a [caller:line-of-code], e.g. [script:123]
- 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 __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function get
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get(
Function get_sqlview
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_sqlview(
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, status_ok: bool, imported: int, deleted: int, ignored: int, updated: int):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function search_auth_file
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def search_auth_file(filename: str = "dish.json") -> str:
"""
Search filename in
- A) DHIS_HOME (env variable)
- B) current user's home folder
- 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 set_api_version
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def set_api_version(self, number: Union[str, int]) -> None:
if number:
try:
i = int(number)
if i < 25:
- 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 clean_obj
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def clean_obj(
obj: Union[list, dict], remove: Union[Collection, str]
) -> Union[list, dict]:
"""
Recursively remove keys from list/dict/dict-of-lists/list-of-keys/nested ...,
- 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 set_base_url
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_base_url(self, server: str) -> None:
if "/api" in server:
raise ClientException("Do not include /api/ in the DHIS2 `server` argument")
server = server.strip()
- 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"