# 使用 Homebrew, apt, Nix, zypper 安装 gnu-complexity

查看 gnu-complexity 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

```sh
sudo av install brew:gnu-complexity
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install gnu-complexity
```

  证据: local Homebrew formula metadata

### Linux

- Debian apt (92%):

```sh
sudo apt install complexity
```

  证据: Debian stable package indexes: complexity from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

- Nix (92%):

```sh
nix profile install nixpkgs#complexity
```

  证据: nixpkgs package indexes: pkgs/by-name/co/complexity/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

- zypper (92%):

```sh
sudo zypper install complexity
```

  证据: openSUSE Tumbleweed package metadata: complexity from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst

## 软件包事实

- **软件包键:** brew:gnu-complexity
- **软件包管理器:** Homebrew
- **软件包管理器页面:** <https://formulae.brew.sh/formula/gnu-complexity>
- **版本:** 1.13
- **来源摘要:** Measures complexity of C source
- **主页:** <https://www.gnu.org/software/complexity/>
- **上游文档:** <https://www.gnu.org/software/complexity/>
- **许可证:** GPL-3.0-or-later
- **源码归档:** <https://ftpmirror.gnu.org/gnu/complexity/complexity-1.13.tar.xz>
- **最后更新:** 2026-08-02T20:52:07+09:00
- **已生成:** 2026-08-04T22:13:35+00:00

## 可执行文件

- complexity (cli)
- cx-vs-mc (cli)
- complexity (别名)
- cx-vs-mc (别名)

## 依赖

- autogen

## 构建依赖

- autoconf
- automake

## 安装行为

- post-install 钩子: 未定义
- Bottle: 可用 于 arm64_big_sur, arm64_linux, arm64_monterey, arm64_sequoia, arm64_sonoma, arm64_tahoe, arm64_ventura, big_sur, monterey, sonoma, ventura, x86_64_linux

## 版本和新鲜度

- 页面生成时间: 2026-08-04
- 管理器版本: 1.13
- 管理器更新时间: 2026-08-02
- 本地数据: OK
- 上游仓库: https://www.gnu.org/software/complexity/
- 信息: Release/tag comparison is only available for GitHub repositories.
## 项目历史与用法

GNU Complexity is a small GNU static-analysis tool for measuring the complexity of C functions, designed as a more human-comprehension-oriented alternative to simple McCabe-style path counts.

### 项目历史

The GNU Complexity manual documents version 0.4 as of May 2011 and describes a tool by Bruce Korb for analyzing C function complexity. Its rationale is explicit: McCabe-style scoring and `pmccabe` are useful for testing effort, but GNU Complexity tries to better rank functions that are difficult for humans to understand by considering length, nesting, switch bodies, and complicated boolean expressions.

### 采用历史

GNU Complexity has a narrow adoption footprint compared with larger GNU developer tools. Its significance is in the code-review and maintenance niche: it gives C maintainers a command-line metric that can point to suspicious functions in unfamiliar code, estimate testing or comprehension effort, and produce sorted score tables and histograms.

### 使用方式

Practitioners run `complexity` over C source files to report procedure scores, line counts, source locations, and optional histograms. The manual's example runs the tool against its own source with a low threshold, illustrating use as a quick audit tool for ranking functions before refactoring or review.

### 为什么软件包爱好者会关心

For package nerds, GNU Complexity is interesting because it embodies a Unix-tool approach to maintainability: one command, text output, tunable thresholds, and a documented scoring model. It is useful in distributions as a lightweight companion to older tools such as `pmccabe` rather than as a large static-analysis framework.

### 时间线

- 2011: GNU Complexity web page and manual documented version 0.4.
- 2011: Manual rationale compared GNU Complexity with `pmccabe` and explained its scoring model.

### Related projects

- `pmccabe` is the comparison point used throughout the GNU Complexity manual.
- `unifdef` is discussed in the parsing model as a way to handle preprocessor-conditional source.

### 来源

- <https://www.gnu.org/software/complexity/>
- <https://www.gnu.org/software/complexity/manual/complexity.html>


## 安全说明

narrow executable package without higher-risk signals.

- **Geiger 风险:** 绿色 / 低
- narrow executable package without higher-risk signals

## 源数据库详情

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** gnu-complexity
- **Version Scheme:** 0
- **Revision:** 0
- **Bottle Stable Root URL:** <https://ghcr.io/v2/homebrew/core>
- **Deprecated:** no
- **Disabled:** no
- **Keg Only:** no
- **URL Keys:** stable

## 其他软件包管理器记录

- Debian apt - complexity - 1.13-1+b1: installed executable or alias match | Debian stable package indexes: complexity from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | tool for analyzing the complexity of C program functions | https://gnu.org/software/complexity
- Debian apt - complexity-doc - 1.13-1: installed executable or alias match | Debian stable package indexes: complexity-doc from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | tool for analyzing the complexity of C program (documentation) | https://gnu.org/software/complexity
- Nix - complexity: installed executable or alias match | nixpkgs package indexes: pkgs/by-name/co/complexity/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- Ubuntu apt - complexity - 1.13-1: installed executable or alias match | Ubuntu 24.04 LTS package indexes: complexity from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | tool for analyzing the complexity of C program functions | https://gnu.org/software/complexity
- Ubuntu apt - complexity-doc - 1.13-1: installed executable or alias match | Ubuntu 24.04 LTS package indexes: complexity-doc from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | tool for analyzing the complexity of C program (documentation) | https://gnu.org/software/complexity
- zypper - complexity - 1.13-1.9: installed executable or alias match | openSUSE Tumbleweed package metadata: complexity from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | C source code complexity computation utility | https://www.gnu.org/software/complexity/


## 相关链接

- [Terminal utility packages](https://pkg.so/zh-hans/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Text processing packages](https://pkg.so/zh-hans/text-processing-tools/) - Matched text, document, or structured-data processing metadata.
- [Developer build packages](https://pkg.so/zh-hans/developer-build-tools/) - Matched build, compiler, generator, or developer workflow metadata.
- [Networking and protocol packages](https://pkg.so/zh-hans/networking-protocol-tools/) - Matched network, protocol, or remote-service metadata.
- [autogen](https://pkg.so/zh-hans/brew/autogen/) - Runtime dependency declared by Homebrew.
- [autoconf](https://pkg.so/zh-hans/brew/autoconf/) - Build dependency declared by Homebrew.
- [automake](https://pkg.so/zh-hans/brew/automake/) - Build dependency declared by Homebrew.
- [pmccabe](https://pkg.so/zh-hans/brew/pmccabe/) - Shares pkgdb curated category or tags: c, cli, code-metrics, developer-tools, static-analysis.
- [cppcheck](https://pkg.so/zh-hans/brew/cppcheck/) - Shares pkgdb curated category or tags: c, cli, developer-tools, static-analysis.
- [include-what-you-use](https://pkg.so/zh-hans/brew/include-what-you-use/) - Shares pkgdb curated category or tags: c, cli, developer-tools, static-analysis.
- [lizard-analyzer](https://pkg.so/zh-hans/brew/lizard-analyzer/) - Shares pkgdb curated category or tags: cli, code-metrics, developer-tools, static-analysis.
- [sparse](https://pkg.so/zh-hans/brew/sparse/) - Shares pkgdb curated category or tags: c, cli, developer-tools, static-analysis.
- [cbmc](https://pkg.so/zh-hans/brew/cbmc/) - Shares pkgdb curated category or tags: c, cli, developer-tools, static-analysis.
- [cflow](https://pkg.so/zh-hans/brew/cflow/) - Shares pkgdb curated category or tags: c, cli, developer-tools, static-analysis.
- [coccinelle](https://pkg.so/zh-hans/brew/coccinelle/) - Shares pkgdb curated category or tags: c, cli, developer-tools, static-analysis.
- [gnu-indent](https://pkg.so/zh-hans/brew/gnu-indent/) - Package names and metadata indicate a similar tool family. Shared terms: c, cli, code, developer, developer-tools.
- [gnu-barcode](https://pkg.so/zh-hans/brew/gnu-barcode/) - Package names and metadata indicate a similar tool family. Shared terms: cli, developer, developer-tools, gnu.

## Combined YAML source

View the package source record on GitHub. [combined/gnu-complexity.yml](https://github.com/mxcl/pkgdb/blob/main/combined/gnu-complexity.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- package-page enrichment
- curated package history
- package version freshness
- pkgdb category and tag curation
- package relationship graph
- external package-manager database matches
- cross-ecosystem install command graph
