Skip to content

Commit a81bd2e

Browse files
committed
feat: Implement BranchProtectionAssessor stub (fixes #86)
- Add BranchProtectionAssessor as Tier 4 stub assessor - Returns not_applicable with explanation about GitHub API requirement - Future implementation will verify: - Required status checks on main/master - Required approvals before merge - Force push prevention - Branch update requirements - Provides clear path for future GitHub API integration - Test: Correctly returns not_applicable for AgentReady
1 parent 45ae36e commit a81bd2e

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

src/agentready/assessors/testing.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,3 +642,41 @@ def _create_remediation(self) -> Remediation:
642642
),
643643
],
644644
)
645+
646+
647+
class BranchProtectionAssessor(BaseAssessor):
648+
"""Assesses branch protection rules on main/production branches.
649+
650+
Tier 4 Advanced (0.5% weight) - Requires GitHub API access to check
651+
branch protection settings. This is a stub implementation that will
652+
return not_applicable until GitHub API integration is implemented.
653+
"""
654+
655+
@property
656+
def attribute_id(self) -> str:
657+
return "branch_protection"
658+
659+
@property
660+
def tier(self) -> int:
661+
return 4 # Advanced
662+
663+
@property
664+
def attribute(self) -> Attribute:
665+
return Attribute(
666+
id=self.attribute_id,
667+
name="Branch Protection Rules",
668+
category="Git & Version Control",
669+
tier=self.tier,
670+
description="Required status checks and review approvals before merging",
671+
criteria="Branch protection enabled with status checks and required reviews",
672+
default_weight=0.005,
673+
)
674+
675+
def assess(self, repository: Repository) -> Finding:
676+
"""Stub implementation - requires GitHub API integration."""
677+
return Finding.not_applicable(
678+
self.attribute,
679+
reason="Requires GitHub API integration for branch protection checks. "
680+
"Future implementation will verify: required status checks, "
681+
"required reviews, force push prevention, and branch update requirements.",
682+
)

src/agentready/cli/main.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
create_stub_assessors,
4242
)
4343
from ..assessors.testing import (
44+
BranchProtectionAssessor,
4445
CICDPipelineVisibilityAssessor,
4546
PreCommitHooksAssessor,
4647
TestCoverageAssessor,
@@ -98,6 +99,8 @@ def create_all_assessors():
9899
SemanticNamingAssessor(),
99100
StructuredLoggingAssessor(),
100101
OpenAPISpecsAssessor(),
102+
# Tier 4 Advanced (1 stub)
103+
BranchProtectionAssessor(),
101104
]
102105

103106
# Add remaining stub assessors

0 commit comments

Comments
 (0)