Skip to content
This repository was archived by the owner on Jun 22, 2026. It is now read-only.

Commit 7d127bf

Browse files
committed
feat: 添加 pylint 配置文件并更新 pyproject.toml 以包含 pylint 依赖
1 parent 2fa1b2d commit 7d127bf

4 files changed

Lines changed: 155 additions & 30 deletions

File tree

.pylintrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[MASTER]
2+
ignore=tests
3+
ignore-patterns=test_.*?.py
4+
5+
[FORMAT]
6+
max-line-length=120

app/core/github.py

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -23,40 +23,13 @@
2323
import hmac
2424
import hashlib
2525
import logging
26-
import fnmatch
2726
from typing import Optional, Dict, Any, List
2827

2928
from fastapi import Request, HTTPException, Header
3029

31-
logger = logging.getLogger(__name__)
32-
33-
def match_pattern(value: str, pattern: str) -> bool:
34-
"""
35-
检查字符串是否匹配配置中的模式
36-
支持大小写不敏感匹配和通配符模式
30+
from app.utils.matching import match_pattern
3731

38-
Args:
39-
value: 要匹配的字符串 (例如 'user/repo' 或 'main')
40-
pattern: 配置中的模式 (例如 'user/*', 'feature/*')
41-
treat_star_as_all: 是否将单独的 "*" 视为匹配所有内容(用于分支匹配)
42-
43-
Returns:
44-
bool: 是否匹配
45-
"""
46-
if not value or not pattern:
47-
return False
48-
49-
value = value.lower()
50-
pattern = pattern.lower()
51-
52-
# 分支匹配特殊情况:单独的 "*" 匹配所有内容
53-
if pattern == "*":
54-
return True
55-
56-
if '*' in pattern or '?' in pattern or '[' in pattern:
57-
return fnmatch.fnmatch(value, pattern)
58-
59-
return value == pattern
32+
logger = logging.getLogger(__name__)
6033

6134
async def verify_signature(
6235
request: Request,

poetry.lock

Lines changed: 146 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ priority = "primary"
2626
[tool.poetry.group.test.dependencies]
2727
pytest = "^8.3.5"
2828
pytest-asyncio = "^0.26.0"
29+
pylint = "^3.3.7"
2930

3031

3132
[tool.poetry.group.unittest.dependencies]

0 commit comments

Comments
 (0)