views.py
File views.py
has 610 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import datetime
import math
import discord
from jinja2 import Environment, FileSystemLoader
Function render_events
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
def render_events(self, events, _filter, lang):
e = discord.Embed(title=_('[EVENTS]', lang), color=self.WHITE)
message_lines = []
last_event_date = events[0]['start']
for event in events:
- 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 render_team
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
def render_team(self, team, author, shortened, lengthened, title=None):
color = discord.Color.from_rgb(*RARITY_COLORS['Mythic'])
e = discord.Embed(color=color)
if team['banner']:
thumbnail_url = f'{CONFIG.get("graphics_url")}/Banners/Banners_{team["banner"]["filename"]}_full.png'
- 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 render_class_level
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def render_class_level(self, lower_level, upper_level, xp_required, speeds, lang):
Function render_team
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def render_team(self, team, author, shortened, lengthened, title=None):
Function render_current_event
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def render_current_event(self, current_event, shortened, lengthened, lang):
invalid syntax (<unknown>, line 498)</unknown> Open
Open
if details := author_details.get(author):
- Read upRead up
- Exclude checks
Used when a syntax error is raised for a module.