Metadata-Version: 2.4
Name: wayward-eagle
Version: 0.2.0
Summary: Lower the cognitive complexity of C function bodies, keeping what they do
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
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.

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