reko
AI Cost Tracking
This project uses AI-generated code. Total cost: $2.5346 with 4 AI commits.
Generated on 2026-06-29 using openrouter/qwen/qwen3-coder-next
Narzędzie do wykrywania i refaktoryzacji hardkodowanych wartości, struktur danych i kodu w projektach Python.
Co robi
- scan — wykrywa magic numbers, długie stringi, osadzone słowniki/listy, powtarzające się literały
- extract — wyciąga hardkod do modułu stałych (
constants.pylub wskazany plik) - split — rozbija duże struktury (dict/list) na mniejsze nazwane fragmenty
- move — przenosi stałe między modułami i aktualizuje importy
- remove — usuwa nieużywane stałe modułowe
- apply — stosuje plan refaktoryzacji (YAML/JSON)
Instalacja
cd ~/github/semcod/reko
pip install -e ".[apply,dev]"
Użycie
# skan projektu
reko scan .
# skan z raportem JSON
reko scan src/ --format json -o report.json
# wyciągnij hardkod do constants.py (dry-run)
reko extract src/ --target src/myapp/constants.py --dry-run
# rozbij dużą strukturę w pliku
reko split src/config.py --min-keys 5
# przenieś stałe
reko move src/old.py src/new_constants.py --names TIMEOUT,API_URL
# usuń nieużywane stałe
reko remove src/constants.py --dry-run
# zastosuj plan
reko apply plan.yaml
Konfiguracja
Plik reko.yaml w katalogu projektu:
scan:
extensions: [".py"]
exclude:
- "**/tests/**"
- "**/__pycache__/**"
min_string_length: 8
min_dict_keys: 4
allowed_numbers: [0, 1, -1, 2, 10, 100, 1000]
extract:
target: "constants.py"
naming: "upper_snake"
group_by: "file" # file | kind | none
API
from pathlib import Path
from reko import scan_project, extract_constants, apply_plan
findings = scan_project(Path("src/"))
result = extract_constants(Path("src/app.py"), target=Path("src/constants.py"))
Licencja
Apache-2.0
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
reku-0.1.4.tar.gz
(23.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
reku-0.1.4-py3-none-any.whl
(26.1 kB
view details)
File details
Details for the file reku-0.1.4.tar.gz.
File metadata
- Download URL: reku-0.1.4.tar.gz
- Upload date:
- Size: 23.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a23718d397c731c72a8abdd7a5e0d26ccc055f28f33e4eedbfcf9e9e63f60cb
|
|
| MD5 |
2dea6fa1dbaab3a3b70a2951146dd748
|
|
| BLAKE2b-256 |
b6ea101c6014dd0ba18a9ba0c01951d3ccab0b4131e3782a64b7ecfdfcc81ce0
|
File details
Details for the file reku-0.1.4-py3-none-any.whl.
File metadata
- Download URL: reku-0.1.4-py3-none-any.whl
- Upload date:
- Size: 26.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04defd06c5b2f0e6652c1ac1d78173b6c3f510462f4ecfe25ebb21fa0bbddc7f
|
|
| MD5 |
3983766bef538ca37309e0972a0357b0
|
|
| BLAKE2b-256 |
399e32de40c069865a1e37f60ae7374123503815025c79adfc545bbd8e3bb8f0
|