• lukasza's avatar
    Fix presubmit_scheme_histograms.py and presubmit_bad_message_reasons.py · 14d9a1a8
    lukasza authored
    This CL fixes presubmit_scheme_histograms.py and
    presubmit_bad_message_reasons.py which after r462591 would always report
    presubmit errors (because it started returning a tuple from HistogramNeedsUpdate
    which always coerces to True in the broken presubmit scripts).
    
    After r462591 HistogramNeedsUpdate effectively checks all
    histogram-enum-related presubmits (both for updating histograms.xml and
    for detecting duplicate values).  Therefore the current CL renames this
    function to CheckPresubmitErrors and makes it return a presubmit error
    (rather than a tuple of (needs_updating, duplicates)).  This refactoring
    has a nice side benefit - after this CL, all presubmits going through
    CheckPresubmitErrors will check for duplicate values (r462591 only added
    this check for UseCounter histograms).
    
    This CL also tweaks content/browser/PRESUBMIT.py so that it applies
    *both* to upload-time and commit-time checks (without this change
    |git cl presubmit| would not hit the checks related to
    content/browser/bad_message.h - they would only be hit when running
    |git cl presubmit --upload|).
    
    Manual testing done:
    - Make changes in content/browser/bad_message.h,
      chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc,
      third_party/WebKit/Source/code/frame
    - Run git cl presubmit and verify that the presubmit
      checks detect 1) duplicates and 2) the need to update histograms.xml
    
    BUG=577772
    TEST=See "Manual testing done" above.
    TBR=sky@chromium.org, jochen@chromium.org, rdevlin.cronin@chromium.org
    
    Review-Url: https://codereview.chromium.org/2841823007
    Cr-Commit-Position: refs/heads/master@{#468003}
    14d9a1a8
PRESUBMIT.py 1.19 KB