From 14ab7adf035c0045838804638166ad38b75b9d48 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 23 Sep 2024 22:02:58 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.6.5 → v0.6.7](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.5...v0.6.7) - https://github.com/pylint-dev/pylint/: v3.2.7 → v3.3.0 --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d2fc1d0ab8..5d34f39752 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,7 +29,7 @@ repos: exclude: ^source/3rdparty - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.6.5 + rev: v0.6.7 hooks: - id: ruff args: ["--fix"] @@ -146,7 +146,7 @@ repos: exclude: .pre-commit-config.yaml|source/lmp # customized pylint rules - repo: https://github.com/pylint-dev/pylint/ - rev: v3.2.7 + rev: v3.3.0 hooks: - id: pylint entry: env PYTHONPATH=source/checker pylint From 3d4d38010af7d0db172a84a22f38526897a02b81 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Fri, 27 Sep 2024 15:37:54 -0400 Subject: [PATCH 2/2] per https://pylint.pycqa.org/en/latest/development_guide/how_tos/custom_checkers.html#defining-a-message, the message-id should be a 4-digit number, prefixed with a message category. Signed-off-by: Jinzhe Zeng --- pyproject.toml | 2 +- source/checker/README.md | 4 ++-- source/checker/deepmd_checker.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 28fe114e01..a1829016cb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -414,4 +414,4 @@ plugins = ["source.3rdparty.coverage_plugins.jit_plugin"] [tool.pylint.'MESSAGES CONTROL'] load-plugins = "deepmd_checker" disable = "all" -enable = "EDP01,EDP02" +enable = "E8001,E8002" diff --git a/source/checker/README.md b/source/checker/README.md index 2a905f93a5..368852034c 100644 --- a/source/checker/README.md +++ b/source/checker/README.md @@ -1,4 +1,4 @@ # DeePMD-kit customized Pylint plugin -- EDP01: Require explicit device when initializing a PyTorch tensor. -- EDP02: Require explicit dtype when initializing a NumPy array, a TensorFlow tensor, or a PyTorch tensor. +- E8001: Require explicit device when initializing a PyTorch tensor. +- E8002: Require explicit dtype when initializing a NumPy array, a TensorFlow tensor, or a PyTorch tensor. diff --git a/source/checker/deepmd_checker.py b/source/checker/deepmd_checker.py index 052d011c47..d763835fdc 100644 --- a/source/checker/deepmd_checker.py +++ b/source/checker/deepmd_checker.py @@ -21,12 +21,12 @@ class DPChecker(BaseChecker): name = "deepmd-checker" msgs: ClassVar[dict] = { - "EDP01": ( + "E8001": ( "No explicit device.", "no-explicit-device", "Require explicit device when initializing a PyTorch tensor.", ), - "EDP02": ( + "E8002": ( "No explicit dtype.", "no-explicit-dtype", "Require explicit dtype when initializing a NumPy array, a TensorFlow tensor, or a PyTorch tensor.",