MCPcopy Create free account
hub / github.com/FastLED/FastLED / run_cli

Function run_cli

ci/lint_cpp_rs/src/lib.rs:1520–1552  ·  view source on GitHub ↗
(args: I)

Source from the content-addressed store, hash-verified

1518}
1519
1520pub fn run_cli<I>(args: I) -> Result<u8, DynError>
1521where
1522 I: IntoIterator<Item = String>,
1523{
1524 let config = CliConfig::parse(args)?;
1525
1526 if config.show_help {
1527 return Ok(0);
1528 }
1529
1530 if config.list_checkers {
1531 for checker in supported_checker_names() {
1532 println!("{checker}");
1533 }
1534 return Ok(0);
1535 }
1536
1537 let selected = config.selected_checkers.as_ref();
1538 let checkers = create_checkers(selected)?;
1539 let files = collect_input_files(&config.project_root, &config.paths)?;
1540 let mut processor = MultiCheckerFileProcessor::new();
1541 let violations =
1542 processor.process_files_with_checkers(&files, &checkers, &config.project_root)?;
1543
1544 match config.output_format {
1545 OutputFormat::Json => {
1546 println!("{}", serde_json::to_string_pretty(&violations)?);
1547 }
1548 OutputFormat::Text => print_text_results(&violations, &config.project_root),
1549 }
1550
1551 Ok(if violations.is_empty() { 0 } else { 1 })
1552}
1553
1554#[derive(Debug)]
1555struct CliConfig {

Callers 1

mainFunction · 0.85

Calls 6

supported_checker_namesFunction · 0.85
collect_input_filesFunction · 0.85
print_text_resultsFunction · 0.85
create_checkersFunction · 0.70
is_emptyMethod · 0.45

Tested by

no test coverage detected