Showing 281 of 281 total issues
Function set_scroll
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def set_scroll(self, guild, channel, floor, room, scroll):
Function populate_event_kingdoms
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def populate_event_kingdoms(self):
current_event_kingdom = self.get_current_event_kingdom_id()
campaign_events = [e for e in self.events if e['type'] == '[CAMPAIGN]' and e['start'] <= datetime.date.today()]
if not campaign_events:
return
- 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 extract_reward_bundles
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def extract_reward_bundles(self, entry):
rewards = []
for reward in entry.get('BundleData', {}):
if reward['RewardType'] == RewardTypes.Troop and reward['RewardData'] in self.troops:
rewards.append({
- 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 edit_floor
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def edit_floor(self, message, floor, room, scroll):
"""
:rtype: tuple[bool, str]
"""
- 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 enrich_kingdoms
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def enrich_kingdoms(self):
for kingdom_id, kingdom_data in self.user_data['pEconomyModel']['KingdomLevelData'].items():
self.kingdoms[int(kingdom_id)]['primary_color'] = COLORS[kingdom_data['Color']]
self.kingdoms[int(kingdom_id)]['primary_stat'] = kingdom_data['Stat']
- 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 extract_runes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def extract_runes(self, runes):
result = {}
for trait in runes:
for rune in trait:
rune_id = rune['Id']
- 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 make_floors_numeric
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def make_floors_numeric(self):
for guild in self.__data.keys():
for channel in self.__data[guild].keys():
# FIXME split up config and tower data, so those checks can be removed
if isinstance(self.__data[guild][channel], dict) and all(
- 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 deep_translate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def deep_translate(cls, data: dict, lang):
for key, item in data.items():
new_key = _(key, lang)
data[new_key] = item
if key != new_key:
- 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 process_news_feed
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def process_news_feed(self) -> None:
"""
fetches the feed, goes through every entry and converts it into
a Discord embed compatible format, then saving the JSON into
the posts file.
- 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 True, f'Set floor {floor} room {room_display} to {scroll_new_display}'
Avoid too many return
statements within this function. Open
return sorted(possible_matches, key=operator.itemgetter(sort_by))
Avoid too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return has_enough_new_style(self.pets)
Avoid too many return
statements within this function. Open
return False, f'Couldn\'t find scroll `{scroll}`.'
Avoid too many return
statements within this function. Open
return kingdom['linked_kingdom_id'] and not kingdom['underworld']
Avoid too many return
statements within this function. Open
return True, '-'
Avoid too many return
statements within this function. Open
return True, f'Replaced floor {floor} room {room_display} to {scroll_new_display} (was {scroll_old_display})'
Function translate_categories
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def translate_categories(categories, lang):
def try_different_translated_versions_because_devs_are_stupid(cat):
lookup = f'[{cat.upper()}S]'
result = _(lookup, lang)
if result == lookup:
- 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 get_shop_rewards
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_shop_rewards(event, lang, emojis):
event['shop_title'] = _('[SHOP]', lang)
event['shop'] = []
total_cost = 0
total = _('[TOTAL]', lang)
- 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 search_talent
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def search_talent(self, search_term, lang):
possible_matches = []
for tree in self.talent_trees.values():
translated_name = extract_search_tag(_(tree['name'], lang))
translated_talents = [_(talent['name'], lang) for talent in tree['talents']]
- 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"