fix(mcp): resolve ruff E501 and formatting issues to pass pre-commit

- Split long string literal in schema_validator.py line 202 (E501, 94 > 88 chars)
- Apply ruff format auto-fixes to big_number.py, handlebars.py, and test_get_chart_data.py
This commit is contained in:
Amin Ghadersohi
2026-05-09 00:11:52 +00:00
parent f6fa8c7144
commit 06276e76c5
4 changed files with 7 additions and 8 deletions

View File

@@ -71,8 +71,7 @@ class BigNumberChartPlugin(BaseChartPlugin):
error_type="invalid_metric_type",
message="Big Number metric must be a dict with 'name' and 'aggregate'",
details=(
"The 'metric' field must be an object, got "
f"{type(metric).__name__}"
f"The 'metric' field must be an object, got {type(metric).__name__}"
),
suggestions=[
"Use a dict: {'name': 'col', 'aggregate': 'SUM'}",

View File

@@ -73,8 +73,7 @@ class HandlebarsChartPlugin(BaseChartPlugin):
),
suggestions=[
"Ensure handlebars_template is a non-empty string",
"Example: '<ul>{{#each data}}<li>{{this.name}}</li>"
"{{/each}}</ul>'",
"Example: '<ul>{{#each data}}<li>{{this.name}}</li>{{/each}}</ul>'",
],
error_code="INVALID_HANDLEBARS_TEMPLATE",
)

View File

@@ -199,7 +199,8 @@ class SchemaValidator:
"details": "The XY chart configuration is missing required "
"fields or has invalid structure",
"suggestions": [
"Note: 'x' is optional and defaults to the dataset's primary datetime column",
"Note: 'x' is optional and defaults to the dataset's primary "
"datetime column",
"Ensure 'y' is an array: [{'name': 'metric', 'aggregate': 'SUM'}]",
"Check that all column names are strings",
"Verify aggregate functions are valid: SUM, COUNT, AVG, MIN, MAX",

View File

@@ -222,9 +222,9 @@ class TestBigNumberChartFallback:
"viz_type": viz_type,
}
metrics, _ = _extract_metrics_and_groupby(form_data)
assert metrics == [
{"label": "plural_metric"}
], f"{viz_type} should use plural metrics"
assert metrics == [{"label": "plural_metric"}], (
f"{viz_type} should use plural metrics"
)
def test_pop_kpi_uses_singular_metric(self):
"""Test that pop_kpi (BigNumberPeriodOverPeriod) uses singular metric."""