Showing 3,154 of 3,154 total issues
LogsApi
has 74 functions (exceeds 20 allowed). Consider refactoring. Open
class LogsApi:
service = "logs"
version = "2014-03-28"
@handler("AssociateKmsKey")
File provider.py
has 610 lines of code (exceeds 250 allowed). Consider refactoring. Open
import base64
import json
import logging
from datetime import datetime, timezone
from typing import Optional
Function matches_event
has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring. Open
def matches_event(event_pattern: dict[str, any], event: dict[str, Any]) -> bool:
"""Decides whether an event pattern matches an event or not.
Returns True if the `event_pattern` matches the given `event` and False otherwise.
Implements "Amazon EventBridge event patterns":
- 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
SesApi
has 71 functions (exceeds 20 allowed). Consider refactoring. Open
class SesApi:
service = "ses"
version = "2010-12-01"
@handler("CloneReceiptRuleSet")
Route53Api
has 70 functions (exceeds 20 allowed). Consider refactoring. Open
class Route53Api:
service = "route53"
version = "2013-04-01"
@handler("ActivateKeySigningKey")
File __init__.py
has 594 lines of code (exceeds 250 allowed). Consider refactoring. Open
from datetime import datetime
from typing import Dict, List, Optional, TypedDict
from localstack.aws.api import RequestContext, ServiceException, ServiceRequest, handler
Function parse_additional_flags
has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring. Open
def parse_additional_flags(
additional_flags: str,
env_vars: Optional[Dict[str, str]] = None,
labels: Optional[Dict[str, str]] = None,
mounts: Optional[List[SimpleVolumeBind]] = 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 _add_paths
has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring. Open
def _add_paths(self, spec, resources, with_extension):
for item in resources.get("items"):
path = item.get("path")
for method, method_config in item.get("resourceMethods", {}).items():
method = method.lower()
- 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 provider.py
has 591 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
import os
import re
import threading
from datetime import datetime, timezone
Route53ResolverApi
has 68 functions (exceeds 20 allowed). Consider refactoring. Open
class Route53ResolverApi:
service = "route53resolver"
version = "2018-04-01"
@handler("AssociateFirewallRuleGroup")
File testutil.py
has 583 lines of code (exceeds 250 allowed). Consider refactoring. Open
import glob
import importlib
import io
import json
import os
File models.py
has 581 lines of code (exceeds 250 allowed). Consider refactoring. Open
import hashlib
import logging
from collections import defaultdict
from datetime import datetime
from secrets import token_urlsafe
S3Provider
has 67 functions (exceeds 20 allowed). Consider refactoring. Open
class S3Provider(S3Api, ServiceLifecycleHook):
@staticmethod
def get_store(account_id: Optional[str] = None, region: Optional[str] = None) -> S3Store:
return s3_stores[account_id or DEFAULT_AWS_ACCOUNT_ID][region or AWS_REGION_US_EAST_1]
Function _add_paths
has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring. Open
def _add_paths(self, spec, resources, with_extension):
for item in resources.get("items"):
path = item.get("path")
for method, method_config in item.get("resourceMethods", {}).items():
method = method.lower()
- 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
LambdaApi
has 66 functions (exceeds 20 allowed). Consider refactoring. Open
class LambdaApi:
service = "lambda"
version = "2015-03-31"
@handler("AddLayerVersionPermission")
Function run_server
has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring. Open
def run_server(
port: int,
bind_addresses: List[str],
handler: Callable = None,
asynchronous: bool = True,
- 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 __init__.py
has 554 lines of code (exceeds 250 allowed). Consider refactoring. Open
from typing import Dict, List, Optional, TypedDict
from localstack.aws.api import RequestContext, ServiceException, ServiceRequest, handler
Boolean = bool
File cluster.py
has 552 lines of code (exceeds 250 allowed). Consider refactoring. Open
import dataclasses
import logging
import os
import threading
from typing import Dict, List, NamedTuple, Optional, Tuple
OpensearchApi
has 63 functions (exceeds 20 allowed). Consider refactoring. Open
class OpensearchApi:
service = "opensearch"
version = "2021-01-01"
@handler("AcceptInboundConnection")
File aws_s3_bucket.py
has 536 lines of code (exceeds 250 allowed). Consider refactoring. Open
# LocalStack Resource Provider Scaffolding v2
from __future__ import annotations
import re
from pathlib import Path