#![forbid(unsafe_code)]
#![deny(clippy::unwrap_used, clippy::expect_used)]
#![cfg_attr(test, allow(clippy::expect_used, clippy::unwrap_used))]
use camino::Utf8PathBuf;
use cordance_core::source::{SourceClass, SourceRecord};
pub mod blocked;
pub mod classifier;
pub mod hasher;
pub mod walker;
#[derive(Debug, thiserror::Error)]
pub enum ScanError {
#[error("io error reading {path}: {source}")]
Io {
path: Utf8PathBuf,
#[source]
source: std::io::Error,
},
#[error("path is not valid utf-8: {0}")]
NonUtf8Path(String),
}
#[allow(clippy::missing_errors_doc)]
pub fn scan_repo(root: &Utf8PathBuf) -> Result<Vec<SourceRecord>, ScanError> {
walker::walk(root)
}
#[must_use]
pub fn classify_by_path(rel_path: &str) -> SourceClass {
classifier::classify(rel_path)
}