Skip to content

Commit

Permalink
Nyth: generate-judge-report -> options for "scope", "exclude", "no-sn…
Browse files Browse the repository at this point in the history
…ippets" added (#205)

Co-authored-by: Alex Roan <[email protected]>
  • Loading branch information
TilakMaddy and alexroan authored Mar 13, 2024
1 parent ee90bd0 commit d487944
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 6 deletions.
14 changes: 10 additions & 4 deletions bot/src/bot_brain/custom_detectors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,20 @@ pub fn refresh_metadata() {
_ = serde_json::to_writer_pretty(bw, &value);
}

pub fn generate_report_for_judge(root: &str, output: &str) {
pub fn generate_report_for_judge(
root: &str,
output: &str,
exclude: Option<Vec<String>>,
scope: Option<Vec<String>>,
no_snippets: bool,
) {
drive_with(
Args {
root: root.to_string(),
output: output.to_string(),
exclude: None,
scope: None,
no_snippets: false,
exclude,
scope,
no_snippets,
},
custom_detectors(),
)
Expand Down
31 changes: 29 additions & 2 deletions bot/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,23 @@ enum PilotCommand {
GenerateReportForJudge {
/// Root folder of competition's project
root: String,

/// Markdown file for judging path/to/*.judge.md
output: String,

/// List of path strings to include, delimited by comma (no spaces).
/// Any solidity file path not containing these strings will be ignored
#[clap(short, long, use_value_delimiter = true)]
scope: Option<Vec<String>>,

/// List of path strings to exclude, delimited by comma (no spaces).
/// Any solidity file path containing these strings will be ignored
#[clap(short, long, use_value_delimiter = true)]
exclude: Option<Vec<String>>,

/// Do not include code snippets in the report (reduces report size in large repos)
#[arg(short, long)]
no_snippets: bool,
},
}

Expand All @@ -61,8 +76,20 @@ fn main() {

match cmd_args.pilot.unwrap() {
PilotCommand::RefreshMetadata => bot_brain::refresh_metadata(),
PilotCommand::GenerateReportForJudge { root, output } => {
bot_brain::generate_report_for_judge(root.as_str(), output.as_str());
PilotCommand::GenerateReportForJudge {
root,
output,
scope,
exclude,
no_snippets,
} => {
bot_brain::generate_report_for_judge(
root.as_str(),
output.as_str(),
exclude,
scope,
no_snippets,
);
}
}
}
Binary file modified nyth/archive.zip
Binary file not shown.

0 comments on commit d487944

Please sign in to comment.