Skip to content

refactor: Leverage implicit return statements where appropriate

stephen requested to merge implicit-returns into main

There were several places in the codebase where a method or function returning None would end with an explicit return statement. This is unnecessary, as a method or function without a return statement is assumed to return None, exactly in the same way as a return statement without a value is assumed to return None but without the clutter.

This MR addresses this by removing all needless return statements with only a few exceptions. In one case, in tordonate/civicrm/repository.py, a return statement has been replaced with a raise forms.ValidationError() statement, as it was more appropriate in that case than simply returning nothing. Two other cases in that same file had return replaced with pass as the function in question would otherwise have no body at all.

Merge request reports

Loading