codeinventory

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package codeinventory is a deterministic, pure-Go code-size inventory: it walks a source tree, classifies each file's language with go-enry, and counts code / comment / blank lines per language, plus functions where a first-party parser exists (Go today, via go/parser). It NEVER executes the target and reads bounded (skips vendored/binary/generated/oversized files, follows no symlinks), mirroring the go-enry and SAST library adapters. It is the Phase-0 producer of the code-quality capability; accurate multi-language function/complexity counting arrives with the AST phase.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Analyzer

type Analyzer struct {
	// contains filtered or unexported fields
}

Analyzer is the pure-Go code-inventory adapter. An optional ASTProvider (the synapse-ast sidecar) supplies accurate function counts for the non-Go languages it supports; without it, only Go function counts are known.

func New

func New(opts ...Option) *Analyzer

New returns a new analyzer with the given options.

func (*Analyzer) Inventory

func (a *Analyzer) Inventory(ctx context.Context, root string) (measure.Inventory, error)

Inventory walks root and returns a per-language code-size inventory. It honors ctx cancellation and never aborts the whole walk on a single unreadable file.

type Option

type Option func(*Analyzer)

Option configures an Analyzer.

func WithASTProvider

func WithASTProvider(p ports.ASTProvider) Option

WithASTProvider wires an ASTProvider so function counts are filled for the languages it parses. A nil provider is ignored (the analyzer stays pure-Go, Go-only function counts).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL