Handle an error reported by a check. :param code: The error code found, e.g., E123. :param filename: The file in which the error was found. :param line_number: The line number (where counting starts at 1) at which the error occ
(
self,
code: str,
filename: str,
line_number: int,
column_number: int,
text: str,
physical_line: str | None = None,
)
| 258 | yield guide |
| 259 | |
| 260 | def handle_error( |
| 261 | self, |
| 262 | code: str, |
| 263 | filename: str, |
| 264 | line_number: int, |
| 265 | column_number: int, |
| 266 | text: str, |
| 267 | physical_line: str | None = None, |
| 268 | ) -> int: |
| 269 | """Handle an error reported by a check. |
| 270 | |
| 271 | :param code: |
| 272 | The error code found, e.g., E123. |
| 273 | :param filename: |
| 274 | The file in which the error was found. |
| 275 | :param line_number: |
| 276 | The line number (where counting starts at 1) at which the error |
| 277 | occurs. |
| 278 | :param column_number: |
| 279 | The column number (where counting starts at 1) at which the error |
| 280 | occurs. |
| 281 | :param text: |
| 282 | The text of the error message. |
| 283 | :param physical_line: |
| 284 | The actual physical line causing the error. |
| 285 | :returns: |
| 286 | 1 if the error was reported. 0 if it was ignored. This is to allow |
| 287 | for counting of the number of errors found that were not ignored. |
| 288 | """ |
| 289 | guide = self.style_guide_for(filename) |
| 290 | return guide.handle_error( |
| 291 | code, filename, line_number, column_number, text, physical_line |
| 292 | ) |
| 293 | |
| 294 | |
| 295 | class StyleGuide: |