Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@ pub fn run(
Some(&project_name),
*page,
*page_size,
None,
None,
) {
Ok(scans) => {
let page = scans.page;
Expand Down Expand Up @@ -306,6 +308,7 @@ pub fn run(
"Status".to_string(),
"Repo".to_string(),
"Branch".to_string(),
"SHA".to_string(),
]];

for scan in &scans {
Expand All @@ -321,13 +324,19 @@ pub fn run(
} else {
formatted_repo
};
let short_sha = scan
.git_sha
.as_deref()
.map(|s| s.chars().take(8).collect::<String>())
.unwrap_or_else(|| "N/A".to_string());

table.push(vec![
scan.id.clone(),
scan.project.clone(),
scan.status.clone(),
formatted_repo,
scan.branch.clone().unwrap_or("N/A".to_string()),
short_sha,
]);
}

Expand Down
30 changes: 30 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ enum Commands {
#[arg(long, help = "Only scan uncommitted changes.")]
only_uncommitted: bool,

#[arg(
long,
help = "Skip the scan if this commit already has a completed BLAST scan for the same project and branch within the last 24h. Requires a clean git checkout. Only for a default blast scan (not with --fail, --fail-on, --only-uncommitted, --target, --exclude, --scan-type, --policy, or --out-file/--out-format)."
)]
skip_if_scanned: bool,

#[arg(
short,
long,
Expand Down Expand Up @@ -489,6 +495,7 @@ fn main() {
fail_on,
fail,
only_uncommitted,
skip_if_scanned,
scan_type,
policy,
out_format,
Expand Down Expand Up @@ -519,6 +526,28 @@ fn main() {
std::process::exit(1);
}

if *skip_if_scanned && *scanner != Scanner::Blast {
::log::error!("--skip-if-scanned is only supported with the blast scanner.");
std::process::exit(1);
}

if *skip_if_scanned
&& (*fail
|| fail_on.is_some()
|| *only_uncommitted
|| target.is_some()
|| exclude.is_some()
|| scan_type.is_some()
|| policy.is_some()
|| out_file.is_some()
|| out_format.is_some())
{
::log::error!(
"--skip-if-scanned only applies to a default blast scan. It cannot be combined with --fail, --fail-on, --only-uncommitted, --target, --exclude, --scan-type, --policy, or --out-file/--out-format."
);
std::process::exit(1);
}

if out_file.is_some() && *scanner != Scanner::Blast {
::log::error!("out_file is only supported with blast scanner.");
std::process::exit(1);
Expand Down Expand Up @@ -591,6 +620,7 @@ fn main() {
fail_on.clone(),
fail,
only_uncommitted,
skip_if_scanned,
scan_type.clone(),
policy.clone(),
out_format.clone(),
Expand Down
Loading
Loading