Ignore all non-media files
This commit is contained in:
parent
a9b4f5960b
commit
b0d682105c
2 changed files with 6 additions and 2 deletions
|
@ -61,23 +61,26 @@ fn main() -> Result<()> {
|
|||
fn check_file(file: DirEntry, stats: &mut Stats, no_emoji: bool, show_success: bool) -> () {
|
||||
let file_type = file.file_type();
|
||||
if file_type.is_file() {
|
||||
stats.files += 1;
|
||||
let filename = file.file_name().to_str().unwrap();
|
||||
match lint_file_name(&file, filename) {
|
||||
ComplianceStatus::NotMatched => {
|
||||
stats.files += 1;
|
||||
stats.error += 1;
|
||||
println!("{} {} --- (Failed to match)", get_status_icon(StatusIcon::Failure, no_emoji), filename)
|
||||
}
|
||||
ComplianceStatus::NonCompliant(reason) => {
|
||||
stats.files += 1;
|
||||
stats.warning += 1;
|
||||
println!("{} {} --- ({})", get_status_icon(StatusIcon::Warning, no_emoji), filename, reason);
|
||||
}
|
||||
ComplianceStatus::Compliant => {
|
||||
stats.files += 1;
|
||||
stats.success += 1;
|
||||
if show_success {
|
||||
println!("{} {}", get_status_icon(StatusIcon::Success, no_emoji), filename)
|
||||
}
|
||||
}
|
||||
ComplianceStatus::Ignored => {}
|
||||
}
|
||||
} else if file_type.is_dir() {
|
||||
println!("\n\n=== {} {}", get_status_icon(StatusIcon::Directory, no_emoji), file.path().display())
|
||||
|
@ -87,7 +90,7 @@ fn check_file(file: DirEntry, stats: &mut Stats, no_emoji: bool, show_success: b
|
|||
fn lint_file_name(file: &DirEntry, filename: &str) -> ComplianceStatus {
|
||||
if let Some(ext) = file.path().extension() {
|
||||
if !VIDEO_EXTENSIONS.contains(&ext.to_str().unwrap()) {
|
||||
return ComplianceStatus::Compliant;
|
||||
return ComplianceStatus::Ignored;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ pub enum ComplianceStatus {
|
|||
NonCompliant(NonCompliantReason),
|
||||
NotMatched,
|
||||
Compliant,
|
||||
Ignored
|
||||
}
|
||||
|
||||
pub enum FixStatus {
|
||||
|
|
Loading…
Reference in a new issue