Skip to content

Commit c1c24e8

Browse files
committed
Use reexported annotate_snippets from cairo_lint_core
1 parent c896068 commit c1c24e8

File tree

5 files changed

+16
-26
lines changed

5 files changed

+16
-26
lines changed

Cargo.lock

+1-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ repository = "https://github.com/software-mansion/scarb"
4747
# To keep our Cargo.toml following this contract, always use `cargo xtask upgrade`
4848
# for manipulating these dependencies.
4949
[workspace.dependencies]
50-
annotate-snippets = "0.11.5"
5150
anyhow = "1"
5251
assert_fs = "1"
5352
async-trait = "0.1"
@@ -194,7 +193,7 @@ cairo-lang-test-runner = { git = "https://github.com/starkware-libs/cairo", rev
194193
cairo-lang-test-utils = { git = "https://github.com/starkware-libs/cairo", rev = "03944ce36c4b37ef954d7f462d23edce8669e692" }
195194
cairo-lang-utils = { git = "https://github.com/starkware-libs/cairo", rev = "03944ce36c4b37ef954d7f462d23edce8669e692" }
196195
cairo-language-server = { git = "https://github.com/software-mansion/cairols", rev = "6432886fea7564816078ed140434addf50bbaa23" }
197-
cairo-lint-core = { git = "https://github.com/software-mansion/cairo-lint", rev = "b13c0d1600eb9f0fd9d1d807c695dc0db32a7f65" }
196+
cairo-lint-core = { git = "https://github.com/software-mansion/cairo-lint", rev = "5a3e8f50db7de8106fcfbaf18ae90526b3647996" }
198197

199198
[profile.release]
200199
lto = true

scarb/Cargo.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ readme.workspace = true
1414
repository.workspace = true
1515

1616
[dependencies]
17-
annotate-snippets.workspace = true
1817
anyhow.workspace = true
1918
async-trait.workspace = true
2019
cairo-lang-compiler.workspace = true
@@ -105,7 +104,6 @@ reqwest = { workspace = true, default-features = true }
105104
reqwest = { workspace = true, features = ["rustls-tls-native-roots"] }
106105

107106
[dev-dependencies]
108-
annotate-snippets = { workspace = true, features = ["testing-colors"] }
109107
assert_fs.workspace = true
110108
expect-test.workspace = true
111109
fs_extra.workspace = true
@@ -119,6 +117,7 @@ similar-asserts.workspace = true
119117
snapbox.workspace = true
120118
test-case.workspace = true
121119
test-for-each-example = { path = "../utils/test-for-each-example" }
120+
cairo-lint-core = { workspace = true, features = ["testing-colors"]}
122121

123122
[build-dependencies]
124123
fs_extra.workspace = true

scarb/src/ops/lint.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ use crate::{
66
core::TargetKind,
77
ops,
88
};
9-
use annotate_snippets::Renderer;
109
use anyhow::Result;
1110
use cairo_lang_defs::db::DefsGroup;
1211
use cairo_lang_diagnostics::Diagnostics;
1312
use cairo_lang_filesystem::db::FilesGroup;
1413
use cairo_lang_filesystem::ids::CrateLongId;
1514
use cairo_lang_semantic::diagnostic::SemanticDiagnosticKind;
1615
use cairo_lang_semantic::{db::SemanticGroup, SemanticDiagnostic};
16+
use cairo_lint_core::annotate_snippets::Renderer;
1717
use cairo_lint_core::{
1818
apply_fixes,
1919
diagnostics::format_diagnostic,
@@ -57,7 +57,6 @@ pub fn lint(opts: LintOptions, ws: &Workspace<'_>) -> Result<()> {
5757
let package_compilation_units = if opts.test {
5858
compilation_units
5959
.iter()
60-
// TODO: Test this (if the test packages are also checked)
6160
.filter(|compilation_unit| {
6261
let is_main_component = compilation_unit.main_package_id() == package.id;
6362
let has_test_components =

scarb/tests/lint.rs

+12-18
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@ fn lint_main_package() {
2020
"#})
2121
.build(&t);
2222

23-
let snapbox = Scarb::quick_snapbox()
23+
Scarb::quick_snapbox()
2424
.arg("lint")
2525
.current_dir(&t)
2626
.assert()
27-
.success();
28-
29-
// Current expected values include ANSI color codes because lint has custom renderer.
30-
#[cfg(not(windows))]
31-
snapbox.stdout_matches(indoc! {r#"
27+
.success()
28+
// Current expected values include ANSI color codes because lint has custom renderer.
29+
.stdout_matches(indoc! {r#"
3230
Linting hello v1.0.0 ([..]/Scarb.toml)
3331
warning: Plugin diagnostic: Unnecessary comparison with a boolean value. Use the variable directly.
3432
--> [..]/lib.cairo:3:8
@@ -79,16 +77,14 @@ fn lint_workspace() {
7977
"#}))
8078
.build(&t);
8179

82-
let snapbox = Scarb::quick_snapbox()
80+
Scarb::quick_snapbox()
8381
.arg("lint")
8482
.arg("--workspace")
8583
.current_dir(&t)
8684
.assert()
87-
.success();
88-
89-
// Current expected values include ANSI color codes because lint has custom renderer.
90-
#[cfg(not(windows))]
91-
snapbox.stdout_matches(indoc! {r#"
85+
.success()
86+
// Current expected values include ANSI color codes because lint has custom renderer.
87+
.stdout_matches(indoc! {r#"
9288
Linting first v1.0.0 ([..]/first/Scarb.toml)
9389
warning: Plugin diagnostic: Unnecessary comparison with a boolean value. Use the variable directly.
9490
--> [..]/lib.cairo:3:8
@@ -146,16 +142,14 @@ fn lint_integration_tests() {
146142
"#})
147143
.unwrap();
148144

149-
let snapbox = Scarb::quick_snapbox()
145+
Scarb::quick_snapbox()
150146
.arg("lint")
151147
.arg("-t")
152148
.current_dir(&t)
153149
.assert()
154-
.success();
155-
156-
// Current expected values include ANSI color codes because lint has custom renderer.
157-
#[cfg(not(windows))]
158-
snapbox.stdout_matches(indoc! {r#"
150+
.success()
151+
// Current expected values include ANSI color codes because lint has custom renderer.
152+
.stdout_matches(indoc! {r#"
159153
Linting hello v1.0.0 ([..]/Scarb.toml)
160154
Linting test(hello_unittest) hello v1.0.0 ([..]/Scarb.toml)
161155
Linting test(hello_integrationtest) hello_integrationtest v1.0.0 ([..]/Scarb.toml)

0 commit comments

Comments
 (0)