исправить: закрыть ревью сквозной корреляции
This commit is contained in:
@@ -47,6 +47,38 @@ class CommunityScopeCheckTests(unittest.TestCase):
|
||||
self.assertIn("apps/ui.md:1", result.stderr)
|
||||
self.assertIn("graphql", result.stderr.lower())
|
||||
|
||||
def test_inline_directive_allows_only_declared_marker(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
root = Path(tmp)
|
||||
(root / "protocol.rs").write_text(
|
||||
'assert_rejected_protocol("grpc"); '
|
||||
"// community-scope: allow=grpc\n"
|
||||
'assert_rejected_protocol("grpc");\n'
|
||||
'assert_rejected_protocol("graphql"); '
|
||||
"// community-scope: allow=grpc\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
result = self.run_checker(root, ["protocol.rs"])
|
||||
|
||||
self.assertNotEqual(result.returncode, 0)
|
||||
self.assertIn("protocol.rs:2: forbidden marker `grpc`", result.stderr)
|
||||
self.assertIn("protocol.rs:3: forbidden marker `graphql`", result.stderr)
|
||||
self.assertNotIn("protocol.rs:1:", result.stderr)
|
||||
|
||||
def test_rejects_marker_without_inline_directive(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
root = Path(tmp)
|
||||
(root / "README.md").write_text(
|
||||
"Enable grpc transport.\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
result = self.run_checker(root, ["README.md"])
|
||||
|
||||
self.assertNotEqual(result.returncode, 0)
|
||||
self.assertIn("forbidden marker `grpc`", result.stderr)
|
||||
|
||||
def test_ignores_default_excluded_paths(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
root = Path(tmp)
|
||||
|
||||
Reference in New Issue
Block a user