Search documentation of Metastatic

# API Reference Metastatic v#0.13.2

View Source

## Modules

Metastatic

Metastatic - Cross-language code analysis via unified MetaAST.

Metastatic.AST

M2: Meta-Model for Programming Language Abstract Syntax.

Metastatic.Adapter

Behaviour for language adapters (M1 ↔ M2 transformations).

Metastatic.Adapter.Registry

Registry for language adapters.

Metastatic.Adapters.Elixir

Elixir language adapter for MetaAST transformations.

Metastatic.Adapters.Elixir.FromMeta

Transform MetaAST (M2) back to Elixir AST (M1).

Metastatic.Adapters.Elixir.ToMeta

Transform Elixir AST (M1) to MetaAST (M2).

Metastatic.Adapters.Erlang

Erlang language adapter for MetaAST transformations.

Metastatic.Adapters.Erlang.FromMeta

Transform MetaAST (M2) back to Erlang AST (M1).

Metastatic.Adapters.Erlang.ToMeta

Transform Erlang AST (M1) to MetaAST (M2).

Metastatic.Adapters.Haskell

Haskell language adapter for Metastatic.

Metastatic.Adapters.Haskell.FromMeta

Transform MetaAST (M2) back to Haskell AST (M1).

Metastatic.Adapters.Haskell.Subprocess

Manages subprocess communication with the Haskell parser.

Metastatic.Adapters.Haskell.ToMeta

Transform Haskell AST (M1) to MetaAST (M2).

Metastatic.Adapters.Python

Python language adapter for MetaAST transformations.

Metastatic.Adapters.Python.FromMeta

Transform MetaAST (M2) back to Python AST (M1).

Metastatic.Adapters.Python.Subprocess

Subprocess management for Python parser and unparser.

Metastatic.Adapters.Python.ToMeta

Transform Python AST (M1) to MetaAST (M2).

Metastatic.Adapters.Ruby

Ruby language adapter for MetaAST transformations.

Metastatic.Adapters.Ruby.FromMeta

Transform MetaAST (M2) back to Ruby AST (M1).

Metastatic.Adapters.Ruby.Subprocess

Subprocess management for Ruby parser and unparser.

Metastatic.Adapters.Ruby.ToMeta

Transform Ruby AST (M1) to MetaAST (M2).

Metastatic.Analysis.Analyzer

Behaviour for MetaAST analyzers and refactoring suggestions.

Metastatic.Analysis.ApiSurface

API surface analysis for containers (modules/classes).

Metastatic.Analysis.BusinessLogic.BlockingInPlug

Detects blocking operations in request handling middleware.

Metastatic.Analysis.BusinessLogic.CallbackHell

Detects deeply nested conditional statements (callback hell pattern).

Metastatic.Analysis.BusinessLogic.DirectStructUpdate

Detects direct object/struct updates bypassing validation.

Metastatic.Analysis.BusinessLogic.HardcodedValue

Detects hardcoded URLs, IP addresses, and other sensitive values in string literals.

Metastatic.Analysis.BusinessLogic.ImproperInputValidation

Detects improper input validation patterns (CWE-20).

Metastatic.Analysis.BusinessLogic.IncorrectAuthorization

Detects incorrect authorization patterns (CWE-863).

Metastatic.Analysis.BusinessLogic.InefficientFilter

Detects inefficient filtering: fetching all data then filtering in memory.

Metastatic.Analysis.BusinessLogic.InlineJavascript

Detects inline executable code in templates/strings (XSS/injection risk).

Metastatic.Analysis.BusinessLogic.InsecureDirectObjectReference

Detects Insecure Direct Object Reference (IDOR) vulnerabilities (CWE-639).

Metastatic.Analysis.BusinessLogic.MissingAuthentication

Detects critical functions without authentication checks (CWE-306).

Metastatic.Analysis.BusinessLogic.MissingAuthorization

Detects sensitive operations without authorization checks (CWE-862).

Metastatic.Analysis.BusinessLogic.MissingCSRFProtection

Detects state-changing endpoints without CSRF protection (CWE-352).

Metastatic.Analysis.BusinessLogic.MissingErrorHandling

Detects pattern matching on success cases without error handling.

Metastatic.Analysis.BusinessLogic.MissingHandleAsync

Detects missing async error handling (fire-and-forget without supervision).

Metastatic.Analysis.BusinessLogic.MissingPreload

Detects database queries without eager loading (N+1 query potential).

Metastatic.Analysis.BusinessLogic.MissingTelemetryForExternalHttp

Detects external HTTP requests without telemetry instrumentation.

Metastatic.Analysis.BusinessLogic.MissingTelemetryInAuthPlug

Detects authentication/authorization code without telemetry.

Metastatic.Analysis.BusinessLogic.MissingTelemetryInLiveviewMount

Detects component initialization/mounting without telemetry.

Metastatic.Analysis.BusinessLogic.MissingTelemetryInObanWorker

Detects background job processing without telemetry.

Metastatic.Analysis.BusinessLogic.MissingThrottle

Detects expensive operations without rate limiting or throttling.

Metastatic.Analysis.BusinessLogic.NPlusOneQuery

Detects N+1 query anti-pattern across all ORM frameworks.

Metastatic.Analysis.BusinessLogic.PathTraversal

Detects potential Path Traversal vulnerabilities (CWE-22).

Metastatic.Analysis.BusinessLogic.SQLInjection

Detects potential SQL injection vulnerabilities (CWE-89).

Metastatic.Analysis.BusinessLogic.SSRFVulnerability

Detects potential Server-Side Request Forgery (SSRF) vulnerabilities (CWE-918).

Metastatic.Analysis.BusinessLogic.SensitiveDataExposure

Detects exposure of sensitive information to unauthorized actors (CWE-200).

Metastatic.Analysis.BusinessLogic.SilentErrorCase

Detects conditional statements that only handle the success case.

Metastatic.Analysis.BusinessLogic.SwallowingException

Detects exception handling that swallows exceptions without logging or re-raising.

Metastatic.Analysis.BusinessLogic.SyncOverAsync

Detects blocking synchronous operations used where async alternatives exist.

Metastatic.Analysis.BusinessLogic.TOCTOU

Detects Time-of-Check-Time-of-Use (TOCTOU) race condition vulnerabilities.

Metastatic.Analysis.BusinessLogic.TelemetryInRecursiveFunction

Detects telemetry/metrics emissions inside recursive functions.

Metastatic.Analysis.BusinessLogic.UnmanagedTask

Detects unsupervised async operations that can cause memory leaks.

Metastatic.Analysis.BusinessLogic.UnrestrictedFileUpload

Detects unrestricted file upload vulnerabilities (CWE-434).

Metastatic.Analysis.BusinessLogic.XSSVulnerability

Detects potential Cross-Site Scripting (XSS) vulnerabilities (CWE-79).

Metastatic.Analysis.Cohesion

Cohesion analysis for containers (modules/classes).

Metastatic.Analysis.Cohesion.Formatter

Formatters for cohesion analysis results.

Metastatic.Analysis.Cohesion.Result

Result structure for cohesion analysis.

Metastatic.Analysis.Complexity

Code complexity analysis at the MetaAST level.

Metastatic.Analysis.Complexity.Cognitive

Cognitive complexity calculation.

Metastatic.Analysis.Complexity.Cyclomatic

Cyclomatic complexity calculation (McCabe metric).

Metastatic.Analysis.Complexity.Formatter

Formats complexity analysis results for different output formats.

Metastatic.Analysis.Complexity.FunctionMetrics

Function-level complexity metrics.

Metastatic.Analysis.Complexity.Halstead

Halstead complexity metrics calculation.

Metastatic.Analysis.Complexity.LoC

Lines of Code (LoC) metrics calculation.

Metastatic.Analysis.Complexity.Nesting

Maximum nesting depth calculation.

Metastatic.Analysis.Complexity.Result

Result structure for complexity analysis.

Metastatic.Analysis.ControlFlow

Control flow graph construction at the MetaAST level.

Metastatic.Analysis.ControlFlow.Result

Result structure for control flow graph analysis.

Metastatic.Analysis.Coupling

Coupling analysis for containers (modules/classes).

Metastatic.Analysis.DeadCode

Dead code detection at the MetaAST level.

Metastatic.Analysis.DeadCode.Result

Result structure for dead code analysis.

Metastatic.Analysis.DeadCodeAnalyzer

Plugin analyzer wrapper for dead code detection.

Metastatic.Analysis.Duplication

Code duplication detection at the MetaAST level.

Metastatic.Analysis.Duplication.Fingerprint

Structural fingerprinting for ASTs.

Metastatic.Analysis.Duplication.Reporter

Reporting and formatting for code duplication detection results.

Metastatic.Analysis.Duplication.Result

Result struct for code duplication detection analysis.

Metastatic.Analysis.Duplication.Similarity

Similarity calculation between ASTs for Type III clone detection.

Metastatic.Analysis.Duplication.Types

Clone type definitions for code duplication detection.

Metastatic.Analysis.Encapsulation

Encapsulation analysis for containers (modules/classes).

Metastatic.Analysis.Encapsulation.Formatter

Formatters for encapsulation analysis results.

Metastatic.Analysis.Encapsulation.Result

Result structure for encapsulation analysis.

Metastatic.Analysis.NestingDepth

Detects excessive nesting depth in code.

Metastatic.Analysis.Purity

Function purity analysis at the MetaAST level.

Metastatic.Analysis.Purity.Effects

Detects side effects in MetaAST nodes.

Metastatic.Analysis.Purity.Formatter

Formats purity analysis results for display.

Metastatic.Analysis.Purity.Result

Result structure for purity analysis.

Metastatic.Analysis.Registry

Registry for analyzer plugins.

Metastatic.Analysis.Runner

Executes multiple analyzers on a Document in a single pass.

Metastatic.Analysis.Security

Security vulnerability detection at the MetaAST level.

Metastatic.Analysis.Security.Result

Result structure for security vulnerability detection.

Metastatic.Analysis.SimplifyConditional

Suggests simplification of redundant conditionals.

Metastatic.Analysis.Smells

Code smell detection at the MetaAST level.

Metastatic.Analysis.Smells.Result

Result structure for code smell detection.

Metastatic.Analysis.StateManagement

State management analysis for containers (modules/classes).

Metastatic.Analysis.StateManagement.Formatter

Formatters for state management analysis results.

Metastatic.Analysis.StateManagement.Result

Result structure for state management analysis.

Metastatic.Analysis.Taint

Taint analysis at the MetaAST level.

Metastatic.Analysis.Taint.Result

Result structure for taint analysis.

Metastatic.Analysis.UnusedVariables

Unused variable detection at the MetaAST level.

Metastatic.Analysis.UnusedVariables.Result

Result structure for unused variable analysis.

Metastatic.Builder

High-level API for building MetaAST documents from source code.

Metastatic.CLI

Shared utilities for Metastatic CLI commands.

Metastatic.CLI.Formatter

Output formatting utilities for Metastatic CLI.

Metastatic.CLI.Inspector

AST inspection and analysis logic for Metastatic CLI.

Metastatic.CLI.Translator

Cross-language translation orchestration for Metastatic CLI.

Metastatic.Document

A MetaAST Document wraps an M2 AST with metadata and language information.

Metastatic.Semantic.Domains.Auth

Authentication and authorization operation patterns for semantic enrichment.

Metastatic.Semantic.Domains.Cache

Cache operation patterns for semantic enrichment.

Metastatic.Semantic.Domains.Database

Database operation patterns for semantic enrichment.

Metastatic.Semantic.Domains.ExternalApi

External API operation patterns for semantic enrichment.

Metastatic.Semantic.Domains.File

File I/O operation patterns for semantic enrichment.

Metastatic.Semantic.Domains.Http

HTTP client operation patterns for semantic enrichment.

Metastatic.Semantic.Domains.Queue

Message queue operation patterns for semantic enrichment.

Metastatic.Semantic.Enricher

AST enricher for semantic metadata injection.

Metastatic.Semantic.OpKind

Semantic operation kind metadata for MetaAST nodes.

Metastatic.Semantic.Patterns

Language-aware pattern registry for semantic enrichment.

Metastatic.Supplemental

Behaviour for supplemental modules that extend language adapter capabilities.

Metastatic.Supplemental.CompatibilityMatrix

Provides a compatibility matrix showing which supplemental modules support which constructs for each language.

Metastatic.Supplemental.Error

Error types for supplemental module system.

Metastatic.Supplemental.Error.ConflictError

Raised when multiple supplementals attempt to handle the same construct.

Metastatic.Supplemental.Error.IncompatibleSupplementalError

Raised when a supplemental module's dependencies are incompatible.

Metastatic.Supplemental.Error.MissingSupplementalError

Raised when a required supplemental module is not registered.

Metastatic.Supplemental.Error.UnsupportedConstructError

Raised when a MetaAST construct has no transformation path.

Metastatic.Supplemental.Info

Metadata structure for supplemental modules.

Metastatic.Supplemental.Python.Asyncio

Supplemental module for Python's `asyncio` library.

Metastatic.Supplemental.Python.Pykka

Pykka actor library supplemental for Python.

Metastatic.Supplemental.Registry

Registry for supplemental modules.

Metastatic.Supplemental.Transformer

Helper module for transforming MetaAST using registered supplementals.

Metastatic.Supplemental.Validator

Validates supplemental module availability and compatibility.

Metastatic.Test.AdapterHelper

Testing utilities for language adapters (M1 ↔ M2 transformations).

Metastatic.Test.FixtureHelper

Helper utilities for loading and managing test fixtures.

Metastatic.Validator

Conformance validation for MetaAST.

## Mix Tasks

mix metastatic.analyze

Analyze MetaAST structure and provide detailed metrics.

mix metastatic.code_smells

Detects code smells in a given source file.

mix metastatic.complexity

Analyzes code complexity for a given file.

mix metastatic.control_flow

Generates a control flow graph (CFG) for a given source file.

mix metastatic.dead_code

Detects dead code in a given file.

mix metastatic.detect_duplicates

Detects code duplication across source files using the unified MetaAST representation.

mix metastatic.gen.supplemental

Generates a new supplemental module scaffold.

mix metastatic.inspect

Inspect the MetaAST structure of source code files.

mix metastatic.purity_check

Analyzes code purity for a given file.

mix metastatic.security_scan

Scans source code for security vulnerabilities using pattern-based detection.

mix metastatic.supplemental_check

Analyzes code to detect required supplemental modules.

mix metastatic.taint_check

Performs taint analysis to track data flow from untrusted sources to sensitive operations.

mix metastatic.translate

Translate source code from one programming language to another using MetaAST.

mix metastatic.unused_vars

Detects unused variables in a given file.

mix metastatic.validate_equivalence

Validate that two source files have semantically equivalent MetaAST representations.