Skip to documentation
SLOP

tiny.smg.analysis

Reference tiny.smg analysis

Defined in tiny.smg.

API (8)

Actions

Public operations.

Types and contracts

Public types and contracts.

Namespaces

Public namespaces.

No direct callersNo direct callstiny.smganalysis
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Source: tools/smg/src/analysis/report.zig:15

zig
pub const DeltaFilter = struct {    git_ref: []const u8,    names: []const []const u8,};

Source: tools/smg/src/analysis/overview.zig:12

zig
pub fn overview(allocator: std.mem.Allocator, graph: graph_mod.Graph, top: i64, json: bool) ![]const u8 {    const connected = try connectedRows(allocator, graph);    const modules = try moduleRows(allocator, graph);    const connected_display = paging.sliceEnd(connected.len, top);    const module_display = paging.sliceEnd(modules.len, top);    if (json) {        var out: std.Io.Writer.Allocating = .init(allocator);        errdefer out.deinit();        var writer = pretty_json.Writer.init(&out.writer, .minified);        try writer.beginObject();        try writer.objectField("nodes");        try writer.write(graph.nodes.items.len);        try writer.objectField("edges");        try writer.write(graph.edges.items.len);        try writer.objectField("top_connected_basis");        try writer.write("architecture_coupling");        try writer.objectField("top_connected");        try writer.beginArray();        for (connected[0..connected_display]) |entry| {            try writer.beginObject();            try writer.objectField("name");            try writer.write(entry.name);            try writer.objectField("type");            try writer.write(entry.type);            try writer.objectField("incoming");            try writer.write(entry.incoming);            try writer.objectField("outgoing");            try writer.write(entry.outgoing);            try writer.objectField("total");            try writer.write(entry.total);            try writer.endObject();        }        try writer.endArray();        try writer.objectField("modules");        try writer.beginArray();        for (modules) |entry| {            try writer.beginObject();            try writer.objectField("name");            try writer.write(entry.name);            try writer.objectField("type");            try writer.write(entry.type);            try writer.objectField("children");            try writer.write(entry.children);            try writer.endObject();        }        try writer.endArray();        try writer.objectField("modules_basis");        try writer.write("direct_declarations");        try writer.endObject();        try out.writer.writeByte('\n');        return try out.toOwnedSlice();    }    var out: std.Io.Writer.Allocating = .init(allocator);    errdefer out.deinit();    try out.writer.print("Full graph: {d} nodes, {d} edges\n\n", .{ graph.nodes.items.len, graph.edges.items.len });    try out.writer.print("Architecture Coupling (top {d})\n", .{top});    try writeConnectedTable(allocator, &out.writer, connected[0..connected_display]);    if (module_display != 0) {        try out.writer.writeByte('\n');        try out.writer.print("Modules by Direct Declarations (top {d})\n", .{top});        try writeModuleTable(allocator, &out.writer, modules[0..module_display], modules.len, top);    }    return try out.toOwnedSlice();}
Called byCallstest; no linktools.smg.src.analysis.overviewtest: overview matches python compact...test; no linktools.smg.src.analysis.overviewtest: overview separates architecture...private; no linktools.smg.src.analysis.overviewconnectedRowsprivate; no linktools.smg.src.analysis.overviewmoduleRowsprivate; no linktools.smg.src.analysis.overviewwriteConnectedTableprivate; no linktools.smg.src.analysis.overviewwriteModuleTableanalysis.pagingsliceEndanalysisoverview
Static calls · unresolved targets: 2 · external targets: 11.

Source: tools/smg/src/analysis/report.zig:121

zig
pub fn analyze(allocator: std.mem.Allocator, graph: graph_mod.Graph, summary: bool, json: bool, top: i64, full: bool, scope_label: ?[]const u8, concept_analysis: ?concepts_mod.Analysis, root: ?[]const u8, churn_days: i64, include_betweenness: bool, delta_filter: ?DeltaFilter, limits: smg.AnalysisLimits) ![]const u8 {    const include_full_metrics = !summary;    if (json) return try analyzeJson(allocator, graph, top, !full, include_full_metrics, concept_analysis, root, churn_days, include_betweenness, delta_filter, limits);    return try analyzeText(allocator, graph, top, !full, !summary, scope_label, concept_analysis, root, churn_days, include_betweenness, delta_filter, limits);}
Called byCallstest; no linktools.smg.src.analysis.reporttest: analyze json full module graph ...test; no linktools.smg.src.analysis.reporttest: analyze json full path graph ma...test; no linktools.smg.src.analysis.reporttest: analyze json summary full skips...test; no linktools.smg.src.analysis.reporttest: analyze reports code smells lik...test; no linktools.smg.src.analysis.reporttest: analyze reports stable dependen...+5 moreprivate; no linktools.smg.src.analysis.reportanalyzeJsonprivate; no linktools.smg.src.analysis.reportanalyzeTextanalysisanalyze
Static calls · unresolved targets: 0 · external targets: 0.

Source: tools/smg/src/analysis/report.zig:2041

zig
pub fn classMetricValue(allocator: std.mem.Allocator, graph: graph_mod.Graph, class_name: []const u8, metric_name: []const u8) !?f64 {    const metrics = try classMetrics(allocator, graph, true);    for (metrics) |metric| {        if (!std.mem.eql(u8, metric.name, class_name)) continue;        if (std.mem.eql(u8, metric_name, "wmc")) return @floatFromInt(metric.wmc);        if (std.mem.eql(u8, metric_name, "cbo")) return @floatFromInt(metric.cbo);        if (std.mem.eql(u8, metric_name, "rfc")) return @floatFromInt(metric.rfc);        if (std.mem.eql(u8, metric_name, "lcom4")) return @floatFromInt(metric.lcom4);        if (std.mem.eql(u8, metric_name, "dit")) return @floatFromInt(metric.dit);        if (std.mem.eql(u8, metric_name, "noc")) return @floatFromInt(metric.noc);        if (std.mem.eql(u8, metric_name, "max_method_cc")) return @floatFromInt(metric.max_method_cc);        return null;    }    return null;}
Called byCallsNo direct callersprivate; no linktools.smg.src.analysis.reportclassMetricsanalysisclassMetricValue
Static calls · unresolved targets: 0 · external targets: 0.

Source: tools/smg/src/analysis/report.zig:2057

zig
pub fn moduleMetricValue(allocator: std.mem.Allocator, graph: graph_mod.Graph, module_name: []const u8, metric_name: []const u8) !?f64 {    const metrics = try martinMetrics(allocator, graph);    const metric = moduleMetricFor(metrics, module_name) orelse return null;    if (std.mem.eql(u8, metric_name, "instability")) return metric.instability;    if (std.mem.eql(u8, metric_name, "abstractness")) return metric.abstractness;    if (std.mem.eql(u8, metric_name, "distance")) return metric.distance;    return null;}
Called byCallsNo direct callersprivate; no linktools.smg.src.analysis.reportmartinMetricsprivate; no linktools.smg.src.analysis.reportmoduleMetricForanalysismoduleMetricValue
Static calls · unresolved targets: 0 · external targets: 0.

Source: tools/smg/src/analysis/report.zig:2086

zig
pub fn totalMetricBool(allocator: std.mem.Allocator, graph: graph_mod.Graph, name: []const u8, metric_name: []const u8) !?bool {    if (std.mem.eql(u8, metric_name, "dead")) return containsString(try deadCodeRows(allocator, graph), name);    if (std.mem.eql(u8, metric_name, "in_cycle")) {        for (try findCycles(allocator, graph)) |cycle| {            if (containsString(cycle, name)) return true;        }        return false;    }    return null;}
Called byCallsNo direct callersprivate; no linktools.smg.src.analysis.reportcontainsStringprivate; no linktools.smg.src.analysis.reportdeadCodeRowsprivate; no linktools.smg.src.analysis.reportfindCyclesanalysistotalMetricBool
Static calls · unresolved targets: 0 · external targets: 0.

Source: tools/smg/src/analysis/report.zig:2066

zig
pub fn totalMetricValue(allocator: std.mem.Allocator, graph: graph_mod.Graph, name: []const u8, metric_name: []const u8, limits: smg.AnalysisLimits) !?f64 {    if (std.mem.eql(u8, metric_name, "fan_in") or std.mem.eql(u8, metric_name, "fan_out")) {        const rows = try fanRows(allocator, graph);        for (rows) |row| {            if (!std.mem.eql(u8, row.name, name)) continue;            return @floatFromInt(if (std.mem.eql(u8, metric_name, "fan_in")) row.fan_in else row.fan_out);        }        return 0;    }    if (std.mem.eql(u8, metric_name, "layer")) return @floatFromInt(layerValue(try topologicalLayers(allocator, graph), name) orelse 0);    if (std.mem.eql(u8, metric_name, "pagerank")) return rankedValue(try pagerankRows(allocator, graph), name) orelse 0;    if (std.mem.eql(u8, metric_name, "betweenness")) return rankedValue(try betweennessRows(allocator, graph, false, limits), name) orelse 0;    if (std.mem.eql(u8, metric_name, "kcore")) {        const rows = try kcoreRows(allocator, graph);        for (rows) |row| if (std.mem.eql(u8, row.name, name)) return @floatFromInt(row.value);        return 0;    }    return null;}
Called byCallsNo direct callersprivate; no linktools.smg.src.analysis.reportbetweennessRowsprivate; no linktools.smg.src.analysis.reportfanRowsprivate; no linktools.smg.src.analysis.reportkcoreRowsprivate; no linktools.smg.src.analysis.reportlayerValueprivate; no linktools.smg.src.analysis.reportpagerankRows+2 moreanalysistotalMetricValue
Static calls · unresolved targets: 0 · external targets: 0.

Source: tools/smg/src/analysis/root.zig

zig
const overview_mod = @import("overview.zig");const report = @import("report.zig");pub const paging = @import("paging.zig");pub const DeltaFilter = report.DeltaFilter;pub const analyze = report.analyze;pub const classMetricValue = report.classMetricValue;pub const moduleMetricValue = report.moduleMetricValue;pub const overview = overview_mod.overview;pub const totalMetricBool = report.totalMetricBool;pub const totalMetricValue = report.totalMetricValue;

Source: tools/smg/src/root.zig:9

zig
pub const analysis = @import("analysis/root.zig");

Complete caller list for analysis.analyze

10 direct callers.

Complete call list for analysis.totalMetricValue

7 direct calls.

Audit

Definitions8
Public names8
Members2
Version26.7.0
Revisiondaab053ee433