Don't call handle_file() if a patched file can't be fetched.

Review Request #11547 — Created March 22, 2021 and submitted — Latest diff uploaded

Information

ReviewBot
release-3.0.x

Reviewers

All tools that implement handle_file() were calling
get_patched_file_path() on the reviewed file, and returning early if
it was None. Rather than do this in each handle_file() method, it
makes more sense to do it in handle_files(), before calling
handle_file().

This change switches to that, and passes in the resulting path as a
path variable, so handle_file() can operate on it.

We don't perform the check or pass in path for legacy tools, since the
old handle_file() didn't accept **kwargs and wouldn't expect it.

To handle the legacy tool check, the old base classes now set a
legacy_tool attribute, which the inner class can check. This is
admittedly pretty hacky, but won't exist past Review Bot 3.0, and is
easier to maintain than forking these methods into the old base classes.

Unit tests pass on Python 2.7 and 3.x.

Commits

Files