Skip to content

Commit 7e0cff3

Browse files
authored
Update gix/codespan-reporting (#798)
- **Fix sarif versioning in tests** - **Cleanup** - **Bump gix/tame-index** - **Update codespan-reporting**
1 parent 8d22680 commit 7e0cff3

File tree

15 files changed

+359
-401
lines changed

15 files changed

+359
-401
lines changed

Cargo.lock

Lines changed: 316 additions & 374 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ cfg-expr = "0.20"
5656
# Argument parsing, kept aligned with cargo
5757
clap = { version = "4.5", features = ["derive", "env"] }
5858
# Used for diagnostic reporting
59-
codespan = { version = "0.12", features = ["serialization"] }
60-
codespan-reporting = { version = "0.12", features = ["serialization"] }
59+
codespan = { version = "0.13", features = ["serialization"] }
60+
codespan-reporting = { version = "0.13", features = ["serialization"] }
6161
# Brrrrr
6262
crossbeam = "0.8"
6363
# Logging utilities
@@ -107,7 +107,7 @@ spdx = "0.12"
107107
# Lazy
108108
strum = { version = "0.27", features = ["derive"] }
109109
# Index retrieval and querying
110-
tame-index = { version = "0.23", default-features = false, features = [
110+
tame-index = { version = "0.24", default-features = false, features = [
111111
"git",
112112
"local",
113113
"sparse",
@@ -118,7 +118,7 @@ time = { version = "0.3", default-features = false, features = [
118118
"macros",
119119
] }
120120
# Deserialization of configuration files and crate manifests
121-
toml-span = { version = "0.5", features = ["reporting"] }
121+
toml-span = { version = "0.6", features = ["reporting"] }
122122
# Small fast hash crate
123123
twox-hash = { version = "2.1", default-features = false, features = ["xxhash32"] }
124124
# Url parsing/manipulation
@@ -128,7 +128,7 @@ walkdir = "2.3"
128128

129129
# We clone/fetch advisory databases
130130
[dependencies.gix]
131-
version = "0.73"
131+
version = "0.74"
132132
default-features = false
133133
features = [
134134
"blocking-http-transport-reqwest",
@@ -142,9 +142,9 @@ features = [
142142
fs_extra = "1.3"
143143
# Snapshot testing
144144
insta = { version = "1.43", features = ["json"] }
145-
tame-index = { version = "0.23", features = ["local-builder"] }
145+
tame-index = { version = "0.24", features = ["local-builder"] }
146146
time = { version = "0.3", features = ["serde"] }
147-
toml-span = { version = "0.5", features = ["serde"] }
147+
toml-span = { version = "0.6", features = ["serde"] }
148148
# We use this for creating fake crate directories for crawling license files on disk
149149
tempfile = "3.17"
150150
# divan = "0.1"

deny.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ deny = [
2929
skip = [
3030
{ crate = "[email protected]", reason = "reqwest -> system-configuration uses this old version" },
3131
{ crate = "[email protected]", reason = "ring uses this old version" },
32-
{ crate = "[email protected]", reason = "gix uses this old version" },
32+
{ crate = "[email protected]", reason = "petgraph uses this old version" },
33+
{ crate = "[email protected]", reason = "hashbrown 0.15 uses this old version" },
3334
]
3435
skip-tree = [
3536
{ crate = "windows-sys", reason = "a foundational crate for many that bumps far too frequently to ever have a shared version" },

examples/09_bans/deny.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
[graph]
12
targets = [
2-
{ triple = "x86_64-unknown-linux-musl" },
3-
{ triple = "x86_64-pc-windows-msvc" },
4-
{ triple = "x86_64-apple-darwin" },
3+
"x86_64-unknown-linux-musl",
4+
"x86_64-pc-windows-msvc",
5+
"x86_64-apple-darwin",
56
]
67

78
[bans]

src/advisories/helpers/db.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ fn fetch_and_checkout(repo: &mut gix::Repository) -> anyhow::Result<()> {
331331
.context("unable to checkout, repository is bare")?;
332332
let root_tree = repo
333333
.head()?
334-
.try_peel_to_id_in_place()?
334+
.try_peel_to_id()?
335335
.context("unable to peel HEAD")?
336336
.object()
337337
.context("HEAD commit not downloaded from remote")?

src/cargo-deny/common.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ impl OutputLock<'_, '_> {
410410
return;
411411
}
412412

413-
let _ = term::emit(l, &cfg.config, files, &diag);
413+
let _ = term::emit_to_write_style(l, &cfg.config, files, &diag);
414414
}
415415
Self::Json(_cfg, max, w) => {
416416
if diag.severity < *max {
@@ -464,7 +464,7 @@ impl OutputLock<'_, '_> {
464464
}
465465
}
466466

467-
let _ = term::emit(l, &cfg.config, files, &diag.diag);
467+
let _ = term::emit_to_write_style(l, &cfg.config, files, &diag.diag);
468468
}
469469
}
470470
Self::Json(cfg, max, w) => {

src/diag.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,8 @@ lines
732732
}
733733

734734
for diag in diags {
735-
codespan_reporting::term::emit(&mut term, &config, &files, &diag).unwrap();
735+
codespan_reporting::term::emit_to_write_style(&mut term, &config, &files, &diag)
736+
.unwrap();
736737
}
737738

738739
insta::assert_snapshot!(String::from_utf8(term.into_inner()).unwrap());

src/sarif/collector.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,10 @@ impl SarifCollector {
268268
SarifLog {
269269
runs: vec![Run {
270270
tool: Tool {
271-
driver: Driver { rules },
271+
driver: Driver {
272+
rules,
273+
version: None,
274+
},
272275
},
273276
results,
274277
}],

src/sarif/model.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ pub struct Tool {
3535

3636
pub struct Driver {
3737
pub rules: Vec<Rule>,
38+
pub version: Option<semver::Version>,
3839
}
3940

4041
impl Serialize for Driver {
@@ -44,8 +45,13 @@ impl Serialize for Driver {
4445
{
4546
let mut m = serializer.serialize_map(Some(4))?;
4647
m.serialize_entry("name", "cargo-deny")?;
47-
m.serialize_entry("version", env!("CARGO_PKG_VERSION"))?;
48-
m.serialize_entry("semanticVersion", env!("CARGO_PKG_VERSION"))?;
48+
if let Some(v) = &self.version {
49+
m.serialize_entry("version", &v)?;
50+
m.serialize_entry("semanticVersion", &v)?;
51+
} else {
52+
m.serialize_entry("version", env!("CARGO_PKG_VERSION"))?;
53+
m.serialize_entry("semanticVersion", env!("CARGO_PKG_VERSION"))?;
54+
}
4955
m.serialize_entry("rules", &self.rules)?;
5056
m.end()
5157
}

src/test_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ pub(crate) fn write_diagnostics(
203203
let config = crate::diag::codespan_config();
204204

205205
for diag in errors {
206-
codespan_reporting::term::emit(&mut s, &config, files, &diag).unwrap();
206+
codespan_reporting::term::emit_to_write_style(&mut s, &config, files, &diag).unwrap();
207207
}
208208

209209
String::from_utf8(s.into_inner()).unwrap()

0 commit comments

Comments
 (0)