• Tom McKee's avatar
    Harden _PresubmitResult against varying string types · 61c72651
    Tom McKee authored
    When presubmit checks fail, we want to print the error message from the
    underlying check/tool. We use _PresubmitResult objects to collect these
    diagnostics and output them to the console and json files.
    
    This change ensures that the string values passed to the
    _PresubmitResult constructor will be converted, as needed, to 'str'
    instances. This way, we will avoid encoding errors and make sure to
    print the actual messages instead of repr(message).
    
    SHERIFFS: this patch breaks backwards compatibility of presubmit error
    handling but we don't expect issues in downstream projects. Please
    revert if downstream presubmit checks start failing spuriously.
    
    Bug: 1225052
    Change-Id: If7f5c99cb5d730c1bfbd6d108b912f77b5f2455c
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3037262
    Commit-Queue: Tom McKee <tommckee@chromium.org>
    Reviewed-by: 's avatarDirk Pranke <dpranke@google.com>
    61c72651
presubmit_support.py 72.2 KB