Coverage for lintro / parsers / black / black_issue.py: 100%

11 statements  

« prev     ^ index     » next       coverage.py v7.13.0, created at 2026-04-03 18:53 +0000

1"""Black issue models. 

2 

3This module defines lightweight dataclasses used to represent Black findings 

4in a normalized form that Lintro formatters can consume. 

5""" 

6 

7from __future__ import annotations 

8 

9from dataclasses import dataclass, field 

10from typing import ClassVar 

11 

12from lintro.enums.severity_level import SeverityLevel 

13from lintro.parsers.base_issue import BaseIssue 

14 

15 

16@dataclass 

17class BlackIssue(BaseIssue): 

18 """Represents a Black formatting issue. 

19 

20 Attributes: 

21 DEFAULT_SEVERITY: Defaults to INFO (pure formatter). 

22 code: Error code (e.g., "E501" for line length violations, empty for 

23 general formatting issues). 

24 severity: Severity level (e.g., "error", "warning", empty for general 

25 formatting issues). 

26 fixable: Whether this issue can be auto-fixed by Black. Defaults to True 

27 for standard formatting issues. Set to False for line length violations 

28 that Black cannot safely wrap. 

29 """ 

30 

31 DEFAULT_SEVERITY: ClassVar[SeverityLevel] = SeverityLevel.INFO 

32 

33 code: str = field(default="") 

34 severity: str = field(default="") 

35 fixable: bool = field(default=True)