Skip to main content

Move 项目索引与函数调用图分析的轻量 Python 库

Project description

Move FCG Analyzer

一个用于分析 Move 项目的静态分析工具,支持函数调用图(Function Call Graph)分析,可以提取函数信息、调用关系、参数等。

功能

  • 提取函数签名、参数、返回类型
  • 提取函数源代码和位置信息
  • 准确提取函数调用关系(calls)
  • 支持模块限定的函数查询
  • 输出标准 JSON 格式
  • 跨平台支持(macOS ARM64、Linux x86_64)

安装

从 PyPI 安装(推荐)

pip install move-fcg-analyzer

从源码构建

1. 安装依赖

npm install

2. 构建 TypeScript Indexer

npm run build:indexer

3. 构建平台特定的 wheel 包

macOS (ARM64):

./build-scripts/build-macos.sh

Linux (x86_64):

./build-scripts/build-linux.sh

生成的 wheel 文件将保存在 dist/ 目录中。

使用

Python API

from move_fcg_analyzer import MoveFunctionAnalyzer

analyzer = MoveFunctionAnalyzer()
result = analyzer.analyze_raw("./project_path", "function_name")

# result 包含 contract, function, source, location, parameter, calls 等字段
print(result["calls"])  # 查看函数调用关系

命令行

python3 -m move_fcg_analyzer <project_path> <function_name>

示例:

python3 -m move_fcg_analyzer ./test/caas-framework grant_read_authorization

输出格式

{
  "contract": "module_name",
  "function": "function_signature",
  "source": "function_source_code",
  "location": {
    "file": "/path/to/file.move",
    "start_line": 134,
    "end_line": 204
  },
  "parameter": [
    {"name": "param_name", "type": "param_type"}
  ],
  "calls": [
    {
      "file": "/path/to/called/function.move",
      "function": "called_function_name",
      "module": "called_module_name"
    }
  ]
}

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

move_fcg_analyzer-1.1.0-py3-none-manylinux_2_28_x86_64.whl (21.7 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

move_fcg_analyzer-1.1.0-py3-none-macosx_10_9_arm64.whl (38.0 MB view details)

Uploaded Python 3macOS 10.9+ ARM64

File details

Details for the file move_fcg_analyzer-1.1.0-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for move_fcg_analyzer-1.1.0-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8b51c1cfbafd3c9d8f438fa8f05f0cd26c8e98de10330043759795f95b5e9851
MD5 a381320f48072b8845c5fed7ee3a5bba
BLAKE2b-256 38ea997a00052c104ac01937541f33cb4410ec1997dce7e773c18f29913e2190

See more details on using hashes here.

File details

Details for the file move_fcg_analyzer-1.1.0-py3-none-macosx_10_9_arm64.whl.

File metadata

File hashes

Hashes for move_fcg_analyzer-1.1.0-py3-none-macosx_10_9_arm64.whl
Algorithm Hash digest
SHA256 3162d989787d9a0404da62fa01a4bffe80d033dd8d024bd0b0df43aaffef3d05
MD5 1dc9cf79741562762c94d5eff4f175ab
BLAKE2b-256 1d0470831317db194e4a9bfbe8710697b1c9f9afc3f96294c3dc5ac32a7dc3f5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page