MCPcopy Index your code
hub / github.com/python/cpython / cmd_check

Function cmd_check

Tools/c-analyzer/c_analyzer/__main__.py:296–358  ·  view source on GitHub ↗
(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
              )

Source from the content-addressed store, hash-verified

294
295
296def 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:

Callers

nothing calls this directly

Calls 13

infoMethod · 0.95
PrinterClass · 0.90
filter_filenamesFunction · 0.90
_get_check_handlersFunction · 0.85
filter_forwardFunction · 0.85
handle_failureFunction · 0.85
handle_afterFunction · 0.85
group_by_storageFunction · 0.85
_fmt_one_summaryFunction · 0.85
fix_filenamesMethod · 0.80
appendMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…