x
This commit is contained in:
@@ -888,7 +888,7 @@ def pretooluse_hook(hook_data: JsonObject, config: QualityConfig) -> JsonObject:
|
|||||||
file_path,
|
file_path,
|
||||||
all_issues,
|
all_issues,
|
||||||
config,
|
config,
|
||||||
forced_permission="ask",
|
forced_permission="deny",
|
||||||
)
|
)
|
||||||
|
|
||||||
return _handle_quality_issues(file_path, all_issues, config)
|
return _handle_quality_issues(file_path, all_issues, config)
|
||||||
@@ -898,7 +898,7 @@ def pretooluse_hook(hook_data: JsonObject, config: QualityConfig) -> JsonObject:
|
|||||||
file_path,
|
file_path,
|
||||||
any_usage_issues,
|
any_usage_issues,
|
||||||
config,
|
config,
|
||||||
forced_permission="ask",
|
forced_permission="deny",
|
||||||
)
|
)
|
||||||
return _create_hook_response(
|
return _create_hook_response(
|
||||||
"PreToolUse",
|
"PreToolUse",
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ minversion = "7.0"
|
|||||||
addopts = [
|
addopts = [
|
||||||
"-ra",
|
"-ra",
|
||||||
"--strict-markers",
|
"--strict-markers",
|
||||||
"--cov=quality",
|
"--cov=code_quality_guard",
|
||||||
"--cov-branch",
|
"--cov-branch",
|
||||||
"--cov-report=term-missing:skip-covered",
|
"--cov-report=term-missing:skip-covered",
|
||||||
"--cov-report=html",
|
"--cov-report=html",
|
||||||
@@ -152,4 +152,5 @@ dev = [
|
|||||||
"sourcery>=1.37.0",
|
"sourcery>=1.37.0",
|
||||||
"basedpyright>=1.17.0",
|
"basedpyright>=1.17.0",
|
||||||
"pyrefly>=0.2.0",
|
"pyrefly>=0.2.0",
|
||||||
|
"pytest>=8.4.2",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -339,7 +339,7 @@ class TestPreToolUseHook:
|
|||||||
mock_analyze.return_value = {}
|
mock_analyze.return_value = {}
|
||||||
|
|
||||||
result = pretooluse_hook(hook_data, config)
|
result = pretooluse_hook(hook_data, config)
|
||||||
assert result["permissionDecision"] == "ask"
|
assert result["permissionDecision"] == "deny"
|
||||||
assert "any" in result["reason"].lower()
|
assert "any" in result["reason"].lower()
|
||||||
|
|
||||||
def test_any_usage_detected_in_multiedit(self):
|
def test_any_usage_detected_in_multiedit(self):
|
||||||
@@ -369,5 +369,5 @@ class TestPreToolUseHook:
|
|||||||
mock_analyze.return_value = {}
|
mock_analyze.return_value = {}
|
||||||
|
|
||||||
result = pretooluse_hook(hook_data, config)
|
result = pretooluse_hook(hook_data, config)
|
||||||
assert result["permissionDecision"] == "ask"
|
assert result["permissionDecision"] == "deny"
|
||||||
assert "any" in result["reason"].lower()
|
assert "any" in result["reason"].lower()
|
||||||
|
|||||||
Reference in New Issue
Block a user