File mocking.py
has 332 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
import math
import random
import re
from datetime import date, datetime
Function generate_arn
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def generate_arn(shape: StringShape):
if not shape.metadata:
return DEFAULT_ARN
def _generate_arn():
- 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 _
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def _(shape: StringShape, graph: ShapeGraph) -> str:
if shape.enum:
return shape.enum[0]
if shape.name in custom_strings:
- 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 sanitize_arn_pattern
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def sanitize_arn_pattern(pattern: str) -> str:
# clown emoji
# some devs were just lazy ...
if pattern in [
Function populate_graph
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def populate_graph(graph: networkx.DiGraph, root: Shape):
stack: List[Shape] = [root]
visited: Set[str] = set()
while stack:
- 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 shape_graph
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def shape_graph(root: Shape) -> ShapeGraph:
graph = networkx.DiGraph()
graph.root = root
populate_graph(graph, root)
- 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
return random.choice(words)
Avoid too many return
statements within this function. Open
return val[: min(max_len, len(val))]
Avoid too many return
statements within this function. Open
return "0" * str_len
Avoid too many return
statements within this function. Open
return "a" * str_len
Avoid too many return
statements within this function. Open
return datetime.now()
Avoid too many return
statements within this function. Open
return random_string