imbajin commented on code in PR #313:
URL: 
https://github.com/apache/incubator-hugegraph-ai/pull/313#discussion_r2566996049


##########
README.md:
##########
@@ -178,7 +178,16 @@ uv add numpy  # Add to base dependencies
 uv add --group dev pytest-mock  # Add to dev group
 ```
 
-**Key Points:**
+### Code Quality (ruff + pre-commit)
+
+- Ruff is used for linting and formatting:
+  - \`ruff format .\`
+  - \`ruff check .\`
+- Enable Git hooks via pre-commit:
+  - \`pre-commit install\`
+  - \`pre-commit run --all-files\`
+- Config: [.pre-commit-config.yaml](.pre-commit-config.yaml). CI enforces 
these checks.
+  **Key Points:**
 

Review Comment:
   ⚠️ **README 格式问题**
   
   此处新增的 `Key Points:` 段落与上方内容缺少空行分隔,可能导致 Markdown 渲染异常。
   
   ```suggestion
   - Config: [.pre-commit-config.yaml](.pre-commit-config.yaml). CI enforces 
these checks.
   
   **Key Points:**
   ```



##########
.pre-commit-config.yaml:
##########
@@ -0,0 +1,39 @@
+# 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.
+
+repos:
+  - repo: https://github.com/pre-commit/pre-commit-hooks
+    rev: v4.6.0
+    hooks:
+      - id: trailing-whitespace
+      - id: end-of-file-fixer
+      - id: check-yaml
+      - id: check-added-large-files
+        args: ["--maxkb=1000"]
+      - id: check-merge-conflict
+      - id: check-case-conflict
+      - id: check-docstring-first
+      - id: debug-statements
+
+  - repo: https://github.com/astral-sh/ruff-pre-commit
+    rev: v0.13.1
+    hooks:

Review Comment:
   🧹 **建议:pre-commit hook 版本固定**
   
   当前 `pre-commit-hooks` 使用 `v4.6.0` 版本,但 `ruff-pre-commit` 使用 `v0.13.1`。考虑到 
ruff 更新频繁,建议:
   1. 定期更新版本以获取新功能和 bug 修复
   2. 或者添加注释说明版本选择的原因
   
   另外,`v0.13.1` 似乎是一个较新的版本,确认在 CI 环境中已经过验证?



##########
pyproject.toml:
##########
@@ -43,6 +43,9 @@ dev = [
     "pytest~=8.0.0",
     "pytest-cov~=5.0.0",
     "pylint~=3.0.0",
+    "ruff>=0.5.0",

Review Comment:
   ⚠️ **依赖版本下界可能过低**
   
   `ruff>=0.5.0` 的下界较低,而 `.pre-commit-config.yaml` 中使用的是 
`v0.13.1`。建议统一版本要求以避免不一致:
   
   ```suggestion
       "ruff>=0.11.0",
   ```
   
   这样可以确保开发者本地安装的版本与 pre-commit 使用的版本更接近,减少格式化结果的差异。



-- 
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