Function simulate_call
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def simulate_call(service: str, op: str) -> RowEntry:
"""generates a mock request based on the service and operation model and sends it to the API"""
client = connect_externally_to.get_client(
service,
aws_access_key_id="test",
- 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
File capture_notimplemented_responses.py
has 322 lines of code (exceeds 250 allowed). Consider refactoring. Open
import csv
import json
import logging
import re
import sys
Function map_to_notimplemented
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def map_to_notimplemented(row: RowEntry) -> bool:
"""
Some simple heuristics to check the API responses and classify them into implemented/notimplemented
Ideally they all should behave the same way when receiving requests for not yet implemented endpoints
- 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 run_script
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def run_script(services: list[str], path: None):
"""send requests against all APIs"""
print(
f"writing results to '{path}implementation_coverage_full.csv' and '{path}implementation_coverage_aggregated.csv'..."
)
- 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
Avoid deeply nested control flow statements. Open
if result.get("error_code", "") != "InternalError":
break
if argument in parameters:
Avoid deeply nested control flow statements. Open
if argument in parameters:
# sometimes the parameter seem to be automatically added again by boto
# happened eg for ClientToken in ec2.ProvisionIpamPoolCidr
logging.warning(
"unexpected keyword '%s' was added to the parameters again for: %s.%s",
Avoid too many return
statements within this function. Open
return True
Avoid too many return
statements within this function. Open
return True
Avoid too many return
statements within this function. Open
return True
Avoid too many return
statements within this function. Open
return True
Avoid too many return
statements within this function. Open
return True
Avoid too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return True
Avoid too many return
statements within this function. Open
return True
Avoid too many return
statements within this function. Open
return True