(filenames, *,
checks=None,
ignored=None,
fmt=None,
failfast=False,
iter_filenames=None,
relroot=fsutil.USE_CWD,
track_progress=None,
verbosity=VERBOSITY,
_analyze=_analyze,
_CHECKS=CHECKS,
**kwargs
)
| 294 | |
| 295 | |
| 296 | def cmd_check(filenames, *, |
| 297 | checks=None, |
| 298 | ignored=None, |
| 299 | fmt=None, |
| 300 | failfast=False, |
| 301 | iter_filenames=None, |
| 302 | relroot=fsutil.USE_CWD, |
| 303 | track_progress=None, |
| 304 | verbosity=VERBOSITY, |
| 305 | _analyze=_analyze, |
| 306 | _CHECKS=CHECKS, |
| 307 | **kwargs |
| 308 | ): |
| 309 | if not checks: |
| 310 | checks = _CHECKS |
| 311 | elif isinstance(checks, str): |
| 312 | checks = [checks] |
| 313 | checks = [_CHECKS[c] if isinstance(c, str) else c |
| 314 | for c in checks] |
| 315 | printer = Printer(verbosity) |
| 316 | (handle_failure, handle_after, div |
| 317 | ) = _get_check_handlers(fmt, printer, verbosity) |
| 318 | |
| 319 | filenames, relroot = fsutil.fix_filenames(filenames, relroot=relroot) |
| 320 | filenames = filter_filenames(filenames, iter_filenames, relroot) |
| 321 | if track_progress: |
| 322 | filenames = track_progress(filenames) |
| 323 | |
| 324 | logger.info('analyzing files...') |
| 325 | analyzed = _analyze(filenames, **kwargs) |
| 326 | analyzed.fix_filenames(relroot, normalize=False) |
| 327 | decls = filter_forward(analyzed, markpublic=True) |
| 328 | |
| 329 | logger.info('checking analysis results...') |
| 330 | failed = [] |
| 331 | for data, failure in _check_all(decls, checks, failfast=failfast): |
| 332 | if data is None: |
| 333 | printer.info('stopping after one failure') |
| 334 | break |
| 335 | if div is not None and len(failed) > 0: |
| 336 | printer.info(div) |
| 337 | failed.append(data) |
| 338 | handle_failure(failure, data) |
| 339 | handle_after() |
| 340 | |
| 341 | printer.info('-------------------------') |
| 342 | logger.info(f'total failures: {len(failed)}') |
| 343 | logger.info('done checking') |
| 344 | |
| 345 | if fmt == 'summary': |
| 346 | print('Categorized by storage:') |
| 347 | print() |
| 348 | from .match import group_by_storage |
| 349 | grouped = group_by_storage(failed, ignore_non_match=False) |
| 350 | for group, decls in grouped.items(): |
| 351 | print() |
| 352 | print(group) |
| 353 | for decl in decls: |
nothing calls this directly
no test coverage detected
searching dependent graphs…