shared

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package shared provides common utilities for analyzer implementations. This package is separate from the main analyzer package to avoid import cycles when subdirectory packages need these utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountLines

func CountLines(content []byte) int

CountLines counts lines in source content.

func IsTestFileByPath

func IsTestFileByPath(path string) bool

IsTestFileByPath checks if a file path indicates a Python test file. Used by C6 testing analyzer.

func NodeText

func NodeText(node *tree_sitter.Node, content []byte) string

NodeText extracts the text content of a Tree-sitter node.

func TsIsTestFile

func TsIsTestFile(path string) bool

TsIsTestFile checks if a TypeScript file path indicates a test file. Used by C6 testing analyzer.

func TsStripQuotes

func TsStripQuotes(s string) string

TsStripQuotes removes surrounding quotes from a string literal. Used by C6 testing analyzer.

func WalkTree

func WalkTree(node *tree_sitter.Node, fn func(*tree_sitter.Node))

WalkTree walks a Tree-sitter tree depth-first, calling fn for each node.

Types

type ImportGraph

type ImportGraph struct {
	Forward map[string][]string // package -> packages it imports (efferent)
	Reverse map[string][]string // package -> packages that import it (afferent)
}

ImportGraph holds forward and reverse adjacency lists for intra-module imports.

func BuildImportGraph

func BuildImportGraph(pkgs []*parser.ParsedPackage, modulePath string) *ImportGraph

BuildImportGraph constructs an import graph from parsed packages, filtering to only intra-module imports (those with the given module path prefix).

Jump to

Keyboard shortcuts

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