Skip to content

Commit

Permalink
[WIP} warn on empty version groups
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieMason committed Oct 25, 2024
1 parent c1bf727 commit 26af7c4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/effects/lint.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use itertools::Itertools;
use log::warn;

use crate::{context::Context, effects::ui::Ui, version_group::VersionGroupVariant};

Expand All @@ -18,6 +19,11 @@ pub fn run(ctx: Context) -> Context {
if ctx.config.cli.options.versions {
ui.print_command_header("SEMVER RANGES AND VERSION MISMATCHES");
ctx.version_groups.iter().for_each(|group| {
if group.dependencies.borrow().len() == 0 {
let label = &group.selector.label;
warn!("Version Group with label '{label}' did not match anything");
return;
}
if !ui.show_ignored && matches!(group.variant, VersionGroupVariant::Ignored) {
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::io::Write;
pub fn init() {
Builder::new()
// @TODO expose cli and rcfile options for log level
.filter_level(LevelFilter::Info)
.filter_level(LevelFilter::Debug)
.format(|buf, record| {
match record.level() {
// Normal output shown to users
Expand All @@ -20,7 +20,7 @@ pub fn init() {
writeln!(buf, "{}", format!("! {}", record.args()).yellow())
}
Level::Debug => {
writeln!(buf, "{}", format!("? {}", record.args()).magenta())
writeln!(buf, "{}", format!("? {}", record.args()).cyan())
}
Level::Trace => {
writeln!(buf, "{}", record.args())
Expand Down

0 comments on commit 26af7c4

Please sign in to comment.