This is an automated email from the ASF dual-hosted git repository.
tlopex pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new ab4ddd234d [CI] Remove legacy lint scripts and Apache RAT (#18848)
ab4ddd234d is described below
commit ab4ddd234d08f222f68a8a797c5e3b22f58ad430
Author: Tianqi Chen <[email protected]>
AuthorDate: Sat Feb 28 10:20:11 2026 -0500
[CI] Remove legacy lint scripts and Apache RAT (#18848)
## Summary
Remove legacy lint scripts from `tests/lint/` that are now redundant
with the
pre-commit + ruff workflow. Also remove Apache RAT and Java from the
Docker
lint image since ASF header checking is now handled by Python directly.
## Changes
- Delete 8 legacy lint scripts (`cpplint.sh`, `pylint.sh`, `flake8.sh`,
etc.)
and their configs (`pylintrc`, `rat-excludes`)
- Simplify `task_lint.sh` and `docker/lint.sh` to delegate to pre-commit
- Remove RAT/Java install from `Dockerfile.ci_lint` and legacy pip
packages
(`cpplint`, `pylint`, `mypy`, `black`, `flake8`, `blocklint`)
---
ci/scripts/jenkins/git_skip_ci_globs.py | 2 +-
docker/Dockerfile.ci_lint | 10 +-
docker/install/ubuntu_install_rat.sh | 38 -------
docker/lint.sh | 18 +---
tests/lint/add_asf_header.py | 23 -----
tests/lint/check_asf_header.py | 2 +-
tests/lint/check_file_type.py | 171 +++++---------------------------
tests/lint/cppdocs.sh | 34 -------
tests/lint/cpplint.sh | 28 ------
tests/lint/docker-format.sh | 34 -------
tests/lint/pylintrc | 18 ----
tests/lint/rat-excludes | 19 ----
tests/lint/trailing_newlines.py | 22 ----
tests/scripts/ci.py | 2 +-
tests/scripts/task_lint.sh | 60 -----------
15 files changed, 30 insertions(+), 451 deletions(-)
diff --git a/ci/scripts/jenkins/git_skip_ci_globs.py
b/ci/scripts/jenkins/git_skip_ci_globs.py
index 651bbeac7c..90970eecc6 100755
--- a/ci/scripts/jenkins/git_skip_ci_globs.py
+++ b/ci/scripts/jenkins/git_skip_ci_globs.py
@@ -31,7 +31,7 @@ globs = [
"NOTICE",
"KEYS",
"tests/lint/*",
- "tests/scripts/task_lint.sh",
+ ".pre-commit-config.yaml",
]
diff --git a/docker/Dockerfile.ci_lint b/docker/Dockerfile.ci_lint
index 45106d8abd..1b591d9efd 100644
--- a/docker/Dockerfile.ci_lint
+++ b/docker/Dockerfile.ci_lint
@@ -45,14 +45,7 @@ ENV VIRTUAL_ENV=${TVM_VENV}
# Disable .local directory from affecting CI.
ENV PYTHONNOUSERSITE=1
-RUN uv pip install cpplint==1.6.1 pylint==2.17.2 mypy==0.902 black==22.12.0
flake8==3.9.2 blocklint==0.2.3 jinja2==3.0.3
-
-# java deps for rat
-COPY install/ubuntu_install_java.sh /install/ubuntu_install_java.sh
-RUN bash /install/ubuntu_install_java.sh
-
-COPY install/ubuntu_install_rat.sh /install/ubuntu_install_rat.sh
-RUN bash /install/ubuntu_install_rat.sh
+RUN uv pip install jinja2==3.0.3
COPY install/ubuntu_install_clang_format.sh
/install/ubuntu_install_clang_format.sh
RUN bash /install/ubuntu_install_clang_format.sh
@@ -60,6 +53,5 @@ RUN bash /install/ubuntu_install_clang_format.sh
COPY install/ubuntu_install_nodejs.sh /install/ubuntu_install_nodejs.sh
RUN bash /install/ubuntu_install_nodejs.sh
-# To prevent `black` command line errors caused by ASCII encoding
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
diff --git a/docker/install/ubuntu_install_rat.sh
b/docker/install/ubuntu_install_rat.sh
deleted file mode 100755
index d0b10023b3..0000000000
--- a/docker/install/ubuntu_install_rat.sh
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-set -e
-set -u
-set -o pipefail
-
-WORK_DIR="$(mktemp -d)"
-cleanup() {
- rm -rf "${WORK_DIR}"
-}
-trap cleanup 0
-
-cd "${WORK_DIR}"
-RAT_VERSION="0.17"
-RAT_ARCHIVE="apache-rat-${RAT_VERSION}-bin.tar.gz"
-RAT_BASE_URL="https://downloads.apache.org/creadur/apache-rat-${RAT_VERSION}"
-RAT_SHA512="32848673dc4fb639c33ad85172dfa9d7a4441a0144e407771c9f7eb6a9a0b7a9b557b9722af968500fae84a6e60775449d538e36e342f786f20945b1645294a0"
-
-download-and-verify "${RAT_BASE_URL}/${RAT_ARCHIVE}" "${RAT_ARCHIVE}" sha512
"${RAT_SHA512}"
-
-tar xf "${RAT_ARCHIVE}"
-mv "apache-rat-${RAT_VERSION}/apache-rat-${RAT_VERSION}.jar"
/bin/apache-rat.jar
diff --git a/docker/lint.sh b/docker/lint.sh
index 4237fb4423..aa5b9b9609 100755
--- a/docker/lint.sh
+++ b/docker/lint.sh
@@ -20,7 +20,7 @@
source "$(dirname $0)/dev_common.sh"
SCRIPT_NAME="$0"
-DEFAULT_STEPS=( precommit cpplint cppdocs docker_format )
+DEFAULT_STEPS=( precommit )
inplace_fix=0
@@ -35,23 +35,10 @@ function run_lint_step() {
precommit)
cmd=( pre-commit run --all-files )
;;
- cpplint)
- cmd=( tests/lint/cpplint.sh )
- ;;
- cppdocs)
- cmd=( tests/lint/cppdocs.sh )
- ;;
- docker_format)
- cmd=( tests/lint/docker-format.sh )
- ;;
# Legacy aliases — these now delegate to pre-commit
- blocklint|file_type|asf|clang_format|python_format|pylint)
+
cpplint|cppdocs|docker_format|blocklint|file_type|asf|clang_format|python_format|pylint|mypy)
cmd=( pre-commit run --all-files )
;;
- mypy)
- echo "mypy: now handled by pre-commit (skipping standalone run)"
- return 0
- ;;
*)
echo "error: don't know how to run lint step: $1" >&2
echo "usage: ${SCRIPT_NAME} [-i] <lint_step>" >&2
@@ -75,7 +62,6 @@ function run_lint_step() {
}
if [ $# -eq 0 ]; then
- # NOTE: matches order in tests/scripts/task_lint.sh
steps=( "${DEFAULT_STEPS[@]}" )
else
steps=( "$@" )
diff --git a/tests/lint/add_asf_header.py b/tests/lint/add_asf_header.py
deleted file mode 100644
index c2541ea2af..0000000000
--- a/tests/lint/add_asf_header.py
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/env python3
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Deprecated: functionality moved to pre-commit hooks. Kept as no-op for
backward compatibility.
-# Use check_asf_header.py --fix instead.
-import sys
-
-sys.exit(0)
diff --git a/tests/lint/check_asf_header.py b/tests/lint/check_asf_header.py
index c2e02f1db6..f5dcf22fcd 100644
--- a/tests/lint/check_asf_header.py
+++ b/tests/lint/check_asf_header.py
@@ -180,7 +180,7 @@ FMT_MAP = {
}
# Files and patterns to skip during header checking.
-# Mirrors the previous rat-excludes file plus 3rdparty.
+# Files and patterns to skip (3rdparty, generated files, etc.).
SKIP_LIST: list[str] = [
"3rdparty/*",
"ffi/3rdparty/*",
diff --git a/tests/lint/check_file_type.py b/tests/lint/check_file_type.py
index b7feb3f87e..bc7cc3b034 100644
--- a/tests/lint/check_file_type.py
+++ b/tests/lint/check_file_type.py
@@ -14,7 +14,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-# ruff: noqa: E501
"""Helper tool to check file types that are allowed to checkin."""
import subprocess
@@ -27,29 +26,20 @@ ALLOW_EXTENSION = {
"cc",
"c",
"h",
- "s",
- "rs",
+ "S",
+ "cu",
+ "cuh",
"m",
"mm",
- "g4",
+ "java",
"gradle",
+ "groovy",
"js",
"cjs",
"mjs",
- "tcl",
- "scala",
- "java",
- "go",
"ts",
"sh",
"py",
- "pyi",
- "pxi",
- "pyd",
- "pyx",
- "cu",
- "cuh",
- "bat",
# configurations
"mk",
"in",
@@ -60,104 +50,52 @@ ALLOW_EXTENSION = {
"yaml",
"json",
"cfg",
+ "ini",
# docs
"txt",
"md",
"rst",
"css",
- # sgx
- "edl",
- "lds",
+ "html",
# ios
"pbxproj",
"plist",
"xcworkspacedata",
"storyboard",
"xcscheme",
- # hw/chisel
- "sbt",
- "properties",
- "v",
- "sdc",
- # generated parser
- "interp",
- "tokens",
# interface definition
"idl",
- # opencl file
- "cl",
- # zephyr config file
- "conf",
- # arduino sketch file
- "ino",
- # linker scripts
- "ld",
# Jinja2 templates
"j2",
- # Jenkinsfiles
- "groovy",
- # Python-parseable config files
- "ini",
+ # images
+ "png",
+ # misc
+ "properties",
+ "template",
}
# List of file names allowed
ALLOW_FILE_NAME = {
".gitignore",
- ".eslintignore",
".gitattributes",
+ ".gitmodules",
+ ".clang-format",
"README",
"Makefile",
"Doxyfile",
- "pylintrc",
- "condarc",
- "rat-excludes",
- "log4j.properties",
- ".clang-format",
- ".clang-tidy",
- ".gitmodules",
"CODEOWNERSHIP",
- ".scalafmt.conf",
- "Cargo.lock",
- "poetry.lock",
+ "condarc",
"with_the_same_user",
- "Dockerfile",
- "py.typed",
}
# List of specific files allowed in relpath to <proj_root>
-ALLOW_SPECIFIC_FILE = {
- "LICENSE",
- "NOTICE",
- "KEYS",
- "DISCLAIMER",
- "Jenkinsfile",
- # cargo config
- "rust/runtime/tests/test_wasm32/.cargo/config",
- "rust/tvm-graph-rt/tests/test_wasm32/.cargo/config",
- "apps/sgx/.cargo/config",
- "apps/wasm-standalone/wasm-graph/.cargo/config",
- # html for demo purposes
- "web/apps/browser/rpc_server.html",
- "web/apps/browser/rpc_plugin.html",
- # images are normally not allowed
- # discuss with committers before add more images
- "apps/android_rpc/app/src/main/res/mipmap-hdpi/ic_launcher.png",
- "apps/android_rpc/app/src/main/res/mipmap-mdpi/ic_launcher.png",
- # documentation related files
- "docs/_static/img/tvm-logo-small.png",
- "docs/_static/img/tvm-logo-square.png",
- # pytest config
- "pytest.ini",
- # Hexagon
- "src/runtime/hexagon/rpc/android_bash.sh.template",
- "src/runtime/hexagon/profiler/lwp_handler.S",
-}
+ALLOW_SPECIFIC_FILE = {"LICENSE", "NOTICE", "KEYS"}
def filename_allowed(name: str) -> bool:
"""Check if name is allowed by the current policy.
- Paramaters
+ Parameters
----------
name : str
Input name
@@ -166,110 +104,49 @@ def filename_allowed(name: str) -> bool:
-------
allowed : bool
Whether the filename is allowed.
-
"""
arr = name.rsplit(".", 1)
if arr[-1] in ALLOW_EXTENSION:
return True
- if Path(name).name in ALLOW_FILE_NAME:
+ basename = Path(name).name
+ if basename in ALLOW_FILE_NAME:
return True
- if Path(name).name.startswith("Dockerfile"):
+ # Dockerfile and variants like Dockerfile.ci_gpu
+ if basename == "Dockerfile" or basename.startswith("Dockerfile."):
return True
if name.startswith("3rdparty"):
return True
- if name.startswith("ffi/3rdparty"):
- return True
-
if name in ALLOW_SPECIFIC_FILE:
return True
return False
-def copyright_line(line: str) -> bool:
- # Following two items are intentionally break apart
- # so that the copyright detector won't detect the file itself.
- if line.find("Copyright " + "(c)") != -1:
- return True
- # break pattern into two lines to avoid false-negative check
- spattern1 = "Copyright"
- if line.find(spattern1) != -1 and line.find("by") != -1:
- return True
- return False
-
-
-def check_asf_copyright(fname: str) -> bool:
- if fname.endswith(".png"):
- return True
- if not Path(fname).is_file():
- return True
- has_asf_header = False
- has_copyright = False
- try:
- for line in Path(fname).open():
- if line.find("Licensed to the Apache Software Foundation") != -1:
- has_asf_header = True
- if copyright_line(line):
- has_copyright = True
- if has_asf_header and has_copyright:
- return False
- except UnicodeDecodeError:
- pass
- return True
-
-
def main() -> None:
cmd = ["git", "ls-files"]
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
(out, _) = proc.communicate()
res = out.decode("utf-8")
assert proc.returncode == 0, f"{' '.join(cmd)} errored: {res}"
- flist = res.split()
- error_list = []
-
- for fname in flist:
- if not filename_allowed(fname):
- error_list.append(fname)
+ error_list = [f for f in res.split() if not filename_allowed(f)]
if error_list:
report = "------File type check report----\n"
report += "\n".join(error_list)
report += f"\nFound {len(error_list)} files that are not allowed\n"
+ report += "We do not check in binary files into the repo.\n"
report += (
- "We do not check in binary files into the repo.\n"
- "If necessary, please discuss with committers and"
+ "If necessary, please discuss with committers and "
"modify tests/lint/check_file_type.py to enable the file you
need.\n"
)
sys.stderr.write(report)
sys.stderr.flush()
sys.exit(-1)
- asf_copyright_list = []
-
- for fname in res.split():
- if not check_asf_copyright(fname):
- asf_copyright_list.append(fname)
-
- if asf_copyright_list:
- report = "------File type check report----\n"
- report += "\n".join(asf_copyright_list) + "\n"
- report += f"------Found {len(asf_copyright_list)} files that has ASF
header with copyright message----\n"
- report += "--- Files with ASF header do not need Copyright lines.\n"
- report += "--- Contributors retain copyright to their contribution by
default.\n"
- report += "--- If a file comes with a different license, consider put
it under the 3rdparty folder instead.\n"
- report += "---\n"
- report += "--- You can use the following steps to remove the copyright
lines\n"
- report += "--- Create file_list.txt in your text editor\n"
- report += "--- Copy paste the above content in file-list into
file_list.txt\n"
- report += "--- python3 tests/lint/add_asf_header.py file_list.txt\n"
- sys.stderr.write(report)
- sys.stderr.flush()
- sys.exit(-1)
-
print("check_file_type.py: all checks passed..")
diff --git a/tests/lint/cppdocs.sh b/tests/lint/cppdocs.sh
deleted file mode 100755
index 81b89e7b4f..0000000000
--- a/tests/lint/cppdocs.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-set -euxo pipefail
-
-function cleanup() {
- rm -f /tmp/$$.log.txt /tmp/$$.logclean.txt
-}
-trap cleanup EXIT
-
-doxygen docs/Doxyfile 2>/tmp/$$.log.txt
-
-grep -v -E "ENABLE_PREPROCESSING|unsupported tag|Inheritance
graph|use_default_type_traits_v" < /tmp/$$.log.txt > /tmp/$$.logclean.txt ||
true
-echo "---------Error Log----------"
-cat /tmp/$$.logclean.txt
-echo "----------------------------"
-if grep --quiet -E "warning|error" < /tmp/$$.logclean.txt; then
- exit 1
-fi
diff --git a/tests/lint/cpplint.sh b/tests/lint/cpplint.sh
deleted file mode 100755
index 658366955d..0000000000
--- a/tests/lint/cpplint.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/env bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-set -e
-
-if find src -name "*.cc" -exec grep -Hn '^#include <regex>$' {} +; then
- echo "The <regex> header file may not be used in TVM," 1>&2
- echo "because it causes ABI incompatibility with most pytorch
installations." 1>&2
- echo "Pytorch packages on PyPI currently set `-DUSE_CXX11_ABI=0`," 1>&2
- echo "which causes ABI compatibility when calling <regex> functions." 1>&2
- echo "See https://github.com/pytorch/pytorch/issues/51039 for more
details." 1>&2
- exit 1
-fi
diff --git a/tests/lint/docker-format.sh b/tests/lint/docker-format.sh
deleted file mode 100755
index 6ee7cf98a6..0000000000
--- a/tests/lint/docker-format.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-TVM_HOME="$(git rev-parse --show-toplevel)"
-DOCKER_DIR="$TVM_HOME/docker"
-
-if git grep "apt install" -- ':(exclude)docker/utils/apt-install-and-clear.sh'
$DOCKER_DIR; then
- echo "Using \"apt install\" in docker file is not allowed."
- echo "Please use \"apt-install-and-clear\" instead in order to keep the
image size at a minimum."
- exit 1
-fi
-
-if git grep "apt-get install" --
':(exclude)docker/utils/apt-install-and-clear.sh' $DOCKER_DIR; then
- echo "Using \"apt-get install\" in docker file is not allowed."
- echo "Please use \"apt-install-and-clear\" instead in order to keep the
image size at a minimum."
- exit 1
-fi
-
-exit 0
diff --git a/tests/lint/pylintrc b/tests/lint/pylintrc
deleted file mode 100644
index 1e243fbb34..0000000000
--- a/tests/lint/pylintrc
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Deprecated: pylint replaced by ruff in pre-commit hooks. Kept as no-op for
backward compatibility.
diff --git a/tests/lint/rat-excludes b/tests/lint/rat-excludes
deleted file mode 100644
index 322774870c..0000000000
--- a/tests/lint/rat-excludes
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Deprecated: ASF header check moved to check_asf_header.py (pre-commit).
-# Kept as no-op for backward compatibility.
diff --git a/tests/lint/trailing_newlines.py b/tests/lint/trailing_newlines.py
deleted file mode 100644
index f150afe4d8..0000000000
--- a/tests/lint/trailing_newlines.py
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/usr/bin/env python3
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Deprecated: functionality moved to pre-commit hooks. Kept as no-op for
backward compatibility.
-import sys
-
-sys.exit(0)
diff --git a/tests/scripts/ci.py b/tests/scripts/ci.py
index c0ef2f09cb..80145254e3 100755
--- a/tests/scripts/ci.py
+++ b/tests/scripts/ci.py
@@ -350,7 +350,7 @@ def lint(interactive: bool = False, fix: bool = False,
docker_image: str | None
docker(
name=gen_name("ci-lint"),
image="ci_lint" if docker_image is None else docker_image,
- scripts=["./tests/scripts/task_lint.sh"],
+ scripts=["pre-commit run --all-files"],
env=env,
interactive=interactive,
)
diff --git a/tests/scripts/task_lint.sh b/tests/scripts/task_lint.sh
deleted file mode 100755
index bd3c3a54ec..0000000000
--- a/tests/scripts/task_lint.sh
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/env bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-set -euxo pipefail
-
-cleanup() {
- rm -rf /tmp/$$.*
-}
-trap cleanup 0
-
-# These shards are solely for CI to enable the lint job to have some
parallelism.
-
-function shard1 {
- echo "Installing pre-commit..."
- pip install pre-commit
-
- echo "Running pre-commit hooks..."
- pre-commit run --all-files
-
- echo "Checking C++ documentation..."
- tests/lint/cppdocs.sh
-
- echo "Linting the C++ code (regex header check)..."
- tests/lint/cpplint.sh
-
- echo "Docker check..."
- tests/lint/docker-format.sh
-}
-
-function shard2 {
- # shard2 is a no-op: the old lint checks have been replaced by pre-commit
hooks in shard1.
- echo "Lint shard2: no-op (checks moved to pre-commit in shard1)"
-}
-
-
-if [[ -n ${TVM_SHARD_INDEX+x} ]]; then
- if [[ "$TVM_SHARD_INDEX" == "0" ]]; then
- shard1
- else
- shard2
- fi
-else
- shard1
- shard2
-fi