Showing 16 of 21 total issues
File bikes.py
has 436 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
Bike Related Views
-------------------------
Handles all the bike CRUD
File users.py
has 368 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
User Related Views
-------------------------
Handles all the user CRUD
Function returns
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def returns(
schema: Optional[Schema] = None, return_code: HTTPException = web.HTTPOk,
**named_schema: Union[Schema, Tuple[Optional[Schema], HTTPException]]
):
"""
- 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 resolve_match_map
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def resolve_match_map(request: Request, match_map) -> Dict[str, Any]:
resolved_matches = {}
errors = []
for key, value in match_map.items():
- 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 match_getter
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def match_getter(getter_function, *injection_parameters: Union[str, Optional],
**match_map: Union[str, GetFrom, Optional, Tuple[str, type]]):
"""
Automatically fetches and includes an item, or 404's if it doesn't exist.
- 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 expects
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def expects(schema: Optional[Schema], into="data"):
"""
A decorator that asserts that the JSON data supplied
to the route validates the given :class:`~marshmallow.Schema`.
- 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 subscribe
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def subscribe(self, target: Union[Callable, EventEmitter], handler: Callable):
"""
:param target: The event to listen for.
:param handler: The event handler.
"""
- 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 assert_fields
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def assert_fields(self, data, **kwargs):
"""
Asserts that, according to the specification:
- the ``data`` field is included when the status is :attr:`~JSendStatus.SUCCESS` or :attr:`~JSendStatus.FAIL`
- 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 build_app
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def build_app(db_uri=None):
"""Sets up the app and installs uvloop."""
app = web.Application(middlewares=[SentryMiddleware(), validate_token_middleware])
uvloop.install()
- 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 serialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def serialize(
Function _rental_ended
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _rental_ended(self, user, bike, location, price, distance):
Function rental_ended
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def rental_ended(self, user: User, bike: Bike, location: Point, price: float, distance: float):
Function __getattr__
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def __getattr__(self, item: str):
"""Intercepts getattribute and raises if the event does not exist."""
for event_list in self._event_lists:
try:
event = getattr(event_list, item)
- 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 None
Avoid too many return
statements within this function. Open
return cls.DISCONNECTED
Avoid too many return
statements within this function. Open
return new_func