• Vaclav Brozek's avatar
    Add presubmit for Java against *ForTesting in production · 7dbc28c9
    Vaclav Brozek authored
    For (Objective-)C++, there is
    _CheckNoProductionCodeUsingTestOnlyFunctions in //PRESUBMIT.py which
    can detect when a method with a ForTesting suffix is referenced in
    production code.
    
    This bug tracks adding such similar presubmit check for production
    .java files, which are approximated as .java files with no "test"
    or "junit" in the path and filename.
    
    The check is a modified copy of the one for C++. It does not attempt
    to share code with the C++ check, because some details are simpler for
    Java (e.g., no need to consider *_for_testing as well). The check is
    just a presubmit prompt, not error, because there are false positives
    to be expected.
    
    Bug: 821981
    Change-Id: I3bb137197070ac696fbe0fd35d50abbfb823a8d8
    Reviewed-on: https://chromium-review.googlesource.com/977581Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
    Reviewed-by: default avataragrieve <agrieve@chromium.org>
    Reviewed-by: default avatarBernhard Bauer <bauerb@chromium.org>
    Commit-Queue: Vaclav Brozek <vabr@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#546063}
    7dbc28c9
PRESUBMIT_test.py 58.8 KB