diff options
author | Jack Rosenthal <jrosenth@chromium.org> | 2022-07-18 13:10:36 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-07-19 17:00:47 +0000 |
commit | b6f385a4492b61ab171dcb97e352cf13e3a21b05 (patch) | |
tree | d8e23688b5623c00f528a214845d175347e42335 | |
parent | 3f497875d8f0e5f19962f22ab78157aa3a0c2e85 (diff) | |
download | chrome-ec-b6f385a4492b61ab171dcb97e352cf13e3a21b05.tar.gz |
PRESUBMIT.cfg: Enable black_check and drop custom script
Enable the global PRESUBMIT.cfg option for black pre-upload checks,
and drop our custom script.
isort checks are done by cros lint, so this was redundant in the
custom script.
BUG=b:238434058
BRANCH=none
TEST=Run pre-upload on some recent commits
Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
Change-Id: Ib624b619621654949019541f03ffe35ba69f78b3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3770681
Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
-rw-r--r-- | PRESUBMIT.cfg | 3 | ||||
-rwxr-xr-x | util/python-pre-upload.sh | 49 |
2 files changed, 2 insertions, 50 deletions
diff --git a/PRESUBMIT.cfg b/PRESUBMIT.cfg index c9d0887b23..3aabbe3bb3 100644 --- a/PRESUBMIT.cfg +++ b/PRESUBMIT.cfg @@ -1,4 +1,5 @@ [Hook Overrides] +black_check: true clang_format_check: true branch_check: true checkpatch_check: true @@ -10,6 +11,7 @@ signoff_check: true tab_check: false [Hook Overrides Options] +black_check: --include_regex=^util/chargen$ checkpatch_check: --no-tree --ignore=MSLEEP,VOLATILE,SPDX_LICENSE_TAG kerneldoc_check: --include_regex=\bec_commands\.h$ @@ -29,5 +31,4 @@ presubmit_check = util/presubmit_check.sh config_option_check = util/config_option_check.py host_command_check = util/host_command_check.sh ec_commands_h = util/linux_ec_commands_h_check.sh -python_preupload = util/python-pre-upload.sh ${PRESUBMIT_FILES} migrated_files = util/migrated_files.sh ${PRESUBMIT_FILES} diff --git a/util/python-pre-upload.sh b/util/python-pre-upload.sh deleted file mode 100755 index d560e7b6af..0000000000 --- a/util/python-pre-upload.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -# Copyright 2022 The ChromiumOS Authors. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. -set -e - -PYTHON_FILES=() - -for path in "$@"; do - case "${path}" in - *.py|*.pyi) - PYTHON_FILES+=("${path}") - ;; - util/chargen) - PYTHON_FILES+=("${path}") - ;; - esac -done - -if [ "${#PYTHON_FILES}" -eq 0 ]; then - # No python changes made, do nothing. - exit 0 -fi - -EXIT_STATUS=0 - -# Wraps a black/isort command and reports how to fix it. -wrap_fix_msg() { - local cmd="$1" - shift - - if ! "${cmd}" "$@"; then - cat <<EOF >&2 -Looks like the ${cmd} formatter detected that formatting changes -need applied. Fix by running this command from the platform/ec -directory and amending your changes: - - ${cmd} ${PYTHON_FILES[*]} - -EOF - EXIT_STATUS=1 - fi -} - -# black and isort are provided by repo_tools -wrap_fix_msg black --check "${PYTHON_FILES[@]}" -wrap_fix_msg isort --check "${PYTHON_FILES[@]}" - -exit "${EXIT_STATUS}" |