[PSA] Changes in presubmit API

923 views
Skip to first unread message

Josip Sokcevic

unread,
Jul 21, 2020, 2:54:49 PM7/21/20
to infra-a...@chromium.org

Hi all,


tl;dr Please update your PRESUBMIT checks to use the new API parameters by September 15th.


In order to align with Inclusive Chromium Code, we recently added inclusive parameters to our presubmit API. Note that old parameter names are still available, but we plan to remove them by the end of Q3 2020. We will start issuing warnings when old parameters are used in early August.


Here is overview of relevant changes (diff input_api, diff canned_checks):


Changes in constant names

input_api.DEFAULT_ALLOW_LIST -> input_api.DEFAULT_FILES_TO_CHECK

input_api.DEFAULT_BLACK_LIST -> input_api.DEFAULT_FILES_TO_SKIP


Changes in named parameters

input_api.FilterSourceFile, white_list -> files_to_check, black_list -> files_to_skip

input_api.canned_checks.GetUnitTestsInDirectory, whitelist -> files_to_check, blacklist -> files_to_skip

input_api.canned_checks.GetUnitTestsRecursively, whitelist -> files_to_check, blacklist -> files_to_skip

input_api.canned_checks.GetPylint, white_list -> files_to_check, black_list -> files_to_skip


- Chops source team

Josip Sokcevic

unread,
Aug 3, 2020, 5:35:43 PM8/3/20
to infra-a...@chromium.org
Hi all,

The warning will be implemented in the next few weeks. To make the transition easier, you can execute attached bash script in repositories that your team owns. Note that the script is very basic and may produce undesired results so double check them.

#!/bin/bash
set -e

# Find potential usages
files=$(git grep -w -l \
  -e DEFAULT_ALLOW_LIST \
  -e DEFAULT_BLACK_LIST \
  -e DEFAULT_BLOCK_LIST \
  -e DEFAULT_WHITE_LIST \
  -e DEFAULT_WHITE_LIST \
  -e DEFAULT_WHITE_LIST \
  -e FilterSourceFile \
  -e GetUnitTestsInDirectory \
  -e GetUnitTestsRecursively \
  -e GetPylint)

for f in $files; do
  echo "Processing file $f"
  sed -i \
    -e 's/DEFAULT_ALLOW_LIST/DEFAULT_FILES_TO_CHECK/g' \
    -e 's/DEFAULT_WHITE_LIST/DEFAULT_FILES_TO_CHECK/g' \
    -e 's/DEFAULT_BLACK_LIST/DEFAULT_FILES_TO_SKIP/g' \
    -e 's/DEFAULT_BLOCK_LIST/DEFAULT_FILES_TO_SKIP/g' \
    -e 's/\bwhite_list\b/files_to_check/g' \
    -e 's/\bwhitelist\b/files_to_check/g' \
    -e 's/\bblack_list\b/files_to_skip/g' \
    -e 's/\bblacklist\b/files_to_skip/g' \
    $f
done

--
Josip Sokcevic
Reply all
Reply to author
Forward
0 new messages