Coverage for lintro / ai / models / fix_suggestion.py: 100%
18 statements
« prev ^ index » next coverage.py v7.13.0, created at 2026-04-03 18:53 +0000
« prev ^ index » next coverage.py v7.13.0, created at 2026-04-03 18:53 +0000
1"""AI-generated fix suggestion dataclass."""
3from __future__ import annotations
5from dataclasses import dataclass
7from lintro.ai.enums import ConfidenceLevel, RiskLevel
10@dataclass
11class AIFixSuggestion:
12 """AI-generated fix suggestion with a unified diff.
14 Generated for issues that native tools cannot auto-fix.
16 Attributes:
17 file: Path to the file being fixed.
18 line: Line number of the original issue.
19 code: Error code of the issue being fixed.
20 tool_name: Name of the tool that reported this issue.
21 original_code: The original code snippet.
22 suggested_code: The AI-suggested replacement.
23 diff: Unified diff string showing the change.
24 explanation: Brief explanation of what was changed and why.
25 confidence: Confidence level.
26 risk_level: AI-reported risk classification. Empty string
27 if not classified.
28 input_tokens: Tokens consumed for input in the API call.
29 output_tokens: Tokens generated for output in the API call.
30 cost_estimate: Estimated cost in USD for the API call.
31 """
33 file: str = ""
34 line: int = 0
35 code: str = ""
36 tool_name: str = ""
37 original_code: str = ""
38 suggested_code: str = ""
39 diff: str = ""
40 explanation: str = ""
41 confidence: ConfidenceLevel | str = ConfidenceLevel.MEDIUM
42 risk_level: RiskLevel | str = ""
43 input_tokens: int = 0
44 output_tokens: int = 0
45 cost_estimate: float = 0.0