Constant refactoring monitoring tool
Project description
tingle
Spider-sense for refactoring: you know that tingle — the itch that says the codebase isn't right yet. This tool puts a number on it, so you can watch it drop.
Code metrics for the era of constant refactoring.
tingle measures things you want to shrink (or watch) while refactoring a
codebase: ignored lint rules, inline # noqa / # type: ignore comments,
uses of a legacy class during a strangler-fig migration, lines of code in a
package that should disappear.
It runs once, prints the numbers, and stores nothing — pipe the JSON into whatever tracks history for you (CI artifacts, dashboards, a spreadsheet).
📖 Documentation: https://fancysnake.github.io/tingle/
Install
$ pip install tingle
Quick start
$ tingle init # starter tingle.toml
$ tingle add regex_count '#\s*noqa' # add a metric from the CLI
$ tingle add toml_list_length tool.ruff.lint.ignore --name ruff-ignores
$ tingle # interactive mode (on a terminal)
$ tingle stat # summary table
$ tingle stat --json # machine-readable output
$ tingle stat --diff # impact of the current branch
$ tingle report # every occurrence, file:line
$ tingle report --diff # what the branch added/removed
Metrics are declared in tingle.toml (or a [tool.tingle] section in
pyproject.toml):
[ranges.python]
include = ["src/**/*.py", "tests/**/*.py"]
default = true
[[metrics]]
name = "noqa-comments"
type = "regex_count"
pattern = '#\s*noqa'
You can count regex matches, uses of a Python symbol, entries in a TOML or INI list (this is how you count ignored lint rules), files, and lines. See the metric types.
What it does
Three things, in rising order of opinion:
- Measure.
tingle statcounts what you told it to count and prints the numbers. Metric values never affect the exit code — tingle measures, it does not judge. - Attribute.
tingle stat --diffmeasures only what the current branch changed, against the merge-base with a base branch, so commits that landed on the base after you branched don't pollute your numbers. - Judge.
tingle checkis the CI gate: the same branch measurement, but it exits 1 if the branch made things worse, so a pull request that takes on debt fails the build.
$ tingle check
noqa-comment (regex_count): +2
+ src/api/views.py:23
+ src/api/views.py:41
$ echo $?
1
Documentation
- Configuration —
tingle.toml, ranges, groups. - Metric types — what you can count, and the limits of each counter.
- Branch impact — how
--diffattributes changes to your branch. - CI gate — failing the build on new debt.
- CLI reference — every command and flag.
Development
Python 3.11–3.14 are supported (CI runs the full matrix). The project uses mise + Poetry.
$ mise install
$ poetry install
$ mise run test:py # tests
$ mise run lint:py # ruff, mypy, pylint, import-linter
$ mise run docs:serve # preview the docs site
See contributing for the GLIMPSE source layout and the layer contracts.
License
MIT.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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
File details
Details for the file tingle-0.4.0.tar.gz.
File metadata
- Download URL: tingle-0.4.0.tar.gz
- Upload date:
- Size: 49.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74cda382a880c3b1798ebc0b6c87028a5c7f9e976ac71be7dadf31465b8282fa
|
|
| MD5 |
99ea6f076327e6ab0610261414885c0e
|
|
| BLAKE2b-256 |
6b4d04ace3e24b720dac6d72e20c261eb3a94b02ae753376d5c8fdadab2516d3
|
Provenance
The following attestation bundles were made for tingle-0.4.0.tar.gz:
Publisher:
release.yml on fancysnake/tingle
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tingle-0.4.0.tar.gz -
Subject digest:
74cda382a880c3b1798ebc0b6c87028a5c7f9e976ac71be7dadf31465b8282fa - Sigstore transparency entry: 2187130923
- Sigstore integration time:
-
Permalink:
fancysnake/tingle@4a88bcb57605e8de28b8fc7e77776fa8f957a834 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/fancysnake
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4a88bcb57605e8de28b8fc7e77776fa8f957a834 -
Trigger Event:
push
-
Statement type:
File details
Details for the file tingle-0.4.0-py3-none-any.whl.
File metadata
- Download URL: tingle-0.4.0-py3-none-any.whl
- Upload date:
- Size: 65.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac785377cbffb72f9154cbe0b8907fdc6aa234d59ccb2144c8e1649180c6aae1
|
|
| MD5 |
d38aa7b7877862abbb85dcf868d58dd7
|
|
| BLAKE2b-256 |
1c7e21e753b59d4ca6e82537298b7751066daeac330eedd1052093a97943bcba
|
Provenance
The following attestation bundles were made for tingle-0.4.0-py3-none-any.whl:
Publisher:
release.yml on fancysnake/tingle
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tingle-0.4.0-py3-none-any.whl -
Subject digest:
ac785377cbffb72f9154cbe0b8907fdc6aa234d59ccb2144c8e1649180c6aae1 - Sigstore transparency entry: 2187130929
- Sigstore integration time:
-
Permalink:
fancysnake/tingle@4a88bcb57605e8de28b8fc7e77776fa8f957a834 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/fancysnake
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4a88bcb57605e8de28b8fc7e77776fa8f957a834 -
Trigger Event:
push
-
Statement type: