Skip to content

Commit ca6722b

Browse files
author
Zvi Fried
committed
fix: resolve linting errors and codecov configuration
- Fix code formatting with ruff format - Update codecov action to use 'files' parameter instead of deprecated 'file' - All linting and formatting checks now pass
1 parent d8aad27 commit ca6722b

File tree

6 files changed

+61
-68
lines changed

6 files changed

+61
-68
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
- name: Upload coverage to Codecov
6969
uses: codecov/codecov-action@v5
7070
with:
71-
file: ./coverage.xml
71+
files: ./coverage.xml
7272
fail_ci_if_error: false
7373
verbose: true
7474
token: ${{ secrets.CODECOV_TOKEN }}

src/mcp_as_a_judge/models.py

Lines changed: 16 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ class ResearchValidationResponse(BaseModel):
111111

112112
# Prompt variable models for type safety and validation
113113

114+
114115
class JudgeCodingPlanSystemVars(BaseModel):
115116
"""Variables for judge_coding_plan system prompt."""
116117

@@ -125,21 +126,13 @@ class JudgeCodingPlanUserVars(BaseModel):
125126
user_requirements: str = Field(
126127
description="The user's requirements for the coding task"
127128
)
128-
context: str = Field(
129-
description="Additional context about the task"
130-
)
131-
plan: str = Field(
132-
description="The coding plan to be evaluated"
133-
)
134-
design: str = Field(
135-
description="The design documentation"
136-
)
137-
research: str = Field(
138-
description="Research findings and analysis"
139-
)
129+
context: str = Field(description="Additional context about the task")
130+
plan: str = Field(description="The coding plan to be evaluated")
131+
design: str = Field(description="The design documentation")
132+
research: str = Field(description="Research findings and analysis")
140133
research_urls: list[str] = Field(
141134
default_factory=list,
142-
description="URLs from MANDATORY online research - minimum 3 URLs required"
135+
description="URLs from MANDATORY online research - minimum 3 URLs required",
143136
)
144137

145138

@@ -157,15 +150,9 @@ class JudgeCodeChangeUserVars(BaseModel):
157150
user_requirements: str = Field(
158151
description="The user's requirements for the code change"
159152
)
160-
file_path: str = Field(
161-
description="Path to the file being changed"
162-
)
163-
change_description: str = Field(
164-
description="Description of what the change does"
165-
)
166-
code_change: str = Field(
167-
description="The actual code content being reviewed"
168-
)
153+
file_path: str = Field(description="Path to the file being changed")
154+
change_description: str = Field(description="Description of what the change does")
155+
code_change: str = Field(description="The actual code content being reviewed")
169156

170157

171158
class ResearchValidationSystemVars(BaseModel):
@@ -179,21 +166,13 @@ class ResearchValidationSystemVars(BaseModel):
179166
class ResearchValidationUserVars(BaseModel):
180167
"""Variables for research_validation user prompt."""
181168

182-
user_requirements: str = Field(
183-
description="The user's requirements for the task"
184-
)
185-
plan: str = Field(
186-
description="The proposed plan"
187-
)
188-
design: str = Field(
189-
description="The design documentation"
190-
)
191-
research: str = Field(
192-
description="Research findings to be validated"
193-
)
169+
user_requirements: str = Field(description="The user's requirements for the task")
170+
plan: str = Field(description="The proposed plan")
171+
design: str = Field(description="The design documentation")
172+
research: str = Field(description="Research findings to be validated")
194173
research_urls: list[str] = Field(
195174
default_factory=list,
196-
description="URLs from MANDATORY online research - minimum 3 URLs required"
175+
description="URLs from MANDATORY online research - minimum 3 URLs required",
197176
)
198177

199178

@@ -208,9 +187,5 @@ class WorkflowGuidanceSystemVars(BaseModel):
208187
class WorkflowGuidanceUserVars(BaseModel):
209188
"""Variables for get_workflow_guidance user prompt."""
210189

211-
task_description: str = Field(
212-
description="Description of the development task"
213-
)
214-
context: str = Field(
215-
description="Additional context about the task"
216-
)
190+
task_description: str = Field(description="Description of the development task")
191+
context: str = Field(description="Additional context about the task")

src/mcp_as_a_judge/prompt_loader.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,7 @@ def create_separate_messages(
104104
)
105105

106106
# Render user prompt with user variables
107-
user_content = prompt_loader.render_prompt(
108-
user_template, **user_vars.model_dump()
109-
)
107+
user_content = prompt_loader.render_prompt(user_template, **user_vars.model_dump())
110108

111109
return [
112110
# System instructions as assistant message

src/mcp_as_a_judge/server.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
coding plans and code changes against software engineering best practices.
66
"""
77

8-
9-
108
import json
119

1210
from mcp.server.fastmcp import Context, FastMCP
@@ -64,9 +62,6 @@ def _extract_json_from_response(response_text: str) -> str:
6462
return json_content
6563

6664

67-
68-
69-
7065
@mcp.tool() # type: ignore[misc,unused-ignore]
7166
async def get_workflow_guidance(
7267
task_description: str,
@@ -467,11 +462,11 @@ async def judge_coding_plan(
467462
required_improvements=[
468463
f"Insufficient research URLs: {len(research_urls)} provided, minimum 3 required",
469464
"AI assistant MUST perform online research and provide at least 3 URLs",
470-
"Research should focus on existing well-known libraries and best practices"
465+
"Research should focus on existing well-known libraries and best practices",
471466
],
472467
feedback=f"❌ RESEARCH VALIDATION FAILED: Only {len(research_urls)} URLs provided. "
473-
f"MANDATORY requirement: AI assistant must provide at least 3 URLs from online research "
474-
f"focusing on existing solutions and well-known libraries."
468+
f"MANDATORY requirement: AI assistant must provide at least 3 URLs from online research "
469+
f"focusing on existing solutions and well-known libraries.",
475470
)
476471

477472
try:

tests/test_enhanced_features.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ async def test_judge_coding_plan_with_requirements(
6464
plan="Create Slack MCP server with message sending",
6565
design="Use slack-sdk library with FastMCP framework",
6666
research="Analyzed slack-sdk docs and MCP patterns",
67-
research_urls=["https://slack.dev/python-slack-sdk/", "https://modelcontextprotocol.io/docs/"],
67+
research_urls=[
68+
"https://slack.dev/python-slack-sdk/",
69+
"https://modelcontextprotocol.io/docs/",
70+
],
6871
user_requirements="Send CI/CD status updates to Slack channels",
6972
context="CI/CD integration project",
7073
ctx=mock_context_with_sampling,
@@ -112,7 +115,11 @@ async def test_requirements_in_evaluation_prompt(self, mock_context_with_samplin
112115
plan="Test plan",
113116
design="Test design",
114117
research="Test research",
115-
research_urls=["https://example.com/docs", "https://github.com/example/repo", "https://stackoverflow.com/questions/example"],
118+
research_urls=[
119+
"https://example.com/docs",
120+
"https://github.com/example/repo",
121+
"https://stackoverflow.com/questions/example",
122+
],
116123
user_requirements="Specific user requirements for testing",
117124
context="Test context",
118125
ctx=mock_context_with_sampling,
@@ -225,7 +232,11 @@ async def test_complete_workflow_with_requirements(
225232
plan="Create Slack MCP server with message capabilities",
226233
design="Use slack-sdk with FastMCP framework",
227234
research="Analyzed Slack API and MCP patterns",
228-
research_urls=["https://api.slack.com/docs", "https://modelcontextprotocol.io/docs/", "https://github.com/slackapi/python-slack-sdk"],
235+
research_urls=[
236+
"https://api.slack.com/docs",
237+
"https://modelcontextprotocol.io/docs/",
238+
"https://github.com/slackapi/python-slack-sdk",
239+
],
229240
user_requirements="Send automated CI/CD notifications to Slack",
230241
ctx=mock_context_with_sampling,
231242
)
@@ -247,7 +258,11 @@ async def test_obstacle_handling_workflow(self, mock_context_without_sampling):
247258
plan="Test plan",
248259
design="Test design",
249260
research="Test research",
250-
research_urls=["https://example.com/docs", "https://github.com/example", "https://stackoverflow.com/example"],
261+
research_urls=[
262+
"https://example.com/docs",
263+
"https://github.com/example",
264+
"https://stackoverflow.com/example",
265+
],
251266
user_requirements="Test requirements",
252267
ctx=mock_context_without_sampling,
253268
)

tests/test_prompt_loader.py

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ def test_render_judge_coding_plan_user(self) -> None:
5252
plan="Create Python calculator",
5353
design="Use functions for operations",
5454
research="Researched Python math",
55-
research_urls=["https://docs.python.org/3/library/math.html", "https://numpy.org/doc/", "https://scipy.org/"],
55+
research_urls=[
56+
"https://docs.python.org/3/library/math.html",
57+
"https://numpy.org/doc/",
58+
"https://scipy.org/",
59+
],
5660
context="Educational project",
5761
)
5862

@@ -157,16 +161,18 @@ def test_global_prompt_loader_instance(self) -> None:
157161

158162
def test_create_separate_messages(self) -> None:
159163
"""Test the create_separate_messages function."""
160-
system_vars = JudgeCodingPlanSystemVars(
161-
response_schema='{"type": "object"}'
162-
)
164+
system_vars = JudgeCodingPlanSystemVars(response_schema='{"type": "object"}')
163165
user_vars = JudgeCodingPlanUserVars(
164166
user_requirements="Build a calculator",
165167
context="Educational project",
166168
plan="Create Python calculator",
167169
design="Use functions for operations",
168170
research="Researched Python math",
169-
research_urls=["https://docs.python.org/3/library/math.html", "https://numpy.org/doc/", "https://scipy.org/"],
171+
research_urls=[
172+
"https://docs.python.org/3/library/math.html",
173+
"https://numpy.org/doc/",
174+
"https://scipy.org/",
175+
],
170176
)
171177

172178
messages = create_separate_messages(
@@ -203,19 +209,23 @@ def test_render_research_validation_system(self) -> None:
203209

204210
assert "Research Quality Validation" in prompt
205211
assert "expert at evaluating" in prompt
206-
assert '{"type": "object", "properties": {"research_adequate": {"type": "boolean"}}}' in prompt
212+
assert (
213+
'{"type": "object", "properties": {"research_adequate": {"type": "boolean"}}}'
214+
in prompt
215+
)
207216
assert "You must respond with a JSON object that matches this schema:" in prompt
208217

209218
def test_research_validation_system_vars_not_empty(self) -> None:
210219
"""Test that ResearchValidationSystemVars is no longer empty."""
211-
system_vars = ResearchValidationSystemVars(
212-
response_schema='{"type": "object"}'
213-
)
220+
system_vars = ResearchValidationSystemVars(response_schema='{"type": "object"}')
214221
assert system_vars.response_schema == '{"type": "object"}'
215222

216223
# Verify it has the expected field
217-
assert hasattr(system_vars, 'response_schema')
218-
assert ResearchValidationSystemVars.model_fields['response_schema'].description == "JSON schema for the expected response format"
224+
assert hasattr(system_vars, "response_schema")
225+
assert (
226+
ResearchValidationSystemVars.model_fields["response_schema"].description
227+
== "JSON schema for the expected response format"
228+
)
219229

220230
def test_prompts_directory_access(self) -> None:
221231
"""Test that prompts directory is accessible via importlib.resources."""

0 commit comments

Comments
 (0)