gemini-code-assist[bot] commented on code in PR #437:
URL: https://github.com/apache/tvm-ffi/pull/437#discussion_r2779514068


##########
docs/dev/ci_cd.rst:
##########
@@ -0,0 +1,202 @@
+..  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.
+
+Reproduce CI/CD
+===============
+
+This guide explains how to reproduce CI checks and tests locally,
+and how wheel builds and releases work.
+All CI/CD workflows are defined under `.github/workflows/ 
<https://github.com/apache/tvm-ffi/tree/main/.github/workflows>`__.
+For building the project from source, see :doc:`source_build`.
+
+Linters
+-------
+
+Pre-commit
+~~~~~~~~~~
+
+The project uses `pre-commit <https://pre-commit.com/>`__ to run linters and
+formatters. All hooks are defined in `.pre-commit-config.yaml 
<https://github.com/apache/tvm-ffi/blob/main/.pre-commit-config.yaml>`__. 
Install and
+register the git hooks so they run automatically before each commit:
+
+.. code-block:: bash
+
+   uv tool install pre-commit
+   pre-commit install
+
+You can also run hooks manually:
+
+.. code-block:: bash
+
+   # Run all hooks on every file
+   pre-commit run --all-files
+
+   # Run only on staged files
+   pre-commit run
+
+   # Run a single hook in isolation
+   pre-commit run ruff-check --all-files
+   pre-commit run clang-format --all-files
+
+The main linters per language are:
+
+- **Python** -- ``ruff`` (lint + format), ``ty`` (type checking)
+- **C/C++** -- ``clang-format`` (format), ``clang-tidy`` (lint, see below)
+- **Cython** -- ``cython-lint``
+- **CMake** -- ``cmake-format``, ``cmake-lint``
+- **Shell** -- ``shfmt``, ``shellcheck``
+
+If you run into issues with pre-commit:
+
+- **Version problems** -- ensure you have pre-commit 2.18.0 or later
+  (``pre-commit --version``).
+- **Stale cache** -- run ``pre-commit clean`` to clear the hook cache.
+- **Auto-fixed files** -- most formatting hooks fix issues in place. Review the
+  changes, stage them with ``git add -u``, and commit again.
+
+clang-tidy
+~~~~~~~~~~
+
+``clang-tidy`` is run as a separate CI job (not as a pre-commit hook) and only
+checks C++ files that have changed. To reproduce it locally:
+
+.. code-block:: bash
+
+   # Run clang-tidy on specific files
+   uv run --no-project --with "clang-tidy==21.1.1" \
+     python tests/lint/clang_tidy_precommit.py \
+       --build-dir=build-pre-commit \
+       --jobs=$(nproc) \
+       include/tvm/ffi/c_api.h src/some_file.cc
+
+   # Or run on all C++ sources
+   uv run --no-project --with "clang-tidy==21.1.1" \
+     python tests/lint/clang_tidy_precommit.py \
+       --build-dir=build-pre-commit \
+       --jobs=$(nproc)

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   The command to run `clang-tidy` on all C++ sources appears to be incomplete. 
The `tests/lint/clang_tidy_precommit.py` script requires file or directory 
paths to be provided as arguments. Without them, it will not lint any files. To 
lint all C++ sources as the comment suggests, you should pass the `include` and 
`src` directories.
   
   ```suggestion
      # Or run on all C++ sources
      uv run --no-project --with "clang-tidy==21.1.1" \
        python tests/lint/clang_tidy_precommit.py \
          --build-dir=build-pre-commit \
          --jobs=$(nproc) \
          include src
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to