Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "skip minor lints" flag #364

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/check_release.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ pub(super) fn run_check_release(
crate_name: &str,
current_crate: VersionedCrate,
baseline_crate: VersionedCrate,
skip_minor_lints: bool,
) -> anyhow::Result<bool> {
let current_version = current_crate.crate_version();
let baseline_version = baseline_crate.crate_version();
Expand Down Expand Up @@ -113,6 +114,10 @@ pub(super) fn run_check_release(
let queries_to_run: Vec<_> = queries
.iter()
.filter(|(_, query)| !version_change.supports_requirement(query.required_update))
.filter(|(_, query)| match query.required_update {
RequiredSemverUpdate::Major => true,
RequiredSemverUpdate::Minor => !skip_minor_lints,
})
.collect();
let skipped_queries = queries.len().saturating_sub(queries_to_run.len());

Expand Down
13 changes: 12 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,13 @@ fn main() -> anyhow::Result<()> {
baseline_highest_allowed_version,
)?;

let success = run_check_release(&mut config, name, current_crate, baseline_crate)?;
let success = run_check_release(
&mut config,
name,
current_crate,
baseline_crate,
args.skip_minor_lints,
)?;
vec![Ok(success)]
} else {
let metadata = args.manifest.metadata().exec()?;
Expand Down Expand Up @@ -184,6 +190,7 @@ fn main() -> anyhow::Result<()> {
crate_name,
current_crate,
baseline_crate,
args.skip_minor_lints,
)?)
}
})
Expand Down Expand Up @@ -285,6 +292,10 @@ struct CheckRelease {
#[command(flatten, next_help_heading = "Current")]
pub workspace: clap_cargo::Workspace,

/// Only check whether a major version increment is required.
#[arg(long)]
skip_minor_lints: bool,

/// The current rustdoc json output to test for semver violations.
#[arg(
long,
Expand Down