You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/07/02 07:56:05 UTC

[GitHub] [tvm] mshawcroft commented on a change in pull request #8382: [Pre-commit] Add pre-commit configuration to perform minimal checks locally

mshawcroft commented on a change in pull request #8382:
URL: https://github.com/apache/tvm/pull/8382#discussion_r662812459



##########
File path: .pre-commit-config.yaml
##########
@@ -0,0 +1,40 @@
+repos:
+    - repo: https://github.com/pre-commit/pre-commit-hooks
+      rev: v2.5.0
+      hooks:
+        - id: check-added-large-files
+        - id: check-merge-conflict
+        - id: check-yaml
+        - id: end-of-file-fixer
+    - repo: local
+      hooks:
+        -   id: run-file-types
+            name: Checking File Types...
+            entry: python3 tests/lint/check_file_type.py
+            language: system
+            always_run: true
+            pass_filenames: false
+        -   id: run-headers-check
+            name: Checking ASF License Headers...
+            entry: tests/lint/check_asf_header.sh --local
+            language: system
+            always_run: true
+            pass_filenames: false
+        -   id: run-black

Review comment:
       black, pylint, mypy, possibly others here that are in 'local' can be run directly from pre-commit using pre-canned configurations.  e.g.
   - repo: https://github.com/psf/black
     rev: 21.5b1
     hooks:
       - id: black
   
   Perhaps another approach here is to add those three here in precommit and replace the relevant set of tests/lint/*.sh scripts and supporting machinery and tool installs in the docker with a single tests/lint/pre-commit.sh such that pre-commit manages the versioning / installation and execution of those tools and the standard tvm CI build test environment just leverages pre-commit.   Doing this moves all the configuration of those tools to one place, it removes the need to have CI docker infrastructure manage linter versions, and means that for all the tooling fully managed by pre-commit, pre-commit can be used by devs directly on the command line or in their .git/hooks without needing to either spin up the docker environment.




-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org