graph

package
v0.0.0-...-35f3cf1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2025 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnableVerboseLogging

func EnableVerboseLogging()

EnableVerboseLogging enables verbose logging mode.

func Fmt

func Fmt(format string, args ...interface{})

Fmt prints formatted output if verbose logging is enabled.

func FormatType

func FormatType(v interface{}) string

FormatType formats various types to string representation.

func GenerateMethodID

func GenerateMethodID(methodName string, parameters []string, sourceFile string) string

GenerateMethodID generates a unique SHA256 hash ID for a method.

func GenerateSha256

func GenerateSha256(input string) string

GenerateSha256 generates a SHA256 hash from an input string.

func IsGitHubActions

func IsGitHubActions() bool

IsGitHubActions checks if running in GitHub Actions environment.

func Log

func Log(message string, args ...interface{})

Log logs a message if verbose logging is enabled.

Types

type CodeGraph

type CodeGraph struct {
	Nodes map[string]*Node
	Edges []*Edge
}

CodeGraph represents the entire code graph with nodes and edges.

func Initialize

func Initialize(directory string) *CodeGraph

Initialize initializes the code graph by parsing all source files in a directory.

func NewCodeGraph

func NewCodeGraph() *CodeGraph

NewCodeGraph creates and initializes a new CodeGraph instance.

func (*CodeGraph) AddEdge

func (g *CodeGraph) AddEdge(from, to *Node)

AddEdge adds an edge between two nodes in the code graph.

func (*CodeGraph) AddNode

func (g *CodeGraph) AddNode(node *Node)

AddNode adds a node to the code graph.

func (*CodeGraph) FindNodesByType

func (g *CodeGraph) FindNodesByType(nodeType string) []*Node

FindNodesByType finds all nodes of a given type.

type Edge

type Edge struct {
	From *Node
	To   *Node
}

Edge represents a directed edge between two nodes in the code graph.

type Node

type Node struct {
	ID                   string
	Type                 string
	Name                 string
	CodeSnippet          string // DEPRECATED: Will be removed, use GetCodeSnippet() instead
	SourceLocation       *SourceLocation
	LineNumber           uint32
	OutgoingEdges        []*Edge
	IsExternal           bool
	Modifier             string
	ReturnType           string
	MethodArgumentsType  []string
	MethodArgumentsValue []string
	PackageName          string
	ImportPackage        []string
	SuperClass           string
	Interface            []string
	DataType             string
	Scope                string
	VariableValue        string

	File string

	ThrowsExceptions  []string
	Annotation        []string
	JavaDoc           *model.Javadoc
	BinaryExpr        *model.BinaryExpr
	ClassInstanceExpr *model.ClassInstanceExpr
	IfStmt            *model.IfStmt
	WhileStmt         *model.WhileStmt
	DoStmt            *model.DoStmt
	ForStmt           *model.ForStmt
	BreakStmt         *model.BreakStmt
	ContinueStmt      *model.ContinueStmt
	YieldStmt         *model.YieldStmt
	AssertStmt        *model.AssertStmt
	ReturnStmt        *model.ReturnStmt
	BlockStmt         *model.BlockStmt
	// contains filtered or unexported fields
}

Node represents a node in the code graph with various properties describing code elements like classes, methods, variables, etc.

func (*Node) GetCodeSnippet

func (n *Node) GetCodeSnippet() string

GetCodeSnippet returns the code snippet for this node. If SourceLocation is set, it reads from the file (lazy loading). Otherwise, it returns the deprecated CodeSnippet field for backward compatibility.

type SourceLocation

type SourceLocation struct {
	File      string
	StartByte uint32
	EndByte   uint32
}

SourceLocation stores the file location of a code snippet for lazy loading.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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