localstack-core/localstack/testing/snapshots/transformer_utility.py
File transformer_utility.py
has 720 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import json
import logging
import re
from datetime import datetime
from json import JSONDecodeError
TransformerUtility
has 34 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class TransformerUtility:
@staticmethod
def key_value(
key: str, value_replacement: Optional[str] = None, reference_replacement: bool = True
):
Function _resource_name_transformer
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
Open
def _resource_name_transformer(key: str, val: str) -> str:
if isinstance(val, str):
match = re.match(PATTERN_ARN, val)
if match:
res = match.groups()[-1]
- 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 too many return
statements within this function. Open
Open
return layer_name # noqa
Avoid too many return
statements within this function. Open
Open
return layer_name # noqa
Function secretsmanager_api
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def secretsmanager_api():
return [
KeyValueBasedTransformer(
lambda k, v: (
k
- 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"