Skip to content

Commit ab5647b

Browse files
committed
Use new interface for fixing lints
1 parent 7e6fa43 commit ab5647b

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

Cargo.lock

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

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ cairo-lang-test-runner = { git = "https://github.com/starkware-libs/cairo", rev
193193
cairo-lang-test-utils = { git = "https://github.com/starkware-libs/cairo", rev = "03944ce36c4b37ef954d7f462d23edce8669e692" }
194194
cairo-lang-utils = { git = "https://github.com/starkware-libs/cairo", rev = "03944ce36c4b37ef954d7f462d23edce8669e692" }
195195
cairo-language-server = { git = "https://github.com/software-mansion/cairols", rev = "6432886fea7564816078ed140434addf50bbaa23" }
196-
cairo-lint-core = { git = "https://github.com/software-mansion/cairo-lint", rev = "5a3e8f50db7de8106fcfbaf18ae90526b3647996" }
196+
cairo-lint-core = { git = "https://github.com/software-mansion/cairo-lint", rev = "6f6416fdf4ed4b04c59fce694886506384c3859d" }
197197

198198
[profile.release]
199199
lto = true

scarb/src/ops/lint.rs

+10-5
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ use cairo_lang_filesystem::db::FilesGroup;
1515
use cairo_lang_filesystem::ids::CrateLongId;
1616
use cairo_lang_semantic::diagnostic::SemanticDiagnosticKind;
1717
use cairo_lang_semantic::{db::SemanticGroup, SemanticDiagnostic};
18+
use cairo_lang_utils::Upcast;
1819
use cairo_lint_core::annotate_snippets::Renderer;
1920
use cairo_lint_core::{
20-
apply_fixes,
21+
apply_file_fixes,
2122
diagnostics::format_diagnostic,
23+
get_fixes,
2224
plugin::{cairo_lint_plugin_suite, diagnostic_kind_from_message, CairoLintKind},
2325
};
2426
use itertools::Itertools;
@@ -170,10 +172,13 @@ pub fn lint(opts: LintOptions, ws: &Workspace<'_>) -> Result<()> {
170172
.collect::<Vec<_>>();
171173

172174
if opts.fix {
173-
let printer = |file_name: &str| {
174-
ws.config().ui().print(Status::new("Fixing", file_name));
175-
};
176-
apply_fixes(&db, diagnostics, printer)?;
175+
let fixes = get_fixes(&db, diagnostics)?;
176+
for (file_id, fixes) in fixes.into_iter() {
177+
ws.config()
178+
.ui()
179+
.print(Status::new("Fixing", &file_id.file_name(db.upcast())));
180+
apply_file_fixes(file_id, fixes, &db)?;
181+
}
177182
}
178183
}
179184
}

0 commit comments

Comments
 (0)