@@ -15,26 +15,17 @@ use crate::output::lcov;
1515use anyhow:: { Context , Result } ;
1616use camino:: Utf8PathBuf ;
1717use rayon:: iter:: { IntoParallelIterator , ParallelIterator } ;
18- use scarb_metadata:: { Metadata , MetadataCommand } ;
1918
20- /// Run the core logic of `cairo-coverage` with the provided trace files and [`RunOptions`].
19+ /// Run the core logic of `cairo-coverage` with the provided trace files, project path and [`RunOptions`].
2120/// This function generates a coverage report in the LCOV format.
2221/// # Errors
2322/// Fails if it can't produce the coverage report with the error message explaining the reason.
2423#[ expect( clippy:: needless_pass_by_value) ] // In case if we ever needed to take ownership of the arguments.
2524pub fn run (
2625 trace_files : Vec < Utf8PathBuf > ,
27- RunOptions {
28- include,
29- project_path,
30- } : RunOptions ,
26+ project_path : Utf8PathBuf ,
27+ RunOptions { include } : RunOptions ,
3128) -> Result < String > {
32- let project_path = if let Some ( project_path) = project_path {
33- project_path
34- } else {
35- scarb_metadata ( ) ?. workspace . root
36- } ;
37-
3829 let ignore_matcher = ignore_matcher:: build ( & project_path) ?;
3930
4031 let coverage_data = execution_data:: load ( & trace_files) ?
@@ -59,12 +50,3 @@ pub fn run(
5950
6051 Ok ( lcov:: fmt_string ( & coverage_data) )
6152}
62-
63- /// Run `scarb metadata` command and return the metadata.
64- fn scarb_metadata ( ) -> Result < Metadata > {
65- MetadataCommand :: new ( )
66- . inherit_stderr ( )
67- . inherit_stdout ( )
68- . exec ( )
69- . context ( "could not gather project metadata from Scarb due to previous error" )
70- }
0 commit comments