Useless `return` detectedPYL-R1711
A single return
or return None
statement is found at the end of the function or method definition. This statement can safely be removed to improve the readability because Python will implicitly return None
.
Bad practice
def log_data(data):
'''Sends the data to our logging API.'''
api = get_api()
api.send(data)
return # Unnecessary return
def print_pattern():
print('*')
print('**')
print('***')
return None # Unnecessary return
Recommended
def log_data(data):
'''Sends the data to our logging API.'''
api = get_api()
api.send(data)
def print_pattern():
print('*')
print('**')
print('***')