Skip to content

Commit e6d801a

Browse files
committed
Remove multi argument
1 parent 9d2e9ac commit e6d801a

File tree

5 files changed

+10
-16
lines changed

5 files changed

+10
-16
lines changed

backend/src/maintainability.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -571,14 +571,14 @@ fn mi_rank(score: f64) -> char {
571571
}
572572

573573
/// Analyze source code and return MI metrics
574-
fn analyze_source(source: &str, multi: bool) -> Result<(f64, char), String> {
574+
fn analyze_source(source: &str) -> Result<(f64, char), String> {
575575
let parsed = parse_module(source).map_err(|e| e.to_string())?;
576576

577577
// Calculate raw metrics
578578
let raw = calculate_raw_metrics(source);
579579

580580
// Calculate comment percentage
581-
let comment_lines = raw.comments + if multi { raw.multi } else { 0 };
581+
let comment_lines = raw.comments + raw.multi;
582582
let comments_percent = if raw.sloc > 0 {
583583
(comment_lines as f64 / raw.sloc as f64) * 100.0
584584
} else {
@@ -608,26 +608,25 @@ fn analyze_source(source: &str, multi: bool) -> Result<(f64, char), String> {
608608
}
609609

610610
/// Public API for parallel module - returns (MI value, rank string).
611-
pub fn analyze_source_mi(source: &str, multi: bool) -> (f64, String) {
612-
match analyze_source(source, multi) {
611+
pub fn analyze_source_mi(source: &str) -> (f64, String) {
612+
match analyze_source(source) {
613613
Ok((mi, rank)) => (mi, rank.to_string()),
614614
Err(_) => (0.0, "C".to_string()),
615615
}
616616
}
617617

618618
#[pyfunction]
619-
#[pyo3(signature = (entries, multi=true))]
619+
#[pyo3(signature = (entries))]
620620
pub fn harvest_maintainability_metrics(
621621
py: Python<'_>,
622622
entries: Vec<(String, String)>,
623-
multi: bool,
624623
) -> PyResult<Vec<(String, Py<PyDict>)>> {
625624
let mut results = Vec::with_capacity(entries.len());
626625

627626
for (name, source) in entries {
628627
let dict = PyDict::new(py);
629628

630-
match analyze_source(&source, multi) {
629+
match analyze_source(&source) {
631630
Ok((mi, rank)) => {
632631
dict.set_item("mi", mi)?;
633632
dict.set_item("rank", rank.to_string())?;

backend/src/parallel.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,6 @@ fn analyze_file(
599599
include_cyclomatic: bool,
600600
include_halstead: bool,
601601
include_maintainability: bool,
602-
multi: bool,
603602
) -> FileAnalysisResult {
604603
let raw = if include_raw {
605604
Some(RawResult {
@@ -651,7 +650,7 @@ fn analyze_file(
651650
};
652651

653652
let maintainability = if include_maintainability {
654-
let (mi, rank) = maintainability::analyze_source_mi(source, multi);
653+
let (mi, rank) = maintainability::analyze_source_mi(source);
655654
Some(MaintainabilityResult {
656655
total: MaintainabilityTotal { mi, rank },
657656
})
@@ -686,18 +685,16 @@ fn analyze_file(
686685
/// # Arguments
687686
/// * `paths` - List of file paths to analyze
688687
/// * `operators` - List of operator names to run ("raw", "cyclomatic", "halstead", "maintainability")
689-
/// * `multi` - Whether to include multi-line strings in MI calculation
690688
///
691689
/// # Returns
692690
/// A dictionary mapping file paths (and directory paths) to their analysis results.
693691
/// Directory paths contain aggregated metrics from all files within them.
694692
#[pyfunction]
695-
#[pyo3(signature = (paths, operators, multi=true))]
693+
#[pyo3(signature = (paths, operators))]
696694
pub fn analyze_files_parallel<'py>(
697695
py: Python<'py>,
698696
paths: Vec<String>,
699697
operators: Vec<String>,
700-
multi: bool,
701698
) -> PyResult<Bound<'py, PyDict>> {
702699
let include_raw = operators.iter().any(|o| o == "raw");
703700
let include_cyclomatic = operators.iter().any(|o| o == "cyclomatic");
@@ -732,7 +729,6 @@ pub fn analyze_files_parallel<'py>(
732729
include_cyclomatic,
733730
include_halstead,
734731
include_maintainability,
735-
multi,
736732
);
737733

738734
(path.clone(), result)

backend/src/storage.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1305,7 +1305,7 @@ impl WilyIndex {
13051305
};
13061306

13071307
let mi = if include_maintainability {
1308-
let (mi_val, rank) = maintainability::analyze_source_mi(&content, true);
1308+
let (mi_val, rank) = maintainability::analyze_source_mi(&content);
13091309
Some((mi_val, rank))
13101310
} else {
13111311
None

src/wily/backend.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ def iter_filenames(targets: list[str], include_ipynb: bool = False) -> list[str]
2828
def analyze_files_parallel(
2929
paths: list[str],
3030
operators: list[str],
31-
multi: bool = False,
3231
) -> dict[str, dict[str, Any]]:
3332
"""Analyze files in parallel using Rust/rayon."""
3433
...

src/wily/commands/build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def run_operators_parallel(
8686

8787
# Run all operators in parallel on all files using Rust/rayon
8888
# This also computes directory-level aggregates
89-
parallel_results = analyze_files_parallel(file_paths, operator_names, multi=True)
89+
parallel_results = analyze_files_parallel(file_paths, operator_names)
9090

9191
# Transform results into the expected format per operator
9292
results: dict[str, dict[str, Any]] = {name: {} for name in operator_names}

0 commit comments

Comments
 (0)