Add Docker pre-commit hook (#5238) (#5452)

This commit is contained in:
Chris Bachhuber 2024-09-23 13:37:24 +02:00 committed by GitHub
parent c48d80592e
commit 685ea0bc65
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 28 additions and 0 deletions

8
.pre-commit-hooks.yaml Normal file
View File

@ -0,0 +1,8 @@
---
- id: verilator
name: verilator-lint
description: Runs verilator Docker image to lint (System) Verilog designs
args: [--lint-only]
language: docker_image
entry: verilator/verilator:latest
types_or: [verilog, system-verilog]

View File

@ -1,6 +1,8 @@
.. Copyright 2003-2024 by Wilson Snyder.
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
.. _Verilator Build Docker Container
Verilator Build Docker Container
================================

View File

@ -26,6 +26,24 @@ package:
For other distributions, refer to `Repology Verilator Distro Packages
<https://repology.org/project/verilator>`__.
.. _pre-commit Quick Install:
pre-commit Quick Install
=============================
You can use verliator's `pre-commit <https://pre-commit.com/>`_ hook to lint your code before committing it.
It encapsulates the :ref:`Verilator Build Docker Container`_, so you need docker on your system to use it.
The verilator image will be downloaded automatically.
To use the hook, add the following entry to your :code:`.pre-commit-config.yaml`:
.. code-block:: yaml
repos:
- repo: https://github.com/verilator/verilator
rev: v5.026 # or later
hooks:
- id: verilator
.. _Git Install:
Git Quick Install