Metadata-Version: 2.4
Name: wayward-eagle
Version: 0.3.0
Summary: Lower the cognitive complexity of C function bodies, keeping what they do, and census C readability defects
Author: Josh Bailey
License: Apache-2.0
Project-URL: Repository, https://github.com/anarkiwi/wayward-eagle
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Operating System :: POSIX :: Linux
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: clang-tidy==23.1.4
Requires-Dist: libclang==18.1.1
Requires-Dist: tqdm>=4
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-xdist; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: black; extra == "dev"
Requires-Dist: pylint; extra == "dev"
Dynamic: license-file

# wayward-eagle

Lowers the cognitive complexity (SonarSource's metric, as clang-tidy's
`readability-function-cognitive-complexity` counts it) of C function bodies held as statement
trees, keeping what each function does. Each rewrite is made only where it lowers the cost.

```python
from wayward_eagle import Function, reduced

pieces, sections, temps = reduced(body, "f", Function(params=["a"], local={"v1", "v2"}, void=True))
for piece in pieces:
    ...  # print each function: piece.name, piece.args, piece.items, piece.ret
```

- [Statement trees](docs/trees.md): the input and output.
- [Rewrites](docs/rewrites.md): what each rewrite does and when it applies.
- [Census](docs/census.md): `wayward-eagle census FILE.c... [-I DIR] [--json]` lists C's
  readability defects by class (clang-tidy's checks and checks over clang's AST, keyed to a
  decompiler-fidelity taxonomy), and the `wayward-census` virtuous-cycles adapter ratchets them.

Install: `pip install wayward-eagle`. Development: `pip install -e .[dev]`, then
`pytest -n auto --cov=wayward_eagle`.
