Skip to content
Merged
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
2 changes: 1 addition & 1 deletion docs/how-to-analyze-change-impact.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ HEAD=$(git -C "$REPO" rev-parse HEAD)
--format json --check-tags
```

The report then includes missing, invalid, unavailable, and non-binding link findings. To make any such finding fail the command, add `--fail-on-tag-findings`. That option requires `--check-tags`.
The report then includes missing, invalid, unavailable, and non-binding link findings. In JSON they are listed in `tag_check.entries`, each with its `kind` (`missing_link`, `invalid_id`, `unverifiable_id` or `non_binding_attribute`), path, the changed symbol and source line when they can be told, and a `reason_chain`. The human report prints one block per finding under the same four names. The check covers Rust sources only; a clean result says nothing about other languages. To make any such finding fail the command, add `--fail-on-tag-findings`. That option requires `--check-tags`.

3. **Compare a dependency move.** Pass the local upstream repository and the old and new revisions for each dependency move:

Expand Down
31 changes: 18 additions & 13 deletions src/commands/impact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ use anyhow::{anyhow, Context, Result};
use clap::Parser;
use ix_trace_rs::implements;
use quire_rs::impact::{
self, DependencyMoveInput, FileChange, ImpactFinding, ImpactInput, LineRange, SourceSnapshot,
self, DependencyMoveInput, FileChange, ImpactInput, LineRange, SourceSnapshot,
};
#[cfg(test)]
use quire_rs::Registry;
use quire_rs::{Diagnostic, Spec};
use serde_json::Value;

use crate::commands::impact_dependency;
use crate::commands::impact_tags::{self, is_tag_finding};
use crate::commands::Ctx;

#[derive(Debug, Parser)]
Expand Down Expand Up @@ -129,6 +130,9 @@ pub fn run(ctx: &Ctx, args: Args) -> Result<()> {
caller_search_depth: args.caller_depth,
})?;
let tag_findings = report.findings.iter().any(is_tag_finding);
let tag_check = args
.check_tags
.then(|| impact_tags::tag_check(&report, &head));
if !args.check_tags {
report.findings.retain(|finding| !is_tag_finding(finding));
}
Expand All @@ -140,6 +144,9 @@ pub fn run(ctx: &Ctx, args: Args) -> Result<()> {
if let Some(v) = object.remove("caller_searches") {
object.insert("caller_search".into(), v);
}
if let Some(check) = &tag_check {
object.insert("tag_check".into(), check.clone());
}
if !dependency_moves.is_empty() {
object.insert(
"dependency_moves".into(),
Expand Down Expand Up @@ -189,9 +196,18 @@ pub fn run(ctx: &Ctx, args: Args) -> Result<()> {
related.reason
);
}
for finding in &report.findings {
for finding in report
.findings
.iter()
.filter(|finding| !is_tag_finding(finding))
{
primary_line!("Finding: {:?}\n", finding);
}
if let Some(check) = &tag_check {
for line in impact_tags::render_human(check) {
primary_line!("{line}\n");
}
}
for unmapped in &report.unmapped_changes {
primary_line!(
"Unmapped {} {:?} lines {}-{}\n",
Expand All @@ -217,17 +233,6 @@ pub fn run(ctx: &Ctx, args: Args) -> Result<()> {
Ok(())
}

#[implements("FR-049-AC-5")]
fn is_tag_finding(finding: &ImpactFinding) -> bool {
matches!(
finding,
ImpactFinding::UnlinkedSymbol { .. }
| ImpactFinding::UnresolvedId { .. }
| ImpactFinding::UnavailableSpecification { .. }
| ImpactFinding::NonBindingMarker { .. }
)
}

#[implements("FR-049-AC-5")]
fn unavailable_spec_ids(spec: &Spec) -> BTreeSet<String> {
spec.diagnostics()
Expand Down
Loading