pkgrisk 0.1.0

5-second package health and risk analysis for npm, PyPI and crates.io dependencies
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::ecosystems::PackageMetadata;
use crate::scoring::HealthScore;
use serde_json::json;

pub fn print(metadata: &PackageMetadata, score: &HealthScore) {
    let output = json!({
        "name": metadata.name,
        "version": metadata.version,
        "score": score.total,
        "categories": score
    });

    println!("{}", serde_json::to_string_pretty(&output).unwrap());
}