(raw_ignore_errors)
| 434 | |
| 435 | |
| 436 | def _format_ignore_errors(raw_ignore_errors): |
| 437 | ignore_errors = collections.defaultdict(set) |
| 438 | if raw_ignore_errors: |
| 439 | for error_codes in raw_ignore_errors: |
| 440 | obj_name = None |
| 441 | if " " in error_codes: |
| 442 | obj_name, error_codes = error_codes.split(" ") |
| 443 | |
| 444 | # function errors "pandas.Series PR01,SA01" |
| 445 | if obj_name: |
| 446 | if obj_name in ignore_errors: |
| 447 | raise ValueError( |
| 448 | f"Object `{obj_name}` is present in more than one " |
| 449 | "--ignore_errors argument. Please use it once and specify " |
| 450 | "the errors separated by commas." |
| 451 | ) |
| 452 | ignore_errors[obj_name] = set(error_codes.split(",")) |
| 453 | |
| 454 | unknown_errors = ignore_errors[obj_name] - ALL_ERRORS |
| 455 | if unknown_errors: |
| 456 | raise ValueError( |
| 457 | f"Object `{obj_name}` is ignoring errors {unknown_errors} " |
| 458 | f"which are not known. Known errors are: {ALL_ERRORS}" |
| 459 | ) |
| 460 | |
| 461 | # global errors "PR02,ES01" |
| 462 | else: |
| 463 | ignore_errors[None].update(set(error_codes.split(","))) |
| 464 | |
| 465 | unknown_errors = ignore_errors["*"] - ALL_ERRORS |
| 466 | if unknown_errors: |
| 467 | raise ValueError( |
| 468 | f"Unknown errors {unknown_errors} specified using --ignore_errors " |
| 469 | "Known errors are: {ALL_ERRORS}" |
| 470 | ) |
| 471 | |
| 472 | return ignore_errors |
| 473 | |
| 474 | |
| 475 | def main(func_name, output_format, prefix, ignore_deprecated, ignore_errors): |
no test coverage detected