# 使用 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
- **版本:** 1.13
- **来源摘要:** Measures complexity of C source
- **主页:** <https://www.gnu.org/software/complexity/>
- **最后更新:** 2026-08-02T20:52:07+09:00
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

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

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

- 页面生成时间: 2026-08-03
- 管理器版本: 1.13
## 项目历史与用法

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

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

- 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/


## 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
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
