aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart
diff options
context:
space:
mode:
Diffstat (limited to 'crates/mozart')
-rw-r--r--crates/mozart/src/commands/archive.rs8
-rw-r--r--crates/mozart/src/commands/audit.rs28
-rw-r--r--crates/mozart/src/commands/browse.rs14
-rw-r--r--crates/mozart/src/commands/bump.rs30
-rw-r--r--crates/mozart/src/commands/check_platform_reqs.rs44
-rw-r--r--crates/mozart/src/commands/config.rs66
-rw-r--r--crates/mozart/src/commands/create_project.rs16
-rw-r--r--crates/mozart/src/commands/dependency.rs34
-rw-r--r--crates/mozart/src/commands/diagnose.rs32
-rw-r--r--crates/mozart/src/commands/exec.rs10
-rw-r--r--crates/mozart/src/commands/fund.rs22
-rw-r--r--crates/mozart/src/commands/global.rs8
-rw-r--r--crates/mozart/src/commands/licenses.rs22
-rw-r--r--crates/mozart/src/commands/outdated.rs30
-rw-r--r--crates/mozart/src/commands/reinstall.rs20
-rw-r--r--crates/mozart/src/commands/remove.rs6
-rw-r--r--crates/mozart/src/commands/repository.rs38
-rw-r--r--crates/mozart/src/commands/require.rs4
-rw-r--r--crates/mozart/src/commands/run_script.rs24
-rw-r--r--crates/mozart/src/commands/search.rs18
-rw-r--r--crates/mozart/src/commands/self_update.rs54
-rw-r--r--crates/mozart/src/commands/show.rs36
-rw-r--r--crates/mozart/src/commands/status.rs24
-rw-r--r--crates/mozart/src/commands/suggests.rs26
-rw-r--r--crates/mozart/src/commands/update.rs62
-rw-r--r--crates/mozart/src/commands/validate.rs54
26 files changed, 0 insertions, 730 deletions
diff --git a/crates/mozart/src/commands/archive.rs b/crates/mozart/src/commands/archive.rs
index eea62d1..a075ade 100644
--- a/crates/mozart/src/commands/archive.rs
+++ b/crates/mozart/src/commands/archive.rs
@@ -27,8 +27,6 @@ pub struct ArchiveArgs {
pub ignore_filters: bool,
}
-// ─── Archive config helpers ───────────────────────────────────────────────────
-
/// Read `archive.name` and `archive.exclude` from a composer.json file.
fn read_archive_config(
composer_json_path: &std::path::Path,
@@ -57,8 +55,6 @@ fn read_archive_config(
Ok((name, excludes))
}
-// ─── Metadata for a resolved package ─────────────────────────────────────────
-
struct PackageMeta {
source_dir: PathBuf,
package_name: String,
@@ -81,8 +77,6 @@ impl Drop for PackageMeta {
}
}
-// ─── Main entry point ─────────────────────────────────────────────────────────
-
pub async fn execute(
args: &ArchiveArgs,
cli: &super::Cli,
@@ -249,8 +243,6 @@ pub async fn execute(
Ok(())
}
-// ─── Remote package resolution ────────────────────────────────────────────────
-
async fn resolve_remote_package(
package_name: &str,
version_constraint: Option<&str>,
diff --git a/crates/mozart/src/commands/audit.rs b/crates/mozart/src/commands/audit.rs
index 881a54f..a1b4e4a 100644
--- a/crates/mozart/src/commands/audit.rs
+++ b/crates/mozart/src/commands/audit.rs
@@ -32,8 +32,6 @@ pub struct AuditArgs {
pub ignore_unreachable: bool,
}
-// ─── Internal types ───────────────────────────────────────────────────────────
-
#[derive(Debug)]
struct PackageEntry {
name: String,
@@ -67,8 +65,6 @@ struct AuditResult {
total_advisory_count: usize,
}
-// ─── Main entry point ─────────────────────────────────────────────────────────
-
pub async fn execute(
args: &AuditArgs,
cli: &super::Cli,
@@ -165,8 +161,6 @@ pub async fn execute(
Ok(())
}
-// ─── Package loading ──────────────────────────────────────────────────────────
-
fn load_packages(
working_dir: &Path,
locked: bool,
@@ -245,8 +239,6 @@ fn load_locked_packages(working_dir: &Path, no_dev: bool) -> anyhow::Result<Vec<
Ok(packages)
}
-// ─── Advisory filtering ───────────────────────────────────────────────────────
-
fn filter_advisories(
all_advisories: &BTreeMap<String, Vec<SecurityAdvisory>>,
packages: &[PackageEntry],
@@ -327,8 +319,6 @@ fn filter_advisories(
result
}
-// ─── Helpers ─────────────────────────────────────────────────────────────────
-
/// Normalize single-pipe OR separators (`|`) in a version constraint string to
/// double-pipe (`||`) so the constraint parser can handle both forms.
///
@@ -360,8 +350,6 @@ fn normalize_or_separator(constraint: &str) -> String {
result
}
-// ─── Abandoned detection ──────────────────────────────────────────────────────
-
fn detect_abandoned(packages: &[PackageEntry]) -> Vec<AbandonedPackage> {
let mut result = Vec::new();
@@ -386,8 +374,6 @@ fn detect_abandoned(packages: &[PackageEntry]) -> Vec<AbandonedPackage> {
result
}
-// ─── Output rendering ─────────────────────────────────────────────────────────
-
fn render_table(result: &AuditResult, console: &mozart_core::console::Console) {
if result.total_advisory_count == 0 && result.abandoned.is_empty() {
console.info(&format!(
@@ -692,8 +678,6 @@ fn render_summary(result: &AuditResult, console: &mozart_core::console::Console)
}
}
-// ─── Tests ────────────────────────────────────────────────────────────────────
-
#[cfg(test)]
mod tests {
use super::*;
@@ -744,8 +728,6 @@ mod tests {
}
}
- // ── filter_advisories ────────────────────────────────────────────────────
-
fn make_console() -> mozart_core::console::Console {
mozart_core::console::Console::new(0, false, false, false, false)
}
@@ -834,8 +816,6 @@ mod tests {
assert!(result.is_empty());
}
- // ── detect_abandoned ─────────────────────────────────────────────────────
-
#[test]
fn test_detect_abandoned_true() {
let packages = vec![make_pkg_abandoned("old/pkg", "1.0.0", None)];
@@ -874,8 +854,6 @@ mod tests {
assert!(result.iter().any(|p| p.name == "dead/pkg"));
}
- // ── load_installed_packages ───────────────────────────────────────────────
-
#[test]
fn test_load_installed_packages() {
use tempfile::tempdir;
@@ -1099,8 +1077,6 @@ mod tests {
assert!(msg.contains("composer.lock"));
}
- // ── render_json ───────────────────────────────────────────────────────────
-
#[test]
fn test_render_json_structure() {
let advisory = make_advisory("PKSA-0001", "vendor/pkg", ">=1.0,<2.0", Some("high"));
@@ -1143,8 +1119,6 @@ mod tests {
render_json(&result, &console).unwrap();
}
- // ── argument validation ───────────────────────────────────────────────────
-
#[test]
fn test_invalid_format() {
// We test the validation logic directly
@@ -1180,8 +1154,6 @@ mod tests {
}
}
- // ── AdvisorySource used in test helper (suppress dead_code) ──────────────
-
#[test]
fn test_advisory_source_fields() {
let src = AdvisorySource {
diff --git a/crates/mozart/src/commands/browse.rs b/crates/mozart/src/commands/browse.rs
index 7ee1858..090c412 100644
--- a/crates/mozart/src/commands/browse.rs
+++ b/crates/mozart/src/commands/browse.rs
@@ -18,8 +18,6 @@ pub struct BrowseArgs {
pub show: bool,
}
-// ─── Main entry point ────────────────────────────────────────────────────────
-
pub async fn execute(
args: &BrowseArgs,
cli: &super::Cli,
@@ -85,8 +83,6 @@ pub async fn execute(
Ok(())
}
-// ─── URL resolution ───────────────────────────────────────────────────────────
-
enum ResolveResult {
/// Package found and URL resolved
Found(String),
@@ -155,8 +151,6 @@ async fn resolve_url(
}
}
-// ─── URL extraction ───────────────────────────────────────────────────────────
-
fn extract_url_from_locked(
pkg: &mozart_registry::lockfile::LockedPackage,
prefer_homepage: bool,
@@ -247,8 +241,6 @@ fn extract_url_from_packagist(
.map(|u| u.to_string())
}
-// ─── Helpers ──────────────────────────────────────────────────────────────────
-
fn is_valid_url(url: &str) -> bool {
match url::Url::parse(url) {
Ok(parsed) => matches!(parsed.scheme(), "http" | "https"),
@@ -299,8 +291,6 @@ fn open_browser(url: &str, console: &mozart_core::console::Console) -> anyhow::R
}
}
-// ─── Tests ───────────────────────────────────────────────────────────────────
-
#[cfg(test)]
mod tests {
use super::*;
@@ -344,8 +334,6 @@ mod tests {
}
}
- // ── is_valid_url ──────────────────────────────────────────────────────────
-
#[test]
fn test_is_valid_url() {
assert!(!is_valid_url("https://"));
@@ -356,8 +344,6 @@ mod tests {
assert!(!is_valid_url(""));
}
- // ── extract_url_from_locked ───────────────────────────────────────────────
-
#[test]
fn test_extract_url_from_locked_prefers_support_source() {
// Has all three: support.source should win
diff --git a/crates/mozart/src/commands/bump.rs b/crates/mozart/src/commands/bump.rs
index 72c34a1..b97b86f 100644
--- a/crates/mozart/src/commands/bump.rs
+++ b/crates/mozart/src/commands/bump.rs
@@ -24,8 +24,6 @@ pub struct BumpArgs {
pub dry_run: bool,
}
-// ─── Main entry point ─────────────────────────────────────────────────────────
-
pub async fn execute(
args: &BumpArgs,
cli: &super::Cli,
@@ -217,8 +215,6 @@ pub async fn execute(
Ok(())
}
-// ─── Helpers ──────────────────────────────────────────────────────────────────
-
/// Build a map of lowercase package names to (pretty_version, version_normalized) from composer.lock.
fn build_locked_versions_map(
lock: &mozart_registry::lockfile::LockFile,
@@ -313,8 +309,6 @@ fn is_platform_package(name: &str) -> bool {
|| lower == "php-debug"
}
-// ─── Tests ───────────────────────────────────────────────────────────────────
-
#[cfg(test)]
mod tests {
use super::*;
@@ -399,8 +393,6 @@ mod tests {
}
}
- // ── Basic bump ─────────────────────────────────────────────────────────
-
#[tokio::test]
async fn test_basic_bump_modifies_composer_json() {
let dir = tempdir().unwrap();
@@ -435,8 +427,6 @@ mod tests {
assert_eq!(parsed["require"]["psr/log"], "^1.1.4");
}
- // ── Dry run ────────────────────────────────────────────────────────────
-
#[tokio::test]
async fn test_dry_run_does_not_modify_files() {
let dir = tempdir().unwrap();
@@ -479,8 +469,6 @@ mod tests {
assert_eq!(parsed["require"]["psr/log"], "^1.0");
}
- // ── No changes ─────────────────────────────────────────────────────────
-
#[tokio::test]
async fn test_no_changes_when_already_bumped() {
let dir = tempdir().unwrap();
@@ -516,8 +504,6 @@ mod tests {
assert_eq!(parsed["require"]["psr/log"], "^1.1.4");
}
- // ── Dev-only flag ──────────────────────────────────────────────────────
-
#[tokio::test]
async fn test_dev_only_flag_only_bumps_require_dev() {
let dir = tempdir().unwrap();
@@ -561,8 +547,6 @@ mod tests {
assert_eq!(parsed["require-dev"]["phpunit/phpunit"], "^9.5");
}
- // ── No-dev-only flag ───────────────────────────────────────────────────
-
#[tokio::test]
async fn test_no_dev_only_flag_only_bumps_require() {
let dir = tempdir().unwrap();
@@ -606,8 +590,6 @@ mod tests {
assert_eq!(parsed["require-dev"]["phpunit/phpunit"], "^9.0");
}
- // ── Stale lock file ────────────────────────────────────────────────────
-
#[tokio::test]
async fn test_stale_lock_file_produces_exit_code_2() {
let dir = tempdir().unwrap();
@@ -647,8 +629,6 @@ mod tests {
assert_eq!(mozart_err.exit_code, ERROR_LOCK_OUTDATED);
}
- // ── Platform packages skipped ──────────────────────────────────────────
-
#[test]
fn test_platform_packages_are_skipped() {
assert!(is_platform_package("php"));
@@ -659,8 +639,6 @@ mod tests {
assert!(!is_platform_package("monolog/monolog"));
}
- // ── Lock file hash updated ─────────────────────────────────────────────
-
#[tokio::test]
async fn test_lock_file_hash_updated_after_bump() {
let dir = tempdir().unwrap();
@@ -699,8 +677,6 @@ mod tests {
);
}
- // ── strip_inline_constraint ────────────────────────────────────────────
-
#[test]
fn test_strip_inline_constraint_colon() {
assert_eq!(strip_inline_constraint("vendor/pkg:^2.0"), "vendor/pkg");
@@ -722,8 +698,6 @@ mod tests {
assert_eq!(strip_inline_constraint("psr/log"), "psr/log");
}
- // ── glob_matches ───────────────────────────────────────────────────────
-
#[test]
fn test_glob_matches_exact() {
assert!(glob_matches("psr/log", "psr/log"));
@@ -749,8 +723,6 @@ mod tests {
assert!(glob_matches("psr/log", "psr/log"));
}
- // ── matches_filter ─────────────────────────────────────────────────────
-
#[test]
fn test_matches_filter_exact() {
let filter = vec!["psr/log".to_string()];
@@ -774,8 +746,6 @@ mod tests {
assert!(!matches_filter(&filter, "symfony/console"));
}
- // ── Package filter ─────────────────────────────────────────────────────
-
#[tokio::test]
async fn test_package_filter_only_bumps_specified_packages() {
let dir = tempdir().unwrap();
diff --git a/crates/mozart/src/commands/check_platform_reqs.rs b/crates/mozart/src/commands/check_platform_reqs.rs
index e3d432a..346d479 100644
--- a/crates/mozart/src/commands/check_platform_reqs.rs
+++ b/crates/mozart/src/commands/check_platform_reqs.rs
@@ -18,8 +18,6 @@ pub struct CheckPlatformReqsArgs {
pub format: Option<String>,
}
-// ─── Data structures ─────────────────────────────────────────────────────────
-
/// A single platform requirement collected from a package.
#[derive(Debug, Clone)]
struct PlatformRequirement {
@@ -51,8 +49,6 @@ struct CheckResult {
failed_requirement: Option<(String, String)>,
}
-// ─── Main entry point ────────────────────────────────────────────────────────
-
pub async fn execute(
args: &CheckPlatformReqsArgs,
cli: &super::Cli,
@@ -111,8 +107,6 @@ pub async fn execute(
Ok(())
}
-// ─── Requirement collection ──────────────────────────────────────────────────
-
/// Collect platform requirements from all packages (lock/installed) plus root.
///
/// Returns a map of platform-package-name → list of requirements.
@@ -275,8 +269,6 @@ fn add_platform_requirements_from_map(
}
}
-// ─── Requirement checking ────────────────────────────────────────────────────
-
fn check_requirements(
requirements: &BTreeMap<String, Vec<PlatformRequirement>>,
platform: &[mozart_core::platform::PlatformPackage],
@@ -352,8 +344,6 @@ fn determine_exit_code(results: &[CheckResult]) -> i32 {
code
}
-// ─── Rendering ───────────────────────────────────────────────────────────────
-
fn render_text(results: &[CheckResult], console: &Console) {
if results.is_empty() {
return;
@@ -454,8 +444,6 @@ fn render_json(results: &[CheckResult], console: &Console) -> anyhow::Result<()>
Ok(())
}
-// ─── Tests ───────────────────────────────────────────────────────────────────
-
#[cfg(test)]
mod tests {
use super::*;
@@ -463,8 +451,6 @@ mod tests {
use std::collections::BTreeMap;
use tempfile::tempdir;
- // ── Helpers ──────────────────────────────────────────────────────────────
-
fn test_console() -> mozart_core::console::Console {
mozart_core::console::Console::new(0, true, false, true, true)
}
@@ -534,8 +520,6 @@ mod tests {
std::fs::write(path, serde_json::to_string_pretty(&lock_json).unwrap()).unwrap();
}
- // ── test_is_platform_package ──────────────────────────────────────────────
-
#[test]
fn test_is_platform_package() {
assert!(mozart_core::platform::is_platform_package("php"));
@@ -559,8 +543,6 @@ mod tests {
));
}
- // ── test_collect_requirements_from_lock ──────────────────────────────────
-
#[test]
fn test_collect_requirements_from_lock() {
let dir = tempdir().unwrap();
@@ -608,8 +590,6 @@ mod tests {
assert_eq!(php_reqs[0].provider, "vendor/pkg");
}
- // ── test_collect_requirements_no_dev ─────────────────────────────────────
-
#[test]
fn test_collect_requirements_no_dev() {
let dir = tempdir().unwrap();
@@ -662,8 +642,6 @@ mod tests {
);
}
- // ── test_collect_requirements_includes_root ───────────────────────────────
-
#[test]
fn test_collect_requirements_includes_root() {
let dir = tempdir().unwrap();
@@ -704,8 +682,6 @@ mod tests {
);
}
- // ── test_check_requirements_all_pass ─────────────────────────────────────
-
#[test]
fn test_check_requirements_all_pass() {
let requirements =
@@ -725,8 +701,6 @@ mod tests {
assert_eq!(determine_exit_code(&results), 0);
}
- // ── test_check_requirements_version_mismatch ─────────────────────────────
-
#[test]
fn test_check_requirements_version_mismatch() {
let requirements = make_requirements(&[("php", ">=8.2", "vendor/pkg")]);
@@ -740,8 +714,6 @@ mod tests {
assert_eq!(determine_exit_code(&results), 1);
}
- // ── test_check_requirements_missing ──────────────────────────────────────
-
#[test]
fn test_check_requirements_missing() {
let requirements = make_requirements(&[("ext-foobar", "*", "vendor/pkg")]);
@@ -754,8 +726,6 @@ mod tests {
assert_eq!(determine_exit_code(&results), 2);
}
- // ── test_check_requirements_mixed ────────────────────────────────────────
-
#[test]
fn test_check_requirements_mixed() {
let requirements = make_requirements(&[
@@ -780,8 +750,6 @@ mod tests {
assert_eq!(determine_exit_code(&results), 2);
}
- // ── test_check_requirements_multiple_constraints ──────────────────────────
-
#[test]
fn test_check_requirements_multiple_constraints() {
// Two packages both require php, one with a tighter constraint
@@ -800,8 +768,6 @@ mod tests {
assert_eq!(failed_provider, "vendor/b");
}
- // ── test_output_json_format ───────────────────────────────────────────────
-
#[test]
fn test_output_json_format() {
let results = [
@@ -860,8 +826,6 @@ mod tests {
assert_eq!(json_results[1]["provider"], "vendor/pkg");
}
- // ── test_lib_packages_always_missing ─────────────────────────────────────
-
#[test]
fn test_lib_packages_always_missing() {
// lib-pcre present in platform with satisfying version → Success
@@ -877,8 +841,6 @@ mod tests {
);
}
- // ── test_composer_api_packages_missing ───────────────────────────────────
-
#[test]
fn test_composer_api_packages_missing() {
// composer-plugin-api and composer-runtime-api present in platform → Success
@@ -904,8 +866,6 @@ mod tests {
}
}
- // ── test_lib_package_constraint_not_satisfied ─────────────────────────────
-
#[test]
fn test_lib_package_constraint_not_satisfied() {
// lib-pcre is in platform but constraint does NOT match → Failed
@@ -922,8 +882,6 @@ mod tests {
assert_eq!(results[0].version, "10.42");
}
- // ── test_lib_package_not_in_platform ─────────────────────────────────────
-
#[test]
fn test_lib_package_not_in_platform() {
// lib-pcre is NOT in platform data at all → Missing
@@ -940,8 +898,6 @@ mod tests {
assert_eq!(results[0].version, "n/a");
}
- // ── test_determine_exit_code ──────────────────────────────────────────────
-
#[test]
fn test_determine_exit_code_all_success() {
let results = vec![CheckResult {
diff --git a/crates/mozart/src/commands/config.rs b/crates/mozart/src/commands/config.rs
index 1946264..71a5981 100644
--- a/crates/mozart/src/commands/config.rs
+++ b/crates/mozart/src/commands/config.rs
@@ -60,12 +60,8 @@ pub struct ConfigArgs {
pub source: bool,
}
-// ─── ComposerConfig ───────────────────────────────────────────────────────────
-
pub use mozart_core::composer::{ComposerConfig, resolve_references};
-// ─── ConfigValueType ─────────────────────────────────────────────────────────
-
/// Classification of config key value types for validation and normalization.
#[derive(Debug)]
enum ConfigValueType {
@@ -277,8 +273,6 @@ fn normalize_bool(key: &str, value: &str) -> anyhow::Result<serde_json::Value> {
}
}
-// ─── Repository helpers ───────────────────────────────────────────────────────
-
/// Match `repo.X`, `repos.X`, `repositories.X` and return the suffix X.
fn match_repository_key(key: &str) -> Option<&str> {
for prefix in &["repositories.", "repos.", "repo."] {
@@ -291,8 +285,6 @@ fn match_repository_key(key: &str) -> Option<&str> {
None
}
-// ─── JSON path helpers ────────────────────────────────────────────────────────
-
/// Set a value at a dot-separated path within a JSON Value.
/// Creates intermediate objects as needed.
fn json_set_nested(root: &mut serde_json::Value, path: &str, value: serde_json::Value) {
@@ -337,8 +329,6 @@ fn json_remove_nested(root: &mut serde_json::Value, path: &str) -> bool {
}
}
-// ─── File I/O helpers ─────────────────────────────────────────────────────────
-
/// Determine which JSON file to read/write.
/// - `--global` → `$COMPOSER_HOME/config.json`
/// - `--file <path>` → user-specified file
@@ -356,8 +346,6 @@ fn resolve_config_file_path(args: &ConfigArgs, cli: &super::Cli) -> anyhow::Resu
Ok(cli.working_dir()?.join("composer.json"))
}
-// ─── Helpers ──────────────────────────────────────────────────────────────────
-
/// Load the `config` section from a JSON file (global `config.json` or local
/// `composer.json`). Returns an empty map when the file is absent or has no
/// `config` key.
@@ -379,10 +367,6 @@ fn load_config_section(
}
}
-// ─── Value rendering ─────────────────────────────────────────────────────────
-
-// ─── execute() ───────────────────────────────────────────────────────────────
-
pub async fn execute(
args: &ConfigArgs,
cli: &super::Cli,
@@ -411,8 +395,6 @@ pub async fn execute(
execute_read(args, cli, &config_file_path, console)
}
-// ─── execute_editor() ────────────────────────────────────────────────────────
-
fn execute_editor(args: &ConfigArgs, cli: &super::Cli) -> anyhow::Result<()> {
let file_path = resolve_config_file_path(args, cli)?;
@@ -438,8 +420,6 @@ fn execute_editor(args: &ConfigArgs, cli: &super::Cli) -> anyhow::Result<()> {
Ok(())
}
-// ─── execute_write() ─────────────────────────────────────────────────────────
-
fn execute_write(
args: &ConfigArgs,
_cli: &super::Cli,
@@ -463,8 +443,6 @@ fn execute_write(
Ok(())
}
-// ─── execute_unset() ─────────────────────────────────────────────────────────
-
fn execute_unset(json: &mut serde_json::Value, key: &str, args: &ConfigArgs) -> anyhow::Result<()> {
// 1. Repository key
if let Some(repo_name) = match_repository_key(key) {
@@ -529,8 +507,6 @@ fn split_dotted_config_key(key: &str) -> Option<(&str, &str)> {
None
}
-// ─── execute_set() ───────────────────────────────────────────────────────────
-
fn execute_set(
json: &mut serde_json::Value,
key: &str,
@@ -771,8 +747,6 @@ fn merge_json_values(
}
}
-// ─── execute_read() ──────────────────────────────────────────────────────────
-
fn execute_read(
args: &ConfigArgs,
cli: &super::Cli,
@@ -892,14 +866,10 @@ fn execute_read(
Ok(())
}
-// ─── Tests ───────────────────────────────────────────────────────────────────
-
#[cfg(test)]
mod tests {
use super::*;
- // ── defaults ───────────────────────────────────────────────────────────
-
#[test]
fn test_defaults_contain_expected_keys() {
let cfg = ComposerConfig::defaults();
@@ -958,8 +928,6 @@ mod tests {
assert_eq!(cfg.values["autoloader-suffix"], serde_json::Value::Null);
}
- // ── merge ──────────────────────────────────────────────────────────────
-
#[test]
fn test_merge_overrides_existing_key() {
let mut cfg = ComposerConfig::defaults();
@@ -996,8 +964,6 @@ mod tests {
assert_eq!(cfg.values["vendor-dir"], original_vendor);
}
- // ── reference resolution ───────────────────────────────────────────────
-
#[test]
fn test_reference_resolution_bin_dir() {
let mut cfg = ComposerConfig::defaults();
@@ -1052,8 +1018,6 @@ mod tests {
assert_eq!(cfg.values["process-timeout"], before);
}
- // ── single key query ───────────────────────────────────────────────────
-
#[test]
fn test_get_existing_key() {
let cfg = ComposerConfig::defaults();
@@ -1068,8 +1032,6 @@ mod tests {
assert!(cfg.get("does-not-exist").is_none());
}
- // ── render_value ───────────────────────────────────────────────────────
-
#[test]
fn test_render_value_string() {
assert_eq!(render_value(&serde_json::json!("hello")), "hello");
@@ -1102,8 +1064,6 @@ mod tests {
assert_eq!(render_value(&serde_json::json!({})), "{}");
}
- // ── load_config_section ────────────────────────────────────────────────
-
#[test]
fn test_load_config_section_absent_file() {
let path = std::path::Path::new("/tmp/nonexistent_composer_abc123.json");
@@ -1143,8 +1103,6 @@ mod tests {
assert!(result.is_empty());
}
- // ── full merge pipeline ────────────────────────────────────────────────
-
#[test]
fn test_full_pipeline_project_overrides_are_applied() {
use std::io::Write;
@@ -1173,8 +1131,6 @@ mod tests {
);
}
- // ── match_repository_key ───────────────────────────────────────────────
-
#[test]
fn test_match_repository_key_full() {
assert_eq!(match_repository_key("repositories.foo"), Some("foo"));
@@ -1189,8 +1145,6 @@ mod tests {
assert_eq!(match_repository_key("sort-packages"), None);
}
- // ── json_set_nested / json_remove_nested ───────────────────────────────
-
#[test]
fn test_json_set_nested_simple() {
let mut root = serde_json::json!({});
@@ -1235,8 +1189,6 @@ mod tests {
assert!(!removed);
}
- // ── validate_and_normalize ─────────────────────────────────────────────
-
#[test]
fn test_validate_bool_true() {
let result = validate_and_normalize("sort-packages", "true", &ConfigValueType::Bool);
@@ -1313,8 +1265,6 @@ mod tests {
assert_eq!(result.unwrap(), serde_json::Value::Null);
}
- // ── validate_and_normalize_multi ───────────────────────────────────────
-
#[test]
fn test_validate_multi_string_array() {
let values = vec!["a".to_string(), "b".to_string()];
@@ -1345,8 +1295,6 @@ mod tests {
assert!(result.is_err());
}
- // ── execute_set / execute_unset round-trips ────────────────────────────
-
fn make_empty_json() -> serde_json::Value {
serde_json::json!({})
}
@@ -1480,8 +1428,6 @@ mod tests {
assert!(result.is_err());
}
- // ── unset tests ────────────────────────────────────────────────────────
-
#[test]
fn test_unset_config_value() {
let mut json = serde_json::json!({"config": {"sort-packages": true}});
@@ -1498,8 +1444,6 @@ mod tests {
assert!(result.is_err());
}
- // ── package property tests ─────────────────────────────────────────────
-
#[test]
fn test_set_package_property_name() {
let mut json = make_empty_json();
@@ -1555,8 +1499,6 @@ mod tests {
assert!(json.get("description").is_none());
}
- // ── repository tests ───────────────────────────────────────────────────
-
#[test]
fn test_add_repository() {
let mut json = make_empty_json();
@@ -1670,8 +1612,6 @@ mod tests {
assert_eq!(match_repository_key("repositories.foo"), Some("foo"));
}
- // ── extra/suggest tests ────────────────────────────────────────────────
-
#[test]
fn test_set_extra_property() {
let mut json = make_empty_json();
@@ -1735,8 +1675,6 @@ mod tests {
assert!(json["extra"].get("key").is_none());
}
- // ── dotted config key tests ────────────────────────────────────────────
-
#[test]
fn test_set_platform_php() {
let mut json = make_empty_json();
@@ -1790,8 +1728,6 @@ mod tests {
);
}
- // ── global config file tests ───────────────────────────────────────────
-
#[test]
fn test_global_config_creates_file() {
use tempfile::TempDir;
@@ -1832,8 +1768,6 @@ mod tests {
);
}
- // ── read_json_file default skeleton ───────────────────────────────────
-
#[test]
fn test_read_json_file_missing_global() {
let path = std::path::Path::new("/tmp/nonexistent_global_abc123.json");
diff --git a/crates/mozart/src/commands/create_project.rs b/crates/mozart/src/commands/create_project.rs
index 5461418..3a6e6ba 100644
--- a/crates/mozart/src/commands/create_project.rs
+++ b/crates/mozart/src/commands/create_project.rs
@@ -715,10 +715,6 @@ fn tilde_matches(version_normalized: &str, constraint_base: &str) -> bool {
mod tests {
use super::*;
- // ─────────────────────────────────────────────────────────────────────────
- // dir_from_package_name tests
- // ─────────────────────────────────────────────────────────────────────────
-
#[test]
fn test_directory_from_package_name() {
assert_eq!(dir_from_package_name("vendor/package"), "package");
@@ -728,10 +724,6 @@ mod tests {
assert_eq!(dir_from_package_name("novendor"), "novendor");
}
- // ─────────────────────────────────────────────────────────────────────────
- // Target directory validation tests
- // ─────────────────────────────────────────────────────────────────────────
-
#[test]
fn test_non_empty_directory_rejected() {
let dir = tempfile::tempdir().unwrap();
@@ -770,10 +762,6 @@ mod tests {
);
}
- // ─────────────────────────────────────────────────────────────────────────
- // self.version replacement tests
- // ─────────────────────────────────────────────────────────────────────────
-
#[test]
fn test_self_version_replacement() {
let mut raw = package::RawPackageData::new("vendor/pkg".to_string());
@@ -811,10 +799,6 @@ mod tests {
assert_eq!(raw.require.get("vendor/dep-a").unwrap(), "^1.0");
}
- // ─────────────────────────────────────────────────────────────────────────
- // Version constraint matching tests
- // ─────────────────────────────────────────────────────────────────────────
-
#[test]
fn test_version_matches_caret() {
assert!(version_matches_constraint("1.2.0", "1.2.0.0", "^1.0"));
diff --git a/crates/mozart/src/commands/dependency.rs b/crates/mozart/src/commands/dependency.rs
index 4e24f1d..3b6f8c4 100644
--- a/crates/mozart/src/commands/dependency.rs
+++ b/crates/mozart/src/commands/dependency.rs
@@ -11,10 +11,6 @@ use std::path::Path;
use anyhow::Result;
use mozart_core::console_format;
-// ─────────────────────────────────────────────────────────────────────────────
-// Shared command entry point
-// ─────────────────────────────────────────────────────────────────────────────
-
/// Inputs for [`do_execute`], collected from the `depends` / `prohibits` CLI args.
pub struct DoExecuteArgs<'a> {
pub package: &'a str,
@@ -159,10 +155,6 @@ pub fn do_execute(
))
}
-// ─────────────────────────────────────────────────────────────────────────────
-// Core types
-// ─────────────────────────────────────────────────────────────────────────────
-
/// Normalised view of a package's dependency information.
#[derive(Debug, Clone)]
pub struct PackageInfo {
@@ -195,10 +187,6 @@ pub struct DependencyResult {
pub children: Vec<DependencyResult>,
}
-// ─────────────────────────────────────────────────────────────────────────────
-// Package loading
-// ─────────────────────────────────────────────────────────────────────────────
-
/// Load all packages relevant to the dependency query.
///
/// When `locked` is true (or the lock file exists), reads from `composer.lock`.
@@ -348,10 +336,6 @@ fn load_from_installed(working_dir: &Path) -> Result<Vec<PackageInfo>> {
Ok(packages)
}
-// ─────────────────────────────────────────────────────────────────────────────
-// Core algorithm
-// ─────────────────────────────────────────────────────────────────────────────
-
/// Find all packages that have a dependency relationship with the needle(s).
///
/// * `packages` — the full set of packages to search through.
@@ -376,8 +360,6 @@ pub fn get_dependents(
}
}
-// ── Forward (depends) ─────────────────────────────────────────────────────────
-
fn get_dependents_forward(
packages: &[PackageInfo],
needles: &[String],
@@ -485,8 +467,6 @@ fn recurse_dependents(
results
}
-// ── Inverted (prohibits) ──────────────────────────────────────────────────────
-
fn get_prohibitors(
packages: &[PackageInfo],
needles: &[String],
@@ -662,10 +642,6 @@ fn sample_versions_from_constraint(
.collect()
}
-// ─────────────────────────────────────────────────────────────────────────────
-// Output helpers
-// ─────────────────────────────────────────────────────────────────────────────
-
/// Print results as a flat table.
///
/// Columns: package name | version | link description | link constraint
@@ -774,10 +750,6 @@ fn tree_prefix(depth: usize, is_last: bool) -> String {
format!("{indent}{branch}")
}
-// ─────────────────────────────────────────────────────────────────────────────
-// Tests
-// ─────────────────────────────────────────────────────────────────────────────
-
#[cfg(test)]
mod tests {
use super::*;
@@ -805,8 +777,6 @@ mod tests {
}
}
- // ── depends tests ─────────────────────────────────────────────────────────
-
#[test]
fn test_forward_dependency() {
// root requires A, A requires B → depends B returns A (and root not A)
@@ -872,8 +842,6 @@ mod tests {
assert!(!results.is_empty());
}
- // ── prohibits tests ───────────────────────────────────────────────────────
-
#[test]
fn test_prohibits_basic() {
// root requires A ^1.0; user asks "who prohibits A 2.0"
@@ -939,8 +907,6 @@ mod tests {
);
}
- // ── print helpers (smoke tests) ───────────────────────────────────────────
-
#[test]
fn test_print_table_empty() {
let console = mozart_core::console::Console::new(0, false, false, false, false);
diff --git a/crates/mozart/src/commands/diagnose.rs b/crates/mozart/src/commands/diagnose.rs
index 382b8ae..4c8d126 100644
--- a/crates/mozart/src/commands/diagnose.rs
+++ b/crates/mozart/src/commands/diagnose.rs
@@ -7,8 +7,6 @@ use std::path::{Path, PathBuf};
#[derive(Args)]
pub struct DiagnoseArgs {}
-// ─── Check result ─────────────────────────────────────────────────────────────
-
enum CheckResult {
/// OK, with optional detail string.
Ok(Option<String>),
@@ -22,8 +20,6 @@ enum CheckResult {
Info(String),
}
-// ─── Output helpers ───────────────────────────────────────────────────────────
-
/// Print "Checking {label}: OK/WARNING/FAIL/SKIP" and ratchet exit_code.
///
/// Exit code ratchet: Warning → 1 (if currently 0), Fail → 2 (always overrides 1).
@@ -77,8 +73,6 @@ fn print_info_line(result: &CheckResult, console: &Console) {
}
}
-// ─── Individual checks ────────────────────────────────────────────────────────
-
/// Check 1: Mozart version info (informational).
fn check_version() -> CheckResult {
CheckResult::Info(format!("Mozart version {MOZART_VERSION}"))
@@ -393,8 +387,6 @@ fn check_cache_dir(cache_dir: &Path) -> CheckResult {
}
}
-// ─── Main execute function ─────────────────────────────────────────────────────
-
pub async fn execute(
_args: &DiagnoseArgs,
cli: &super::Cli,
@@ -519,16 +511,12 @@ pub async fn execute(
Ok(())
}
-// ─── Tests ────────────────────────────────────────────────────────────────────
-
#[cfg(test)]
mod tests {
use super::*;
use std::fs;
use tempfile::tempdir;
- // ── test_parse_git_version ────────────────────────────────────────────────
-
#[test]
fn test_parse_git_version() {
assert_eq!(parse_git_version("git version 2.39.1"), Some((2, 39, 1)));
@@ -545,8 +533,6 @@ mod tests {
assert_eq!(parse_git_version("3.0.0"), Some((3, 0, 0)));
}
- // ── test_check_composer_json_valid ────────────────────────────────────────
-
#[test]
fn test_check_composer_json_valid() {
let dir = tempdir().unwrap();
@@ -563,8 +549,6 @@ mod tests {
);
}
- // ── test_check_composer_json_missing ─────────────────────────────────────
-
#[test]
fn test_check_composer_json_missing() {
let dir = tempdir().unwrap();
@@ -577,8 +561,6 @@ mod tests {
);
}
- // ── test_check_composer_json_invalid_json ─────────────────────────────────
-
#[test]
fn test_check_composer_json_invalid_json() {
let dir = tempdir().unwrap();
@@ -591,8 +573,6 @@ mod tests {
);
}
- // ── test_check_composer_lock_fresh ────────────────────────────────────────
-
#[test]
fn test_check_composer_lock_fresh() {
use mozart_registry::lockfile::LockFile;
@@ -627,8 +607,6 @@ mod tests {
);
}
- // ── test_check_composer_lock_stale ────────────────────────────────────────
-
#[test]
fn test_check_composer_lock_stale() {
use mozart_registry::lockfile::LockFile;
@@ -663,8 +641,6 @@ mod tests {
);
}
- // ── test_check_composer_lock_missing ─────────────────────────────────────
-
#[test]
fn test_check_composer_lock_missing() {
let dir = tempdir().unwrap();
@@ -677,8 +653,6 @@ mod tests {
);
}
- // ── test_check_disk_space_ok ──────────────────────────────────────────────
-
#[test]
fn test_check_disk_space_ok() {
let dir = tempdir().unwrap();
@@ -691,8 +665,6 @@ mod tests {
);
}
- // ── test_check_result_exit_code_ratcheting ────────────────────────────────
-
#[test]
fn test_check_result_exit_code_ratcheting() {
let console = Console::new(0, false, false, false, false);
@@ -734,8 +706,6 @@ mod tests {
assert_eq!(exit_code, 2);
}
- // ── test_check_http_proxy_none_set ───────────────────────────────────────
-
#[test]
fn test_check_http_proxy_none_set() {
// Remove all proxy vars for this test
@@ -769,8 +739,6 @@ mod tests {
}
}
- // ── network tests (ignored by default) ───────────────────────────────────
-
#[tokio::test]
#[ignore]
async fn test_check_https_packagist_connectivity() {
diff --git a/crates/mozart/src/commands/exec.rs b/crates/mozart/src/commands/exec.rs
index 9555601..f802721 100644
--- a/crates/mozart/src/commands/exec.rs
+++ b/crates/mozart/src/commands/exec.rs
@@ -17,8 +17,6 @@ pub struct ExecArgs {
pub list: bool,
}
-// ─── Main entry point ────────────────────────────────────────────────────────
-
pub async fn execute(
args: &ExecArgs,
cli: &super::Cli,
@@ -117,8 +115,6 @@ pub async fn execute(
Ok(())
}
-// ─── Helpers ──────────────────────────────────────────────────────────────────
-
fn resolve_bin_dir(working_dir: &Path, composer: &Composer) -> PathBuf {
// bin-dir's `{$vendor-dir}` placeholder is already resolved by Composer::load.
let bin_dir = composer
@@ -187,15 +183,11 @@ fn get_binaries(working_dir: &Path, bin_dir: &Path) -> Vec<(String, bool)> {
binaries
}
-// ─── Tests ───────────────────────────────────────────────────────────────────
-
#[cfg(test)]
mod tests {
use super::*;
use std::fs;
- // ── resolve_bin_dir ───────────────────────────────────────────────────────
-
#[test]
fn test_resolve_bin_dir_default() {
let dir = tempfile::tempdir().unwrap();
@@ -252,8 +244,6 @@ mod tests {
assert_eq!(result, dir.path().join("packages/commands"));
}
- // ── get_binaries ──────────────────────────────────────────────────────────
-
#[test]
fn test_get_binaries_from_bin_dir() {
let dir = tempfile::tempdir().unwrap();
diff --git a/crates/mozart/src/commands/fund.rs b/crates/mozart/src/commands/fund.rs
index bebf8c2..812b17d 100644
--- a/crates/mozart/src/commands/fund.rs
+++ b/crates/mozart/src/commands/fund.rs
@@ -12,8 +12,6 @@ pub struct FundArgs {
pub format: Option<String>,
}
-// ─── Data structures ────────────────────────────────────────────────────────
-
struct FundingLink {
url: String,
funding_type: Option<String>,
@@ -24,8 +22,6 @@ struct FundingEntry {
links: Vec<FundingLink>,
}
-// ─── Main entry point ───────────────────────────────────────────────────────
-
pub async fn execute(
args: &FundArgs,
cli: &super::Cli,
@@ -60,8 +56,6 @@ pub async fn execute(
Ok(())
}
-// ─── Package loading ─────────────────────────────────────────────────────────
-
fn collect_funding_from_locked(working_dir: &Path) -> anyhow::Result<Vec<FundingEntry>> {
let lock_path = working_dir.join("composer.lock");
let lock = mozart_registry::lockfile::LockFile::read_from_file(&lock_path)?;
@@ -120,8 +114,6 @@ fn collect_funding_from_installed(working_dir: &Path) -> anyhow::Result<Vec<Fund
Ok(entries)
}
-// ─── Funding helpers ──────────────────────────────────────────────────────────
-
fn extract_funding_links(funding_json: &[serde_json::Value]) -> Vec<FundingLink> {
funding_json
.iter()
@@ -180,8 +172,6 @@ fn group_by_vendor(entries: &[FundingEntry]) -> BTreeMap<String, BTreeMap<String
grouped
}
-// ─── Rendering ───────────────────────────────────────────────────────────────
-
fn render_text(
grouped: &BTreeMap<String, BTreeMap<String, Vec<String>>>,
console: &console::Console,
@@ -245,14 +235,10 @@ fn render_json(
Ok(())
}
-// ─── Tests ───────────────────────────────────────────────────────────────────
-
#[cfg(test)]
mod tests {
use super::*;
- // ── Helper ────────────────────────────────────────────────────────────────
-
fn make_funding_json(entries: &[(&str, &str)]) -> Vec<serde_json::Value> {
entries
.iter()
@@ -260,8 +246,6 @@ mod tests {
.collect()
}
- // ── extract_funding_links ─────────────────────────────────────────────────
-
#[test]
fn test_extract_funding_links_basic() {
let json = make_funding_json(&[("github", "https://github.com/Seldaek")]);
@@ -290,8 +274,6 @@ mod tests {
assert!(links.is_empty());
}
- // ── rewrite_github_url ────────────────────────────────────────────────────
-
#[test]
fn test_rewrite_github_url_profile() {
let result = rewrite_github_url("https://github.com/Seldaek", Some("github"));
@@ -318,8 +300,6 @@ mod tests {
assert_eq!(result, "https://github.com/user/repo");
}
- // ── group_by_vendor ───────────────────────────────────────────────────────
-
#[test]
fn test_group_by_vendor_basic() {
let entries = vec![
@@ -382,8 +362,6 @@ mod tests {
assert!(grouped.is_empty());
}
- // ── Integration tests ─────────────────────────────────────────────────────
-
#[test]
fn test_fund_from_lockfile() {
use mozart_registry::lockfile::{LockFile, LockedPackage};
diff --git a/crates/mozart/src/commands/global.rs b/crates/mozart/src/commands/global.rs
index 12b3a4e..1a8a5f8 100644
--- a/crates/mozart/src/commands/global.rs
+++ b/crates/mozart/src/commands/global.rs
@@ -10,8 +10,6 @@ pub struct GlobalArgs {
pub args: Vec<String>,
}
-// ─── Main entry point ────────────────────────────────────────────────────────
-
pub async fn execute(
args: &GlobalArgs,
cli: &super::Cli,
@@ -51,8 +49,6 @@ pub async fn execute(
Box::pin(crate::commands::execute(&new_cli)).await
}
-// ─── Helpers ─────────────────────────────────────────────────────────────────
-
fn append_global_options(cli: &super::Cli) -> Vec<String> {
let mut opts: Vec<String> = Vec::new();
@@ -95,8 +91,6 @@ fn append_global_options(cli: &super::Cli) -> Vec<String> {
opts
}
-// ─── Tests ────────────────────────────────────────────────────────────────────
-
#[cfg(test)]
mod tests {
use super::*;
@@ -107,8 +101,6 @@ mod tests {
Cli::try_parse_from(["mozart", "about"]).unwrap()
}
- // ── append_global_options tests ───────────────────────────────────────────
-
#[test]
fn test_append_global_options_empty() {
let cli = default_cli();
diff --git a/crates/mozart/src/commands/licenses.rs b/crates/mozart/src/commands/licenses.rs
index 595cf43..5c131b4 100644
--- a/crates/mozart/src/commands/licenses.rs
+++ b/crates/mozart/src/commands/licenses.rs
@@ -19,16 +19,12 @@ pub struct LicensesArgs {
pub locked: bool,
}
-// ─── Data structures ────────────────────────────────────────────────────────
-
struct LicenseEntry {
name: String,
version: String,
licenses: Vec<String>,
}
-// ─── Main entry point ───────────────────────────────────────────────────────
-
pub async fn execute(
args: &LicensesArgs,
cli: &super::Cli,
@@ -93,8 +89,6 @@ pub async fn execute(
Ok(())
}
-// ─── Package loading ─────────────────────────────────────────────────────────
-
fn load_installed_licenses(working_dir: &Path, no_dev: bool) -> anyhow::Result<Vec<LicenseEntry>> {
let vendor_dir = working_dir.join("vendor");
let installed = mozart_registry::installed::InstalledPackages::read(&vendor_dir)?;
@@ -155,8 +149,6 @@ fn load_locked_licenses(working_dir: &Path, no_dev: bool) -> anyhow::Result<Vec<
Ok(entries)
}
-// ─── License extraction ───────────────────────────────────────────────────────
-
fn extract_installed_licenses(
pkg: &mozart_registry::installed::InstalledPackageEntry,
) -> Vec<String> {
@@ -172,8 +164,6 @@ fn extract_installed_licenses(
.unwrap_or_default()
}
-// ─── License counting ─────────────────────────────────────────────────────────
-
fn count_licenses(entries: &[LicenseEntry]) -> Vec<(String, usize)> {
let mut counts: std::collections::BTreeMap<String, usize> = std::collections::BTreeMap::new();
@@ -193,8 +183,6 @@ fn count_licenses(entries: &[LicenseEntry]) -> Vec<(String, usize)> {
result
}
-// ─── Rendering ───────────────────────────────────────────────────────────────
-
fn render_text(
root_name: &str,
root_version: &str,
@@ -378,8 +366,6 @@ fn render_summary(entries: &[LicenseEntry], console: &Console) {
);
}
-// ─── Tests ───────────────────────────────────────────────────────────────────
-
#[cfg(test)]
mod tests {
use super::*;
@@ -404,8 +390,6 @@ mod tests {
}
}
- // ── extract_installed_licenses ────────────────────────────────────────────
-
#[test]
fn test_extract_installed_licenses_present() {
let mut extra = BTreeMap::new();
@@ -440,8 +424,6 @@ mod tests {
assert!(extract_installed_licenses(&pkg).is_empty());
}
- // ── count_licenses ────────────────────────────────────────────────────────
-
#[test]
fn test_count_licenses() {
let entries = vec![
@@ -488,8 +470,6 @@ mod tests {
assert_eq!(counts[0], ("none".to_string(), 1));
}
- // ── Integration tests ─────────────────────────────────────────────────────
-
#[test]
fn test_load_installed_licenses_basic() {
use tempfile::tempdir;
@@ -685,8 +665,6 @@ mod tests {
assert_eq!(entries_all.len(), 2);
}
- // ── Root license parsing ──────────────────────────────────────────────────
-
#[test]
fn test_root_license_array_in_json() {
use tempfile::tempdir;
diff --git a/crates/mozart/src/commands/outdated.rs b/crates/mozart/src/commands/outdated.rs
index 61a1e8b..5f77315 100644
--- a/crates/mozart/src/commands/outdated.rs
+++ b/crates/mozart/src/commands/outdated.rs
@@ -66,8 +66,6 @@ pub struct OutdatedArgs {
pub ignore_platform_reqs: bool,
}
-// ─── Core types ────────────────────────────────────────────────────────────
-
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
enum UpdateCategory {
UpToDate,
@@ -95,8 +93,6 @@ struct OutdatedEntry {
is_direct: bool,
}
-// ─── Main entry point ───────────────────────────────────────────────────────
-
pub async fn execute(
args: &OutdatedArgs,
cli: &super::Cli,
@@ -233,8 +229,6 @@ pub async fn execute(
Ok(())
}
-// ─── Package loading ────────────────────────────────────────────────────────
-
fn load_installed_packages(working_dir: &Path, no_dev: bool) -> anyhow::Result<Vec<PackageInfo>> {
let vendor_dir = working_dir.join("vendor");
let installed = mozart_registry::installed::InstalledPackages::read(&vendor_dir)?;
@@ -321,8 +315,6 @@ fn load_locked_packages(working_dir: &Path, no_dev: bool) -> anyhow::Result<Vec<
Ok(packages)
}
-// ─── Version fetching ────────────────────────────────────────────────────────
-
async fn fetch_latest_version(
name: &str,
repo_cache: &mozart_registry::cache::Cache,
@@ -342,8 +334,6 @@ async fn fetch_latest_version(
})
}
-// ─── Classification ──────────────────────────────────────────────────────────
-
/// Determine the update category for a package.
///
/// Mirrors Composer's logic: constructs `^<installed_version>` and checks if the
@@ -422,8 +412,6 @@ fn extract_patch(version_normalized: &str) -> u64 {
.unwrap_or(0)
}
-// ─── Level filtering ─────────────────────────────────────────────────────────
-
/// Check whether a version change passes the --major-only/--minor-only/--patch-only filter.
///
/// Returns true if the version change matches the requested level.
@@ -449,8 +437,6 @@ fn passes_level_filter(args: &OutdatedArgs, current: &str, latest: &str) -> bool
true
}
-// ─── Rendering ───────────────────────────────────────────────────────────────
-
fn render_text(entries: &[OutdatedEntry], console: &mozart_core::console::Console) {
use mozart_core::console::Verbosity;
@@ -537,8 +523,6 @@ fn render_json(
Ok(())
}
-// ─── Helpers ─────────────────────────────────────────────────────────────────
-
/// Returns true if the given package name is a platform package (php, ext-*, etc.).
fn is_platform_package(name: &str) -> bool {
let lower = name.to_lowercase();
@@ -575,14 +559,10 @@ fn normalize_version_simple(version: &str) -> String {
result
}
-// ─── Tests ───────────────────────────────────────────────────────────────────
-
#[cfg(test)]
mod tests {
use super::*;
- // ── classify_update ──────────────────────────────────────────────────────
-
#[test]
fn test_classify_up_to_date_equal() {
let cat = classify_update("1.2.3.0", "1.2.3.0");
@@ -630,8 +610,6 @@ mod tests {
assert_eq!(cat, UpdateCategory::SemverCompatible);
}
- // ── passes_level_filter ──────────────────────────────────────────────────
-
fn make_args_with_filter(major: bool, minor: bool, patch: bool) -> OutdatedArgs {
OutdatedArgs {
package: None,
@@ -695,8 +673,6 @@ mod tests {
assert!(!passes_level_filter(&args, "1.0.1.0", "1.0.1.0"));
}
- // ── normalize_version_simple ──────────────────────────────────────────────
-
#[test]
fn test_normalize_version_simple_short() {
assert_eq!(normalize_version_simple("1.2"), "1.2.0.0");
@@ -722,8 +698,6 @@ mod tests {
assert_eq!(normalize_version_simple("1.2.3-beta1"), "1.2.3.0-beta1");
}
- // ── extract_major/minor/patch ─────────────────────────────────────────────
-
#[test]
fn test_extract_major() {
assert_eq!(extract_major("2.3.4.0"), 2);
@@ -743,8 +717,6 @@ mod tests {
assert_eq!(extract_patch("1.2.0.0"), 0);
}
- // ── is_platform_package ───────────────────────────────────────────────────
-
#[test]
fn test_is_platform_package() {
assert!(is_platform_package("php"));
@@ -755,8 +727,6 @@ mod tests {
assert!(!is_platform_package("psr/log"));
}
- // ── render_json (smoke test with no network) ──────────────────────────────
-
fn test_console() -> mozart_core::console::Console {
mozart_core::console::Console {
interactive: false,
diff --git a/crates/mozart/src/commands/reinstall.rs b/crates/mozart/src/commands/reinstall.rs
index e959486..7e426f8 100644
--- a/crates/mozart/src/commands/reinstall.rs
+++ b/crates/mozart/src/commands/reinstall.rs
@@ -64,8 +64,6 @@ pub struct ReinstallArgs {
pub r#type: Vec<String>,
}
-// ─── Main entry point ─────────────────────────────────────────────────────────
-
pub async fn execute(
args: &ReinstallArgs,
cli: &super::Cli,
@@ -306,8 +304,6 @@ pub async fn execute(
Ok(())
}
-// ─── Helpers ──────────────────────────────────────────────────────────────────
-
/// Filter candidates by package type (case-insensitive).
fn filter_by_type<'a>(
candidates: &[&'a mozart_registry::installed::InstalledPackageEntry],
@@ -402,15 +398,11 @@ fn find_locked_package<'a>(
.copied()
}
-// ─── Tests ───────────────────────────────────────────────────────────────────
-
#[cfg(test)]
mod tests {
use super::*;
use std::collections::BTreeMap;
- // ── Helper constructors ───────────────────────────────────────────────────
-
fn make_installed_entry(
name: &str,
pkg_type: Option<&str>,
@@ -457,8 +449,6 @@ mod tests {
}
}
- // ── glob_matches ──────────────────────────────────────────────────────────
-
#[test]
fn test_glob_exact_match() {
assert!(glob_matches("monolog/monolog", "monolog/monolog"));
@@ -500,8 +490,6 @@ mod tests {
assert!(glob_matches("monolog/monolog", "monolog/monolog"));
}
- // ── find_locked_package ───────────────────────────────────────────────────
-
#[test]
fn test_find_locked_package_found() {
let pkgs = [
@@ -533,8 +521,6 @@ mod tests {
assert!(result.is_none());
}
- // ── filter_by_type ────────────────────────────────────────────────────────
-
#[test]
fn test_filter_by_type_library() {
let e1 = make_installed_entry("psr/log", Some("library"));
@@ -581,8 +567,6 @@ mod tests {
assert_eq!(result.len(), 2);
}
- // ── filter_by_names ───────────────────────────────────────────────────────
-
#[test]
fn test_filter_by_names_exact() {
let e1 = make_installed_entry("psr/log", Some("library"));
@@ -625,8 +609,6 @@ mod tests {
assert!(result.is_empty());
}
- // ── mutual exclusion validation ───────────────────────────────────────────
-
/// Verify that the validation logic (both --type and names) is reflected in arg combinations.
/// We can't call execute() without a full environment, but we can test the logic directly.
#[test]
@@ -649,8 +631,6 @@ mod tests {
);
}
- // ── dev filtering ─────────────────────────────────────────────────────────
-
#[test]
fn test_dev_filtering_excludes_dev_packages() {
let e1 = make_installed_entry("psr/log", Some("library"));
diff --git a/crates/mozart/src/commands/remove.rs b/crates/mozart/src/commands/remove.rs
index a25d557..ff3df47 100644
--- a/crates/mozart/src/commands/remove.rs
+++ b/crates/mozart/src/commands/remove.rs
@@ -675,8 +675,6 @@ mod tests {
use mozart_registry::lockfile;
use std::collections::BTreeMap;
- // ──────────── Helper constructors ────────────
-
fn make_locked_package(name: &str, version: &str) -> lockfile::LockedPackage {
lockfile::LockedPackage {
name: name.to_string(),
@@ -726,8 +724,6 @@ mod tests {
RawPackageData::new(name.to_string())
}
- // ──────────── Unit tests ────────────
-
/// Remove a package from `require`, verify it's gone from `RawPackageData`.
#[test]
fn test_remove_from_require() {
@@ -875,8 +871,6 @@ mod tests {
);
}
- // ──────────── Integration tests (network, #[ignore]) ────────────
-
#[tokio::test]
#[ignore]
async fn test_remove_full_e2e() {
diff --git a/crates/mozart/src/commands/repository.rs b/crates/mozart/src/commands/repository.rs
index 7b5b7a3..5bb3db7 100644
--- a/crates/mozart/src/commands/repository.rs
+++ b/crates/mozart/src/commands/repository.rs
@@ -76,8 +76,6 @@ pub async fn execute(
}
}
-// ─── list ─────────────────────────────────────────────────────────────────────
-
fn execute_list(
args: &RepositoryArgs,
cli: &super::Cli,
@@ -130,8 +128,6 @@ fn execute_list(
Ok(())
}
-// ─── add ──────────────────────────────────────────────────────────────────────
-
fn execute_add(args: &RepositoryArgs, cli: &super::Cli) -> anyhow::Result<()> {
let name = args
.name
@@ -192,8 +188,6 @@ fn execute_add(args: &RepositoryArgs, cli: &super::Cli) -> anyhow::Result<()> {
Ok(())
}
-// ─── remove ───────────────────────────────────────────────────────────────────
-
fn execute_remove(args: &RepositoryArgs, cli: &super::Cli) -> anyhow::Result<()> {
let name = args
.name
@@ -228,8 +222,6 @@ fn execute_remove(args: &RepositoryArgs, cli: &super::Cli) -> anyhow::Result<()>
Ok(())
}
-// ─── set-url ──────────────────────────────────────────────────────────────────
-
fn execute_set_url(args: &RepositoryArgs, cli: &super::Cli) -> anyhow::Result<()> {
let name = args
.name
@@ -261,8 +253,6 @@ fn execute_set_url(args: &RepositoryArgs, cli: &super::Cli) -> anyhow::Result<()
}
}
-// ─── get-url ──────────────────────────────────────────────────────────────────
-
fn execute_get_url(
args: &RepositoryArgs,
cli: &super::Cli,
@@ -296,8 +286,6 @@ fn execute_get_url(
}
}
-// ─── disable ──────────────────────────────────────────────────────────────────
-
fn execute_disable(args: &RepositoryArgs, cli: &super::Cli) -> anyhow::Result<()> {
let name = args.name.as_deref().unwrap_or("packagist.org");
@@ -318,8 +306,6 @@ fn execute_disable(args: &RepositoryArgs, cli: &super::Cli) -> anyhow::Result<()
Ok(())
}
-// ─── enable ───────────────────────────────────────────────────────────────────
-
fn execute_enable(args: &RepositoryArgs, cli: &super::Cli) -> anyhow::Result<()> {
let name = args.name.as_deref().unwrap_or("packagist.org");
@@ -346,8 +332,6 @@ fn execute_enable(args: &RepositoryArgs, cli: &super::Cli) -> anyhow::Result<()>
Ok(())
}
-// ─── Tests ────────────────────────────────────────────────────────────────────
-
#[cfg(test)]
mod tests {
use super::*;
@@ -376,8 +360,6 @@ mod tests {
super::super::Cli::parse_from(["mozart", "repository", "list"])
}
- // ── list ────────────────────────────────────────────────────────────────
-
#[tokio::test]
async fn test_list_empty() {
let dir = tempfile::TempDir::new().unwrap();
@@ -427,8 +409,6 @@ mod tests {
assert!(result.is_ok());
}
- // ── add ─────────────────────────────────────────────────────────────────
-
#[tokio::test]
async fn test_add_type_url() {
let dir = tempfile::TempDir::new().unwrap();
@@ -650,8 +630,6 @@ mod tests {
assert!(result.is_err());
}
- // ── remove ──────────────────────────────────────────────────────────────
-
#[tokio::test]
async fn test_remove() {
let dir = tempfile::TempDir::new().unwrap();
@@ -728,8 +706,6 @@ mod tests {
assert!(result.is_err());
}
- // ── set-url ─────────────────────────────────────────────────────────────
-
#[tokio::test]
async fn test_set_url() {
let dir = tempfile::TempDir::new().unwrap();
@@ -804,8 +780,6 @@ mod tests {
assert_eq!(json["repositories"][0]["url"], "https://new.com");
}
- // ── get-url ─────────────────────────────────────────────────────────────
-
#[tokio::test]
async fn test_get_url() {
let dir = tempfile::TempDir::new().unwrap();
@@ -839,8 +813,6 @@ mod tests {
assert!(result.is_err());
}
- // ── disable ─────────────────────────────────────────────────────────────
-
#[tokio::test]
async fn test_disable_packagist() {
let dir = tempfile::TempDir::new().unwrap();
@@ -894,8 +866,6 @@ mod tests {
assert!(result.is_err());
}
- // ── enable ──────────────────────────────────────────────────────────────
-
#[tokio::test]
async fn test_enable_packagist() {
let dir = tempfile::TempDir::new().unwrap();
@@ -929,8 +899,6 @@ mod tests {
assert!(result.is_err());
}
- // ── Composer associative-key format ─────────────────────────────────────
-
#[tokio::test]
async fn test_list_composer_format() {
let dir = tempfile::TempDir::new().unwrap();
@@ -1062,8 +1030,6 @@ mod tests {
assert!(json.get("repositories").is_none());
}
- // ── normalize_repositories helper ────────────────────────────────────────
-
#[test]
fn test_normalize_repositories_array_passthrough() {
use super::super::config_helpers::normalize_repositories;
@@ -1109,8 +1075,6 @@ mod tests {
assert!(result.is_empty());
}
- // ── unknown action ──────────────────────────────────────────────────────
-
#[tokio::test]
async fn test_unknown_action() {
let dir = tempfile::TempDir::new().unwrap();
@@ -1126,8 +1090,6 @@ mod tests {
assert!(result.is_err());
}
- // ── insert_repository helper ────────────────────────────────────────────
-
#[test]
fn test_insert_before() {
let mut json = serde_json::json!({
diff --git a/crates/mozart/src/commands/require.rs b/crates/mozart/src/commands/require.rs
index 08ee6ea..828474d 100644
--- a/crates/mozart/src/commands/require.rs
+++ b/crates/mozart/src/commands/require.rs
@@ -1035,10 +1035,6 @@ mod tests {
// The real behavior is tested via integration tests (marked #[ignore]).
}
- // ─────────────────────────────────────────────────────────────────────────
- // Integration tests (network, #[ignore])
- // ─────────────────────────────────────────────────────────────────────────
-
#[tokio::test]
#[ignore]
async fn test_require_full_e2e() {
diff --git a/crates/mozart/src/commands/run_script.rs b/crates/mozart/src/commands/run_script.rs
index ab07b84..4292809 100644
--- a/crates/mozart/src/commands/run_script.rs
+++ b/crates/mozart/src/commands/run_script.rs
@@ -29,8 +29,6 @@ pub struct RunScriptArgs {
pub list: bool,
}
-// ─── Constants ────────────────────────────────────────────────────────────────
-
const ALLOWED_SCRIPT_EVENTS: &[&str] = &[
"pre-install-cmd",
"post-install-cmd",
@@ -72,8 +70,6 @@ const ALL_SCRIPT_EVENTS: &[&str] = &[
"pre-file-download",
];
-// ─── Main entry point ────────────────────────────────────────────────────────
-
pub async fn execute(
args: &RunScriptArgs,
cli: &super::Cli,
@@ -152,8 +148,6 @@ pub async fn execute(
Ok(())
}
-// ─── Script loading ───────────────────────────────────────────────────────────
-
#[allow(clippy::type_complexity)]
fn load_scripts(
working_dir: &Path,
@@ -197,8 +191,6 @@ fn load_scripts(
Ok((scripts, descriptions))
}
-// ─── List scripts ─────────────────────────────────────────────────────────────
-
fn list_scripts(
scripts: &BTreeMap<String, Vec<String>>,
descriptions: &BTreeMap<String, String>,
@@ -214,8 +206,6 @@ fn list_scripts(
Ok(())
}
-// ─── Script execution ─────────────────────────────────────────────────────────
-
#[allow(clippy::too_many_arguments)]
fn run_script(
script_name: &str,
@@ -453,8 +443,6 @@ fn wait_with_timeout(
}
}
-// ─── Bin dir resolution ───────────────────────────────────────────────────────
-
fn resolve_bin_dir(working_dir: &Path, composer: &mozart_core::composer::Composer) -> PathBuf {
// bin-dir's `{$vendor-dir}` placeholder is already resolved by Composer::load.
let bin_dir = composer
@@ -465,8 +453,6 @@ fn resolve_bin_dir(working_dir: &Path, composer: &mozart_core::composer::Compose
working_dir.join(bin_dir)
}
-// ─── Classifier functions ─────────────────────────────────────────────────────
-
fn is_php_callback(entry: &str) -> bool {
let trimmed = entry.trim();
if trimmed.contains(' ') {
@@ -500,8 +486,6 @@ fn is_putenv(entry: &str) -> bool {
entry.starts_with("@putenv ")
}
-// ─── Tests ───────────────────────────────────────────────────────────────────
-
#[cfg(test)]
mod tests {
use super::*;
@@ -515,8 +499,6 @@ mod tests {
}
}
- // ── Classifier tests ──────────────────────────────────────────────────────
-
#[test]
fn test_is_php_callback_static_method() {
assert!(is_php_callback("MyClass::myMethod"));
@@ -566,8 +548,6 @@ mod tests {
assert!(is_composer_prefix("@composer install"));
}
- // ── load_scripts tests ────────────────────────────────────────────────────
-
#[test]
fn test_load_scripts_array_form() {
let dir = tempfile::tempdir().unwrap();
@@ -641,8 +621,6 @@ mod tests {
assert_eq!(post_entries.len(), 2);
}
- // ── list_scripts tests ────────────────────────────────────────────────────
-
#[test]
fn test_list_scripts_output() {
let mut scripts = BTreeMap::new();
@@ -657,8 +635,6 @@ mod tests {
assert!(result.is_ok());
}
- // ── run_shell_command tests ───────────────────────────────────────────────
-
#[test]
fn test_run_shell_command_success() {
let dir = tempfile::tempdir().unwrap();
diff --git a/crates/mozart/src/commands/search.rs b/crates/mozart/src/commands/search.rs
index 023bfdf..2ee84de 100644
--- a/crates/mozart/src/commands/search.rs
+++ b/crates/mozart/src/commands/search.rs
@@ -221,14 +221,10 @@ pub async fn execute(
Ok(())
}
-// ─── Tests ──────────────────────────────────────────────────────────────────
-
#[cfg(test)]
mod tests {
use super::*;
- // ── format_count ────────────────────────────────────────────────────────
-
#[test]
fn test_format_count_small() {
assert_eq!(format_count(0), "0");
@@ -251,8 +247,6 @@ mod tests {
assert_eq!(format_count(2_500_000), "2.5M");
}
- // ── SearchResponse parsing ───────────────────────────────────────────────
-
#[test]
fn test_parse_search_response() {
use mozart_registry::packagist::SearchResponse;
@@ -360,8 +354,6 @@ mod tests {
);
}
- // ── only_name filter ─────────────────────────────────────────────────────
-
#[test]
fn test_passes_only_name_match() {
let result = make_result("monolog/monolog");
@@ -392,8 +384,6 @@ mod tests {
assert!(passes_only_name(&result, "monolog"));
}
- // ── only_vendor filter ───────────────────────────────────────────────────
-
#[test]
fn test_passes_only_vendor_match() {
let result = make_result("monolog/monolog");
@@ -420,8 +410,6 @@ mod tests {
assert!(!passes_only_vendor(&result, "mono"));
}
- // ── is_abandoned ─────────────────────────────────────────────────────────
-
#[test]
fn test_is_abandoned_none() {
let result = make_result("vendor/pkg");
@@ -456,8 +444,6 @@ mod tests {
assert!(!is_abandoned(&result));
}
- // ── serialization ────────────────────────────────────────────────────────
-
#[test]
fn test_search_result_output_matches_composer_schema() {
let result = SearchResult {
@@ -504,8 +490,6 @@ mod tests {
assert_eq!(parsed["abandoned"], "new/pkg");
}
- // ── only_vendor deduplication ───────────────────────────────────────────
-
#[test]
fn test_only_vendor_deduplicates_vendor_names() {
let results = [
@@ -527,8 +511,6 @@ mod tests {
assert_eq!(vendor_names, vec!["monolog"]);
}
- // ── helper ───────────────────────────────────────────────────────────────
-
fn make_result(name: &str) -> SearchResult {
SearchResult {
name: name.to_string(),
diff --git a/crates/mozart/src/commands/self_update.rs b/crates/mozart/src/commands/self_update.rs
index 401d15a..4037355 100644
--- a/crates/mozart/src/commands/self_update.rs
+++ b/crates/mozart/src/commands/self_update.rs
@@ -5,8 +5,6 @@ use mozart_core::console_format;
use std::io::Write;
use std::path::{Path, PathBuf};
-// ─── CLI args ─────────────────────────────────────────────────────────────────
-
#[derive(Args)]
pub struct SelfUpdateArgs {
/// Version to update to (e.g., "0.2.0"). Defaults to latest.
@@ -29,8 +27,6 @@ pub struct SelfUpdateArgs {
pub no_progress: bool,
}
-// ─── GitHub API types ─────────────────────────────────────────────────────────
-
#[derive(Debug, serde::Deserialize)]
struct GitHubRelease {
tag_name: String,
@@ -45,14 +41,10 @@ struct GitHubAsset {
size: u64,
}
-// ─── Constants ────────────────────────────────────────────────────────────────
-
const GITHUB_REPO: &str = "kenpfowler/mozart";
const GITHUB_API_BASE: &str = "https://api.github.com/repos";
const BACKUP_EXTENSION: &str = ".old";
-// ─── Public entry point ───────────────────────────────────────────────────────
-
pub async fn execute(
args: &SelfUpdateArgs,
_cli: &super::Cli,
@@ -76,8 +68,6 @@ pub async fn execute(
}
}
-// ─── Data directory ───────────────────────────────────────────────────────────
-
fn get_data_dir() -> anyhow::Result<PathBuf> {
if let Ok(dir) = std::env::var("MOZART_DATA_DIR") {
return Ok(PathBuf::from(dir));
@@ -123,14 +113,10 @@ fn platform_asset_name() -> anyhow::Result<String> {
}
}
-// ─── Channel helper ───────────────────────────────────────────────────────────
-
fn effective_channel(preview: bool) -> &'static str {
if preview { "preview" } else { "stable" }
}
-// ─── Backup version helper ────────────────────────────────────────────────────
-
fn version_from_backup(path: &Path) -> String {
path.file_name()
.and_then(|n| n.to_str())
@@ -140,8 +126,6 @@ fn version_from_backup(path: &Path) -> String {
.to_string()
}
-// ─── GitHub fetching ──────────────────────────────────────────────────────────
-
async fn fetch_releases(include_prerelease: bool) -> anyhow::Result<Vec<GitHubRelease>> {
let url = format!("{GITHUB_API_BASE}/{GITHUB_REPO}/releases");
@@ -216,8 +200,6 @@ fn find_asset<'a>(release: &'a GitHubRelease, asset_name: &str) -> anyhow::Resul
})
}
-// ─── Download ─────────────────────────────────────────────────────────────────
-
async fn download_asset(
asset: &GitHubAsset,
dest: &Path,
@@ -273,8 +255,6 @@ async fn download_asset(
Ok(())
}
-// ─── Core update flow ─────────────────────────────────────────────────────────
-
async fn update(
args: &SelfUpdateArgs,
current_exe: &Path,
@@ -388,8 +368,6 @@ async fn update(
Ok(())
}
-// ─── Rollback ─────────────────────────────────────────────────────────────────
-
fn rollback(
current_exe: &Path,
data_dir: &Path,
@@ -483,8 +461,6 @@ fn clean_backups(data_dir: &Path, except: Option<&Path>) -> anyhow::Result<()> {
Ok(())
}
-// ─── Tests ────────────────────────────────────────────────────────────────────
-
#[cfg(test)]
mod tests {
use super::*;
@@ -507,8 +483,6 @@ mod tests {
}
}
- // ── test_platform_asset_name ──────────────────────────────────────────────
-
#[test]
fn test_platform_asset_name() {
let name = platform_asset_name().expect("platform_asset_name should succeed");
@@ -528,8 +502,6 @@ mod tests {
);
}
- // ── test_find_target_release_latest ───────────────────────────────────────
-
#[test]
fn test_find_target_release_latest() {
let releases = vec![
@@ -542,8 +514,6 @@ mod tests {
assert_eq!(result.tag_name, "v0.3.0");
}
- // ── test_find_target_release_specific_version ─────────────────────────────
-
#[test]
fn test_find_target_release_specific_version() {
let releases = vec![
@@ -561,8 +531,6 @@ mod tests {
assert_eq!(result_v.tag_name, "v0.1.0");
}
- // ── test_find_target_release_not_found ────────────────────────────────────
-
#[test]
fn test_find_target_release_not_found() {
let releases = vec![
@@ -579,8 +547,6 @@ mod tests {
);
}
- // ── test_find_target_release_empty ────────────────────────────────────────
-
#[test]
fn test_find_target_release_empty() {
let releases: Vec<GitHubRelease> = vec![];
@@ -592,8 +558,6 @@ mod tests {
);
}
- // ── test_find_asset_found ─────────────────────────────────────────────────
-
#[test]
fn test_find_asset_found() {
let asset = make_asset(
@@ -620,8 +584,6 @@ mod tests {
);
}
- // ── test_find_asset_not_found ─────────────────────────────────────────────
-
#[test]
fn test_find_asset_not_found() {
let release = make_release(
@@ -642,8 +604,6 @@ mod tests {
);
}
- // ── test_get_data_dir_from_env ────────────────────────────────────────────
-
#[test]
fn test_get_data_dir_from_env() {
let dir = tempdir().unwrap();
@@ -658,8 +618,6 @@ mod tests {
unsafe { std::env::remove_var("MOZART_DATA_DIR") };
}
- // ── test_get_data_dir_default ─────────────────────────────────────────────
-
#[test]
fn test_get_data_dir_default() {
// Ensure MOZART_DATA_DIR is not set
@@ -673,8 +631,6 @@ mod tests {
);
}
- // ── test_find_latest_backup ───────────────────────────────────────────────
-
#[test]
fn test_find_latest_backup() {
let dir = tempdir().unwrap();
@@ -691,8 +647,6 @@ mod tests {
assert_eq!(found, new_backup);
}
- // ── test_find_latest_backup_empty ─────────────────────────────────────────
-
#[test]
fn test_find_latest_backup_empty() {
let dir = tempdir().unwrap();
@@ -701,8 +655,6 @@ mod tests {
assert!(result.is_err(), "should return error when no backups found");
}
- // ── test_clean_backups ────────────────────────────────────────────────────
-
#[test]
fn test_clean_backups() {
let dir = tempdir().unwrap();
@@ -722,8 +674,6 @@ mod tests {
assert!(keep.exists(), "non-backup file should remain");
}
- // ── test_clean_backups_with_except ────────────────────────────────────────
-
#[test]
fn test_clean_backups_with_except() {
let dir = tempdir().unwrap();
@@ -740,16 +690,12 @@ mod tests {
assert!(backup2.exists(), "backup2 should be preserved (excepted)");
}
- // ── test_effective_channel ────────────────────────────────────────────────
-
#[test]
fn test_effective_channel() {
assert_eq!(effective_channel(false), "stable");
assert_eq!(effective_channel(true), "preview");
}
- // ── test_version_from_backup ──────────────────────────────────────────────
-
#[test]
fn test_version_from_backup() {
let path = PathBuf::from("/some/dir/mozart-0.3.1.old");
diff --git a/crates/mozart/src/commands/show.rs b/crates/mozart/src/commands/show.rs
index 6c72540..c07ffb1 100644
--- a/crates/mozart/src/commands/show.rs
+++ b/crates/mozart/src/commands/show.rs
@@ -197,8 +197,6 @@ pub async fn execute(
execute_installed(args, &working_dir, &repo_cache, console).await
}
-// ─── Installed mode ────────────────────────────────────────────────────────
-
async fn execute_installed(
args: &ShowArgs,
working_dir: &Path,
@@ -781,8 +779,6 @@ fn show_installed_package_detail(
Ok(())
}
-// ─── Locked mode ───────────────────────────────────────────────────────────
-
async fn execute_locked(
args: &ShowArgs,
working_dir: &Path,
@@ -1239,8 +1235,6 @@ fn show_locked_package_detail(
Ok(())
}
-// ─── Self mode ─────────────────────────────────────────────────────────────
-
fn show_self(
args: &ShowArgs,
working_dir: &Path,
@@ -1336,8 +1330,6 @@ fn show_self(
Ok(())
}
-// ─── Tree mode ─────────────────────────────────────────────────────────────
-
fn show_tree(
args: &ShowArgs,
working_dir: &Path,
@@ -1528,8 +1520,6 @@ fn is_platform_package(name: &str) -> bool {
|| lower == "composer-runtime-api"
}
-// ─── Platform mode ─────────────────────────────────────────────────────────
-
fn show_platform(
args: &ShowArgs,
working_dir: &Path,
@@ -1648,8 +1638,6 @@ fn show_platform(
Ok(())
}
-// ─── Available mode ─────────────────────────────────────────────────────────
-
async fn show_available(
args: &ShowArgs,
working_dir: &Path,
@@ -1847,8 +1835,6 @@ async fn show_available_versions_inline(
}
}
-// ─── Helper functions ──────────────────────────────────────────────────────
-
/// Format version string for display: strip leading 'v' for text output.
fn format_version(version: &str) -> String {
version.strip_prefix('v').unwrap_or(version).to_string()
@@ -1955,14 +1941,10 @@ fn normalize_version_simple(version: &str) -> String {
result
}
-// ─── Tests ─────────────────────────────────────────────────────────────────
-
#[cfg(test)]
mod tests {
use super::*;
- // ── format_license_for_show ─────────────────────────────────────────────
-
#[test]
fn test_format_license_for_show_osi_approved() {
let out = format_license_for_show("MIT");
@@ -2006,8 +1988,6 @@ mod tests {
);
}
- // ── format_version ──────────────────────────────────────────────────────
-
#[test]
fn test_format_version_strips_v() {
assert_eq!(format_version("v1.2.3"), "1.2.3");
@@ -2023,8 +2003,6 @@ mod tests {
assert_eq!(format_version("dev-main"), "dev-main");
}
- // ── matches_wildcard ─────────────────────────────────────────────────────
-
#[test]
fn test_matches_wildcard_exact() {
assert!(matches_wildcard("psr/log", "psr/log"));
@@ -2071,16 +2049,12 @@ mod tests {
assert!(!matches_wildcard("psr/log", "psr/l"));
}
- // ── format_version_highlight ────────────────────────────────────────────
-
#[test]
fn test_format_version_highlight() {
assert_eq!(format_version_highlight("v3.0.0"), "* 3.0.0");
assert_eq!(format_version_highlight("3.0.0"), "* 3.0.0");
}
- // ── get_installed_description ────────────────────────────────────────────
-
#[test]
fn test_get_installed_description_present() {
use std::collections::BTreeMap;
@@ -2122,8 +2096,6 @@ mod tests {
assert_eq!(get_installed_description(&pkg), "");
}
- // ── get_installed_keywords ───────────────────────────────────────────────
-
#[test]
fn test_get_installed_keywords() {
use std::collections::BTreeMap;
@@ -2147,8 +2119,6 @@ mod tests {
assert_eq!(get_installed_keywords(&pkg), "log, psr3, logging");
}
- // ── is_platform_package ───────────────────────────────────────────────────
-
#[test]
fn test_is_platform_package_php() {
assert!(is_platform_package("php"));
@@ -2171,8 +2141,6 @@ mod tests {
assert!(!is_platform_package("psr/log"));
}
- // ── classify_update_category ─────────────────────────────────────────────
-
#[test]
fn test_classify_up_to_date() {
assert_eq!(
@@ -2197,8 +2165,6 @@ mod tests {
);
}
- // ── normalize_version_simple ──────────────────────────────────────────────
-
#[test]
fn test_normalize_version_simple_short() {
assert_eq!(normalize_version_simple("1.2"), "1.2.0.0");
@@ -2214,8 +2180,6 @@ mod tests {
assert_eq!(normalize_version_simple("v1.2.3"), "1.2.3.0");
}
- // ── extract_major ─────────────────────────────────────────────────────────
-
#[test]
fn test_extract_major_basic() {
assert_eq!(extract_major("2.3.4.0"), 2);
diff --git a/crates/mozart/src/commands/status.rs b/crates/mozart/src/commands/status.rs
index b8585dc..9bccef0 100644
--- a/crates/mozart/src/commands/status.rs
+++ b/crates/mozart/src/commands/status.rs
@@ -11,8 +11,6 @@ pub struct StatusArgs {
pub verbose: bool,
}
-// ─── Data structures ────────────────────────────────────────────────────────
-
/// Information extracted from a package's dist field.
struct DistInfo {
dist_type: String,
@@ -44,8 +42,6 @@ struct PackageStatus {
changes: Vec<FileChange>,
}
-// ─── Main entry point ────────────────────────────────────────────────────────
-
pub async fn execute(
args: &StatusArgs,
cli: &super::Cli,
@@ -212,8 +208,6 @@ pub async fn execute(
Err(mozart_core::exit_code::bail_silent(1))
}
-// ─── Helpers ──────────────────────────────────────────────────────────────────
-
/// Extract dist info from an installed package entry.
fn extract_dist_info(pkg: &mozart_registry::installed::InstalledPackageEntry) -> Option<DistInfo> {
// Try the strongly-typed `dist` field first
@@ -371,16 +365,12 @@ fn compute_diff(
changes
}
-// ─── Tests ───────────────────────────────────────────────────────────────────
-
#[cfg(test)]
mod tests {
use super::*;
use std::fs;
use tempfile::tempdir;
- // ── hash_directory ────────────────────────────────────────────────────────
-
#[test]
fn test_hash_directory() {
let dir = tempdir().unwrap();
@@ -411,8 +401,6 @@ mod tests {
assert_ne!(hashes["file.txt"], hashes3["file.txt"]);
}
- // ── compute_diff_no_changes ───────────────────────────────────────────────
-
#[test]
fn test_compute_diff_no_changes() {
let mut map: IndexMap<String, String> = IndexMap::new();
@@ -423,8 +411,6 @@ mod tests {
assert!(changes.is_empty());
}
- // ── compute_diff_modified ─────────────────────────────────────────────────
-
#[test]
fn test_compute_diff_modified() {
let mut original: IndexMap<String, String> = IndexMap::new();
@@ -439,8 +425,6 @@ mod tests {
assert_eq!(changes[0].path, "src/Foo.php");
}
- // ── compute_diff_added ────────────────────────────────────────────────────
-
#[test]
fn test_compute_diff_added() {
let original: IndexMap<String, String> = IndexMap::new();
@@ -454,8 +438,6 @@ mod tests {
assert_eq!(changes[0].path, "src/NewFile.php");
}
- // ── compute_diff_removed ──────────────────────────────────────────────────
-
#[test]
fn test_compute_diff_removed() {
let mut original: IndexMap<String, String> = IndexMap::new();
@@ -469,8 +451,6 @@ mod tests {
assert_eq!(changes[0].path, "src/OldFile.php");
}
- // ── compute_diff_mixed ────────────────────────────────────────────────────
-
#[test]
fn test_compute_diff_mixed() {
let mut original: IndexMap<String, String> = IndexMap::new();
@@ -509,8 +489,6 @@ mod tests {
assert_eq!(removed[0].path, "src/Removed.php");
}
- // ── extract_dist_info ─────────────────────────────────────────────────────
-
#[test]
fn test_extract_dist_info_from_dist_field() {
use std::collections::BTreeMap;
@@ -583,8 +561,6 @@ mod tests {
assert!(extract_dist_info(&pkg).is_none());
}
- // ── resolve_install_path ──────────────────────────────────────────────────
-
#[test]
fn test_resolve_install_path_default() {
use std::collections::BTreeMap;
diff --git a/crates/mozart/src/commands/suggests.rs b/crates/mozart/src/commands/suggests.rs
index 61185b2..678fd91 100644
--- a/crates/mozart/src/commands/suggests.rs
+++ b/crates/mozart/src/commands/suggests.rs
@@ -33,16 +33,12 @@ pub struct SuggestsArgs {
pub no_dev: bool,
}
-// ─── Data structures ─────────────────────────────────────────────────────────
-
struct Suggestion {
source: String, // package making the suggestion
target: String, // suggested package name
reason: String, // human-readable reason (may be empty)
}
-// ─── Main entry point ────────────────────────────────────────────────────────
-
pub async fn execute(
args: &SuggestsArgs,
cli: &super::Cli,
@@ -162,8 +158,6 @@ pub async fn execute(
Ok(())
}
-// ─── Suggestion collection ───────────────────────────────────────────────────
-
fn collect_suggestions_from_locked(
working_dir: &Path,
no_dev: bool,
@@ -267,8 +261,6 @@ fn collect_suggestions_from_root(working_dir: &Path) -> anyhow::Result<Vec<Sugge
Ok(result)
}
-// ─── Installed name collection ───────────────────────────────────────────────
-
fn collect_installed_names_from_lock(
working_dir: &Path,
no_dev: bool,
@@ -379,8 +371,6 @@ fn is_platform_package(name: &str) -> bool {
n == "php" || n.starts_with("php-") || n.starts_with("ext-") || n.starts_with("lib-")
}
-// ─── Direct deps helper ───────────────────────────────────────────────────────
-
fn compute_direct_deps(working_dir: &Path) -> anyhow::Result<IndexSet<String>> {
let composer_json_path = working_dir.join("composer.json");
if !composer_json_path.exists() {
@@ -398,8 +388,6 @@ fn compute_direct_deps(working_dir: &Path) -> anyhow::Result<IndexSet<String>> {
Ok(deps)
}
-// ─── Sanitization ────────────────────────────────────────────────────────────
-
/// Sanitize a suggestion reason string for safe terminal output.
/// Replaces newlines with spaces and strips control characters.
fn sanitize_reason(reason: &str) -> String {
@@ -410,8 +398,6 @@ fn sanitize_reason(reason: &str) -> String {
.collect()
}
-// ─── Deduplication ────────────────────────────────────────────────────────────
-
/// Deduplicate suggestions by (source, target) pair.
/// If the same source suggests the same target multiple times, the last reason wins.
/// This matches Composer's behavior where map insertion overwrites previous entries.
@@ -432,8 +418,6 @@ fn deduplicate_suggestions(suggestions: Vec<Suggestion>) -> Vec<Suggestion> {
deduped
}
-// ─── Rendering ───────────────────────────────────────────────────────────────
-
fn render_list(suggestions: &[&Suggestion], console: &console::Console) {
let mut targets: Vec<&str> = suggestions.iter().map(|s| s.target.as_str()).collect();
targets.sort_unstable();
@@ -501,15 +485,11 @@ fn render_by_suggestion(suggestions: &[&Suggestion], console: &console::Console)
}
}
-// ─── Tests ───────────────────────────────────────────────────────────────────
-
#[cfg(test)]
mod tests {
use super::*;
use std::collections::BTreeMap;
- // ── Helpers ───────────────────────────────────────────────────────────────
-
fn make_suggestion(source: &str, target: &str, reason: &str) -> Suggestion {
Suggestion {
source: source.to_string(),
@@ -595,8 +575,6 @@ mod tests {
}
}
- // ── Deduplication tests ────────────────────────────────────────────────────
-
#[test]
fn test_deduplicate_keeps_last_reason() {
let suggestions = vec![
@@ -636,8 +614,6 @@ mod tests {
assert_eq!(deduped.len(), 2);
}
- // ── Filter tests ──────────────────────────────────────────────────────────
-
#[test]
fn test_filter_removes_installed_targets() {
let suggestions = [
@@ -725,8 +701,6 @@ mod tests {
assert_eq!(filtered.len(), 3);
}
- // ── Collection tests ──────────────────────────────────────────────────────
-
#[test]
fn test_suggests_from_lockfile() {
use tempfile::tempdir;
diff --git a/crates/mozart/src/commands/update.rs b/crates/mozart/src/commands/update.rs
index aa19675..79fd7ba 100644
--- a/crates/mozart/src/commands/update.rs
+++ b/crates/mozart/src/commands/update.rs
@@ -134,10 +134,6 @@ pub struct UpdateArgs {
pub bump_after_update: Option<Option<String>>,
}
-// ─────────────────────────────────────────────────────────────────────────────
-// Change tracking types
-// ─────────────────────────────────────────────────────────────────────────────
-
/// The kind of change for a package during update.
#[derive(Debug, PartialEq, Eq)]
pub enum ChangeKind {
@@ -161,10 +157,6 @@ pub struct UpdateChange {
pub kind: ChangeKind,
}
-// ─────────────────────────────────────────────────────────────────────────────
-// Helper: parse minimum-stability string
-// ─────────────────────────────────────────────────────────────────────────────
-
/// Parse a minimum-stability string from composer.json into a `Stability` enum value.
///
/// Recognizes "stable", "RC", "beta", "alpha", "dev" (case-insensitive).
@@ -256,10 +248,6 @@ fn is_platform_package(name: &str) -> bool {
|| lower == "composer-plugin-api"
}
-// ─────────────────────────────────────────────────────────────────────────────
-// Helper: compute changes between old and new lock
-// ─────────────────────────────────────────────────────────────────────────────
-
/// Compare old lock vs new lock to determine installs, updates, removals, and unchanged packages.
///
/// Produces one `UpdateChange` per affected package. Packages that are identical in both
@@ -336,10 +324,6 @@ pub fn compute_update_changes(
changes
}
-// ─────────────────────────────────────────────────────────────────────────────
-// Helper: apply partial update filter
-// ─────────────────────────────────────────────────────────────────────────────
-
/// Resolve a `LockedPackage`'s normalized version, falling back to the
/// canonical 4-segment form derived from the pretty version when the lock
/// omits `version_normalized`.
@@ -440,10 +424,6 @@ pub fn apply_partial_update(
.collect()
}
-// ─────────────────────────────────────────────────────────────────────────────
-// Wildcard expansion helpers
-// ─────────────────────────────────────────────────────────────────────────────
-
/// Match a single package name against a glob pattern.
///
/// Only the `*` wildcard is supported (matches any sequence of non-`/` characters
@@ -566,10 +546,6 @@ pub fn expand_wildcards(
result
}
-// ─────────────────────────────────────────────────────────────────────────────
-// Dependency expansion helpers
-// ─────────────────────────────────────────────────────────────────────────────
-
/// Build a lookup map from package name (lowercase) to its LockedPackage.
fn build_lock_map(lock: &lockfile::LockFile) -> IndexMap<String, &lockfile::LockedPackage> {
let mut map = IndexMap::new();
@@ -823,10 +799,6 @@ pub fn expand_packages(
packages
}
-// ─────────────────────────────────────────────────────────────────────────────
-// Interactive selection helper
-// ─────────────────────────────────────────────────────────────────────────────
-
/// Interactively prompt the user to select which packages to update.
///
/// For each package in `packages`, prints a y/n prompt and collects the
@@ -886,10 +858,6 @@ pub fn interactive_select_packages(
selected
}
-// ─────────────────────────────────────────────────────────────────────────────
-// Minimal-changes helper
-// ─────────────────────────────────────────────────────────────────────────────
-
/// For `--minimal-changes` mode: when no specific packages are named, pin all
/// packages to their current locked version UNLESS the current locked version
/// no longer satisfies the root constraint. This prevents pulling in newer
@@ -977,10 +945,6 @@ fn major_minor(version: &str) -> (u64, u64) {
(major, minor)
}
-// ─────────────────────────────────────────────────────────────────────────────
-// Main execute function
-// ─────────────────────────────────────────────────────────────────────────────
-
/// CLI entry point. Builds production [`RepositorySet`] (Packagist) and
/// [`FilesystemExecutor`] from `cli`, then dispatches to [`run`].
pub async fn execute(
@@ -1876,17 +1840,11 @@ pub async fn run(
Ok(())
}
-// ─────────────────────────────────────────────────────────────────────────────
-// Tests
-// ─────────────────────────────────────────────────────────────────────────────
-
#[cfg(test)]
mod tests {
use super::*;
use std::collections::BTreeMap;
- // ──────────── Helper constructors ────────────
-
fn make_locked_package(name: &str, version: &str) -> lockfile::LockedPackage {
lockfile::LockedPackage {
name: name.to_string(),
@@ -1950,8 +1908,6 @@ mod tests {
}
}
- // ──────────── parse_minimum_stability ────────────
-
#[test]
fn test_parse_minimum_stability_stable() {
assert_eq!(parse_minimum_stability("stable"), Stability::Stable);
@@ -1989,8 +1945,6 @@ mod tests {
assert_eq!(parse_minimum_stability(""), Stability::Stable);
}
- // ──────────── compute_update_changes ────────────
-
#[test]
fn test_compute_update_changes_all_new() {
// No old lock: all packages in new lock should be Install
@@ -2134,8 +2088,6 @@ mod tests {
);
}
- // ──────────── apply_partial_update ────────────
-
#[test]
fn test_apply_partial_update_keeps_non_specified_packages() {
// old lock has psr/log 3.0.0 and monolog 3.7.0
@@ -2216,8 +2168,6 @@ mod tests {
assert_eq!(psr.version, "3.0.0");
}
- // ──────────── glob_matches ────────────
-
#[test]
fn test_glob_matches_exact() {
assert!(glob_matches("monolog/monolog", "monolog/monolog"));
@@ -2257,8 +2207,6 @@ mod tests {
assert!(!glob_matches("monolog", "monolog/monolog"));
}
- // ──────────── expand_wildcards ────────────
-
#[test]
fn test_expand_wildcards_no_wildcard_passthrough() {
let lock = minimal_lock(vec![make_locked_package("psr/log", "3.0.0")]);
@@ -2315,8 +2263,6 @@ mod tests {
assert_eq!(result, vec!["phpunit/phpunit"]);
}
- // ──────────── expand_with_direct_dependencies ────────────
-
#[test]
fn test_expand_with_direct_deps_adds_require() {
// monolog/monolog requires psr/log
@@ -2384,8 +2330,6 @@ mod tests {
assert_eq!(psr_count, 1, "psr/log should appear only once");
}
- // ──────────── expand_with_all_dependencies ────────────
-
#[test]
fn test_expand_all_deps_transitive() {
// a -> b -> c
@@ -2430,8 +2374,6 @@ mod tests {
assert_eq!(result.len(), 2);
}
- // ──────────── expand_packages ────────────
-
#[test]
fn test_expand_packages_wildcard_with_direct_deps() {
// symfony/* expands to symfony/console; symfony/console requires psr/log
@@ -2456,8 +2398,6 @@ mod tests {
assert!(result.contains(&"psr/log".to_string()));
}
- // ──────────── apply_minimal_changes ────────────
-
#[test]
fn test_apply_minimal_changes_pins_all() {
// Resolver found psr/log 3.0.1, but old lock has 3.0.0
@@ -2473,8 +2413,6 @@ mod tests {
);
}
- // ──────────── Integration test (network, #[ignore]) ────────────
-
#[tokio::test]
#[ignore]
async fn test_update_full_e2e() {
diff --git a/crates/mozart/src/commands/validate.rs b/crates/mozart/src/commands/validate.rs
index d7bd9fb..6bff198 100644
--- a/crates/mozart/src/commands/validate.rs
+++ b/crates/mozart/src/commands/validate.rs
@@ -45,8 +45,6 @@ pub struct ValidateArgs {
pub strict: bool,
}
-// ─── Result accumulator ─────────────────────────────────────────────────────
-
struct ValidationResult {
errors: Vec<String>,
publish_errors: Vec<String>,
@@ -75,8 +73,6 @@ impl ValidationResult {
}
}
-// ─── Helpers ─────────────────────────────────────────────────────────────────
-
fn should_check_lock(args: &ValidateArgs, manifest: &serde_json::Value) -> bool {
let config_lock_enabled = manifest
.get("config")
@@ -86,8 +82,6 @@ fn should_check_lock(args: &ValidateArgs, manifest: &serde_json::Value) -> bool
(!args.no_check_lock && config_lock_enabled) || args.check_lock
}
-// ─── Entry point ─────────────────────────────────────────────────────────────
-
pub async fn execute(
args: &ValidateArgs,
cli: &super::Cli,
@@ -195,8 +189,6 @@ pub async fn execute(
Ok(())
}
-// ─── Manifest validation ─────────────────────────────────────────────────────
-
fn validate_manifest(
manifest: &serde_json::Value,
args: &ValidateArgs,
@@ -228,8 +220,6 @@ fn validate_manifest(
check_scripts_orphans(obj, result);
}
-// ─── Individual checks ───────────────────────────────────────────────────────
-
/// Check the "name" field: must be present (for published packages) and lowercase.
fn check_name(obj: &serde_json::Map<String, serde_json::Value>, result: &mut ValidationResult) {
match obj.get("name").and_then(|v| v.as_str()) {
@@ -647,8 +637,6 @@ fn check_scripts_orphans(
}
}
-// ─── Dependency validation ───────────────────────────────────────────────
-
fn validate_dependencies(
vendor_dir: &Path,
args: &ValidateArgs,
@@ -736,8 +724,6 @@ fn validate_dependencies(
(dep_errors, dep_warnings)
}
-// ─── Lock file freshness ─────────────────────────────────────────────────────
-
fn check_lock_freshness(
composer_json_content: &str,
composer_json_path: &Path,
@@ -769,8 +755,6 @@ fn check_lock_freshness(
}
}
-// ─── Output ──────────────────────────────────────────────────────────────────
-
fn output_result(
console: &mozart_core::console::Console,
file: &Path,
@@ -871,8 +855,6 @@ fn output_result(
}
}
-// ─── Exit code ───────────────────────────────────────────────────────────────
-
/// Compute the exit code following Composer's convention:
/// 0 = valid, 1 = warnings (only with --strict), 2 = errors, 3 = file unreadable (handled earlier)
fn compute_exit_code(
@@ -899,8 +881,6 @@ fn compute_exit_code(
0
}
-// ─── Tests ───────────────────────────────────────────────────────────────────
-
#[cfg(test)]
mod tests {
use super::*;
@@ -925,8 +905,6 @@ mod tests {
result
}
- // ── check_name ─────────────────────────────────────────────────────────
-
#[test]
fn test_validate_missing_name_is_publish_error() {
let json = r#"{"require": {"php": ">=8.1"}, "license": "MIT"}"#;
@@ -973,8 +951,6 @@ mod tests {
assert!(result.errors[0].contains("vendor/package"));
}
- // ── check_license ──────────────────────────────────────────────────────
-
#[test]
fn test_validate_missing_license_warns() {
let json = r#"{"name": "vendor/pkg"}"#;
@@ -1110,8 +1086,6 @@ mod tests {
);
}
- // ── ValidatingArrayLoader-equivalent license checks ────────────────────
-
#[test]
fn test_validate_license_wrong_type_warns() {
let json = r#"{"name": "vendor/pkg", "license": 42}"#;
@@ -1252,8 +1226,6 @@ mod tests {
);
}
- // ── parse_iso_time_to_unix ─────────────────────────────────────────────
-
#[test]
fn test_parse_iso_time_basic() {
assert_eq!(parse_iso_time_to_unix("1970-01-01 00:00:00"), Some(0));
@@ -1297,8 +1269,6 @@ mod tests {
assert_eq!(parse_iso_time_to_unix("2023/12/15 13:45:30"), None);
}
- // ── check_version_field ────────────────────────────────────────────────
-
#[test]
fn test_validate_version_field_warns() {
let json = r#"{"name": "vendor/pkg", "license": "MIT", "version": "1.0.0"}"#;
@@ -1315,8 +1285,6 @@ mod tests {
assert!(!result.warnings.iter().any(|w| w.contains("version field")));
}
- // ── check_package_type ─────────────────────────────────────────────────
-
#[test]
fn test_validate_deprecated_type_warns() {
let json = r#"{"name": "vendor/pkg", "license": "MIT", "type": "composer-installer"}"#;
@@ -1341,8 +1309,6 @@ mod tests {
);
}
- // ── check_require_overlap ──────────────────────────────────────────────
-
#[test]
fn test_validate_require_overlap_warns() {
let json = r#"{
@@ -1372,8 +1338,6 @@ mod tests {
assert!(!result.warnings.iter().any(|w| w.contains("required both")));
}
- // ── check_provide_replace_overlap ──────────────────────────────────────
-
#[test]
fn test_validate_provide_replace_overlap_warns() {
let json = r#"{
@@ -1391,8 +1355,6 @@ mod tests {
);
}
- // ── check_commit_references ────────────────────────────────────────────
-
#[test]
fn test_validate_commit_ref_warns() {
let json = r#"{
@@ -1415,8 +1377,6 @@ mod tests {
assert!(!result.warnings.iter().any(|w| w.contains("commit-ref")));
}
- // ── check_empty_psr_prefixes ───────────────────────────────────────────
-
#[test]
fn test_validate_empty_psr4_prefix_warns() {
let json = r#"{
@@ -1450,8 +1410,6 @@ mod tests {
assert!(!result.warnings.iter().any(|w| w.contains("psr-4")));
}
- // ── check_minimum_stability ────────────────────────────────────────────
-
#[test]
fn test_validate_invalid_stability_errors() {
let json = r#"{"name": "vendor/pkg", "license": "MIT", "minimum-stability": "invalid"}"#;
@@ -1482,8 +1440,6 @@ mod tests {
}
}
- // ── validate_manifest with non-object ──────────────────────────────────
-
#[test]
fn test_validate_non_object_json_errors() {
let value = serde_json::json!([1, 2, 3]);
@@ -1492,8 +1448,6 @@ mod tests {
assert!(result.errors.iter().any(|e| e.contains("JSON object")));
}
- // ── compute_exit_code ─────────────────────────────────────────────────
-
#[test]
fn test_compute_exit_code_no_issues() {
let result = ValidationResult::new();
@@ -1557,8 +1511,6 @@ mod tests {
assert_eq!(compute_exit_code(&result, &[], true, true, false), 0);
}
- // ── check_lock_freshness ───────────────────────────────────────────────
-
#[test]
fn test_check_lock_freshness_no_lock_file() {
use tempfile::tempdir;
@@ -1651,8 +1603,6 @@ mod tests {
assert!(lock_errors[0].contains("not up to date"));
}
- // ── check_scripts_orphans ──────────────────────────────────────────────
-
#[test]
fn test_validate_scripts_descriptions_orphan_warns() {
let json = r#"{
@@ -1725,8 +1675,6 @@ mod tests {
);
}
- // ── should_check_lock ──────────────────────────────────────────────────
-
#[test]
fn test_should_check_lock_config_false_disables() {
let args = make_args();
@@ -1749,8 +1697,6 @@ mod tests {
assert!(should_check_lock(&args, &manifest));
}
- // ── Full manifest: valid package ───────────────────────────────────────
-
#[test]
fn test_validate_no_errors_on_valid_package() {
let json = r#"{