1212from ansiblelint .version import __version__
1313
1414if TYPE_CHECKING :
15- from ansiblelint .errors import MatchError
15+ from ansiblelint .errors import match_error
1616 from ansiblelint .rules import BaseRule # type: ignore[attr-defined]
1717
1818T = TypeVar ("T" , bound = "BaseFormatter" ) # type: ignore[type-arg]
@@ -49,7 +49,7 @@ def _format_path(self, path: str | Path) -> str | Path:
4949 return path
5050 return rel_path
5151
52- def apply (self , match : MatchError ) -> str :
52+ def apply (self , match : match_error ) -> str :
5353 """Format a match error."""
5454 return str (match )
5555
@@ -62,7 +62,7 @@ def escape(text: str) -> str:
6262class Formatter (BaseFormatter ): # type: ignore[type-arg]
6363 """Default output formatter of ansible-lint."""
6464
65- def apply (self , match : MatchError ) -> str :
65+ def apply (self , match : match_error ) -> str :
6666 _id = getattr (match .rule , "id" , "000" )
6767 result = f"[{ match .level } ][link={ match .rule .url } ]{ match .tag } [/link][dim]:[/] [{ match .level } ]{ self .escape (match .message )} [/]"
6868 if match .level != "error" :
@@ -82,7 +82,7 @@ def apply(self, match: MatchError) -> str:
8282class QuietFormatter (BaseFormatter [Any ]):
8383 """Brief output formatter for ansible-lint."""
8484
85- def apply (self , match : MatchError ) -> str :
85+ def apply (self , match : match_error ) -> str :
8686 return (
8787 f"[{ match .level } ]{ match .rule .id } [/] "
8888 f"[repr.path]{ self ._format_path (match .filename or '' )} [/]:{ match .position } "
@@ -92,7 +92,7 @@ def apply(self, match: MatchError) -> str:
9292class ParseableFormatter (BaseFormatter [Any ]):
9393 """Parseable uses PEP8 compatible format."""
9494
95- def apply (self , match : MatchError ) -> str :
95+ def apply (self , match : match_error ) -> str :
9696 result = (
9797 f"[repr.path]{ self ._format_path (match .filename or '' )} [/][dim]:{ match .position } :[/] "
9898 f"[{ match .level } ][bold]{ self .escape (match .tag )} [/]"
@@ -119,7 +119,7 @@ class AnnotationsFormatter(BaseFormatter): # type: ignore[type-arg]
119119 Supported levels: debug, warning, error
120120 """
121121
122- def apply (self , match : MatchError ) -> str :
122+ def apply (self , match : match_error ) -> str :
123123 """Prepare a match instance for reporting as a GitHub Actions annotation."""
124124 file_path = self ._format_path (match .filename or "" )
125125 line_num = match .lineno
@@ -135,15 +135,15 @@ def apply(self, match: MatchError) -> str:
135135class CodeclimateJSONFormatter (BaseFormatter [Any ]):
136136 """Formatter for emitting violations in Codeclimate JSON report format.
137137
138- The formatter expects a list of MatchError objects and returns a JSON formatted string.
138+ The formatter expects a list of match_error objects and returns a JSON formatted string.
139139 The spec for the codeclimate report can be found here:
140140 https://github.com/codeclimate/platform/blob/master/spec/analyzers/SPEC.md#user-content-data-types
141141 """
142142
143- def format_result (self , matches : list [MatchError ]) -> str :
143+ def format_result (self , matches : list [match_error ]) -> str :
144144 """Format a list of match errors as a JSON string."""
145145 if not isinstance (matches , list ):
146- msg = f"The { self .__class__ } was expecting a list of MatchError ."
146+ msg = f"The { self .__class__ } was expecting a list of match_error ."
147147 raise TypeError (msg )
148148
149149 result = []
@@ -180,7 +180,7 @@ def format_result(self, matches: list[MatchError]) -> str:
180180 return json .dumps (result , sort_keys = False )
181181
182182 @staticmethod
183- def _remap_severity (match : MatchError ) -> str :
183+ def _remap_severity (match : match_error ) -> str :
184184 # level is not part of CodeClimate specification, but there is
185185 # no other way to expose that info. We recommend switching to
186186 # SARIF format which is better suited for interoperability.
@@ -207,10 +207,10 @@ class SarifFormatter(BaseFormatter[Any]):
207207 "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.5.json"
208208 )
209209
210- def format_result (self , matches : list [MatchError ]) -> str :
210+ def format_result (self , matches : list [match_error ]) -> str :
211211 """Format a list of match errors as a JSON string."""
212212 if not isinstance (matches , list ):
213- msg = f"The { self .__class__ } was expecting a list of MatchError ."
213+ msg = f"The { self .__class__ } was expecting a list of match_error ."
214214 raise TypeError (msg )
215215
216216 root_path = Path (str (self .base_dir )).as_uri ()
@@ -247,7 +247,7 @@ def format_result(self, matches: list[MatchError]) -> str:
247247
248248 def _extract_results (
249249 self ,
250- matches : list [MatchError ],
250+ matches : list [match_error ],
251251 ) -> tuple [list [Any ], list [Any ]]:
252252 rules = {}
253253 results = []
@@ -257,7 +257,7 @@ def _extract_results(
257257 results .append (self ._to_sarif_result (match ))
258258 return list (rules .values ()), results
259259
260- def _to_sarif_rule (self , match : MatchError ) -> dict [str , Any ]:
260+ def _to_sarif_rule (self , match : match_error ) -> dict [str , Any ]:
261261 rule : dict [str , Any ] = {
262262 "id" : match .tag ,
263263 "name" : match .tag ,
@@ -275,7 +275,7 @@ def _to_sarif_rule(self, match: MatchError) -> dict[str, Any]:
275275 }
276276 return rule
277277
278- def _to_sarif_result (self , match : MatchError ) -> dict [str , Any ]:
278+ def _to_sarif_result (self , match : match_error ) -> dict [str , Any ]:
279279 # https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/sarif-v2.1.0-errata01-os-complete.html#_Toc141790898
280280 if match .level not in ("warning" , "error" , "note" , "none" ):
281281 msg = "Unexpected failure to map '%s' level to SARIF."
@@ -333,7 +333,7 @@ def get_sarif_rule_severity_level(rule: BaseRule) -> str:
333333 return "none"
334334
335335 @staticmethod
336- def get_sarif_result_severity_level (match : MatchError ) -> str :
336+ def get_sarif_result_severity_level (match : match_error ) -> str :
337337 """SARIF severity level for an actual result/match.
338338
339339 Possible values: "none", "note", "warning", "error"
0 commit comments