Showing 809 of 809 total issues
Function get_user_id
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def get_user_id(self, user_name: str) -> str:
@with_session
def _get_user_name(session=None):
user = session.query(Users).filter(Users.name == user_name).first()
if user is 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 publish
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def publish(self, message: dict, topic: str = None) -> None:
if self.recently_sent_has(topic, message['id']):
self.logger.debug('ignoring external event with verb %s and id %s, already sent' %
(message['verb'], message['id']))
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
Avoid too many return
statements within this function. Open
Open
return True
Avoid too many return
statements within this function. Open
Open
return True
Avoid too many return
statements within this function. Open
Open
return False, ErrorCodes.NOT_ALLOWED_TO_WHISPER_SELF
Avoid too many return
statements within this function. Open
Open
return api_response(200)
Avoid too many return
statements within this function. Open
Open
e=j([2e3,1]).day(d),c&&!this._fullWeekdaysParse[d]&&(this._fullWeekdaysParse[d]=new RegExp("^"+this.weekdays(e,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[d]=new RegExp("^"+this.weekdaysShort(e,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[d]=new RegExp("^"+this.weekdaysMin(e,"").replace(".",".?")+"$","i")),this._weekdaysParse[d]||(f="^"+this.weekdays(e,"")+"|^"+this.weekdaysShort(e,"")+"|^"+this.weekdaysMin(e,""),this._weekdaysParse[d]=new RegExp(f.replace(".",""),"i")),c&&"dddd"===b&&this._fullWeekdaysParse[d].test(a))return d;if(c&&"ddd"===b&&this._shortWeekdaysParse[d].test(a))return d;if(c&&"dd"===b&&this._minWeekdaysParse[d].test(a))return d;if(!c&&this._weekdaysParse[d].test(a))return d}}
Avoid too many return
statements within this function. Open
Open
return api_response(200)
Avoid too many return
statements within this function. Open
Open
return success == 1, ErrorCodes.OK
Avoid too many return
statements within this function. Open
Open
return api_response(200, user)
Avoid too many return
statements within this function. Open
Open
return msg
Avoid too many return
statements within this function. Open
Open
return True
Avoid too many return
statements within this function. Open
Open
return True, None, session
Avoid too many return
statements within this function. Open
Open
return False, ErrorCodes.NOT_ALLOWED_TO_WHISPER_TURNED_OFF
Avoid too many return
statements within this function. Open
Open
return api_response(200)
Avoid too many return
statements within this function. Open
Open
return is_valid
Avoid too many return
statements within this function. Open
Open
return api_response(400, message='could not create acl for room %s: %s' % (room_uuid, str(e)))
Avoid too many return
statements within this function. Open
Open
return False
Avoid too many return
statements within this function. Open
Open
return False
Avoid too many return
statements within this function. Open
Open
return api_response(400, message='could not create acl for channel %s: %s' % (channel_uuid, str(e)))