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) -> () {
|
fn check_file(file: DirEntry, stats: &mut Stats, no_emoji: bool, show_success: bool) -> () {
|
||||||
let file_type = file.file_type();
|
let file_type = file.file_type();
|
||||||
if file_type.is_file() {
|
if file_type.is_file() {
|
||||||
stats.files += 1;
|
|
||||||
let filename = file.file_name().to_str().unwrap();
|
let filename = file.file_name().to_str().unwrap();
|
||||||
match lint_file_name(&file, filename) {
|
match lint_file_name(&file, filename) {
|
||||||
ComplianceStatus::NotMatched => {
|
ComplianceStatus::NotMatched => {
|
||||||
|
stats.files += 1;
|
||||||
stats.error += 1;
|
stats.error += 1;
|
||||||
println!("{} {} --- (Failed to match)", get_status_icon(StatusIcon::Failure, no_emoji), filename)
|
println!("{} {} --- (Failed to match)", get_status_icon(StatusIcon::Failure, no_emoji), filename)
|
||||||
}
|
}
|
||||||
ComplianceStatus::NonCompliant(reason) => {
|
ComplianceStatus::NonCompliant(reason) => {
|
||||||
|
stats.files += 1;
|
||||||
stats.warning += 1;
|
stats.warning += 1;
|
||||||
println!("{} {} --- ({})", get_status_icon(StatusIcon::Warning, no_emoji), filename, reason);
|
println!("{} {} --- ({})", get_status_icon(StatusIcon::Warning, no_emoji), filename, reason);
|
||||||
}
|
}
|
||||||
ComplianceStatus::Compliant => {
|
ComplianceStatus::Compliant => {
|
||||||
|
stats.files += 1;
|
||||||
stats.success += 1;
|
stats.success += 1;
|
||||||
if show_success {
|
if show_success {
|
||||||
println!("{} {}", get_status_icon(StatusIcon::Success, no_emoji), filename)
|
println!("{} {}", get_status_icon(StatusIcon::Success, no_emoji), filename)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ComplianceStatus::Ignored => {}
|
||||||
}
|
}
|
||||||
} else if file_type.is_dir() {
|
} else if file_type.is_dir() {
|
||||||
println!("\n\n=== {} {}", get_status_icon(StatusIcon::Directory, no_emoji), file.path().display())
|
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 {
|
fn lint_file_name(file: &DirEntry, filename: &str) -> ComplianceStatus {
|
||||||
if let Some(ext) = file.path().extension() {
|
if let Some(ext) = file.path().extension() {
|
||||||
if !VIDEO_EXTENSIONS.contains(&ext.to_str().unwrap()) {
|
if !VIDEO_EXTENSIONS.contains(&ext.to_str().unwrap()) {
|
||||||
return ComplianceStatus::Compliant;
|
return ComplianceStatus::Ignored;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ pub enum ComplianceStatus {
|
||||||
NonCompliant(NonCompliantReason),
|
NonCompliant(NonCompliantReason),
|
||||||
NotMatched,
|
NotMatched,
|
||||||
Compliant,
|
Compliant,
|
||||||
|
Ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum FixStatus {
|
pub enum FixStatus {
|
||||||
|
|
Loading…
Reference in a new issue