Skip to main content

Aposlop

Aposlop

CI status crates.io version PyPI version License


Apos, the Slopbreaker

Slop always rolls downhill. Aposlop helps to push back.

Aposlop is a fast command-line tool. It finds duplicate code, excessive file length, and cyclomatic complexity.

Aposlop supports Go, Rust, Python, TypeScript, and TSX. Aposlop uses Tree-sitter to parse each supported language.

Documentation: https://aposlop.ezygang.digital/

Source Code: https://github.com/EzyGang/aposlop

Issues: https://github.com/EzyGang/aposlop/issues


Table of Contents


Why Aposlop?

Coding agents can add repeated logic, complex control flow, and large files faster than reviewers can find them. Aposlop gives people and agents one fast check for these problems.

Built for agent-written code. Aposlop finds copies even after names or values change.

Clear limits. Set rules for duplicate code, complexity, and file length.

Useful results. Read source findings in the terminal or use stable JSON in other tools.

Fast feedback. Parallel analysis and a local cache keep repeat checks short.

Need Why it matters How Aposlop helps
Find copied logic Renamed values can hide a copy from text search Tree-sitter finds exact, changed, and near-match copies
Keep code clear Deep control flow is hard to review and change Language rules measure complexity for each code block
Keep files focused Large files can collect unrelated work File limits can vary by language and extension
Check every change Slow checks are easy to skip Native code, parallel work, and caching reduce wait time
Support automation Agents and CI need stable results JSON output, fixed ordering, and aposlop ci support repeat checks

Skills for coding agents

Bundled skills help agents use Aposlop and make smaller code and test changes. Install them separately from the CLI.

Skill Use it for How to use it
aposlop Install, configure, run, and read Aposlop Ask the agent to scan or set up a project
aposlop-code-changes Make the smallest complete code change It starts automatically for code changes
aposlop-test-changes Add a few tests that protect behavior It starts automatically for test work
aposlop-deslop-tests Remove tests without a distinct purpose Run /aposlop-deslop-tests [scope]
aposlop-deslop-turbo Reduce tests and production code without behavior changes Run /aposlop-deslop-turbo [scope]

Read the agent skills guide for installation and examples.


Installation

Aposlop has two components:

  1. The CLI scans source code and reports findings.
  2. Agent skills guide coding agents during setup, coding, testing, and cleanup.

Install either component or both.

Install script on Linux or macOS

Install cosign. Then run the installer:

curl -fsSLo install.sh https://github.com/EzyGang/aposlop/releases/latest/download/install.sh
sh install.sh

Install script on Windows

Install cosign. Then run the installer:

Invoke-WebRequest https://github.com/EzyGang/aposlop/releases/latest/download/install.ps1 -OutFile install.ps1
powershell -ExecutionPolicy Bypass -File .\install.ps1

Both scripts verify the archive checksum and Sigstore signatures.

Cargo

Install Aposlop from crates.io:

cargo install aposlop --locked

PyPI with uv

Install Aposlop as a global tool:

uv tool install aposlop

Run Aposlop without installing it:

uvx aposlop --help

Homebrew

Install Aposlop from the EzyGang Homebrew tap:

brew install EzyGang/tap/aposlop

From source

Install Aposlop from source. A stable Rust toolchain must support edition 2024.

git clone https://github.com/EzyGang/aposlop.git
cd aposlop
cargo install --path . --locked

Verify the installation:

aposlop --version
aposlop --help

Agent skills

Use the installed CLI:

aposlop install-skills

The command uses npx when available. It uses pnpm dlx when npx is unavailable.

You can also run either installer directly:

npx skills@latest add EzyGang/aposlop
pnpm dlx skills@latest add EzyGang/aposlop

The installer lets you choose the skills and target agents. The skills do not install the Aposlop CLI. Read the agent skills guide for each skill.

Update checks

Aposlop checks for a new GitHub release during interactive runs. It performs a network request at most once every 24 hours. It stores the latest result in the user cache directory. Non-interactive commands do not perform this check.

Set this environment variable to disable the check:

APOSLOP_NO_UPDATE_CHECK=1 aposlop .

Quick Start

Analyze the current directory:

aposlop .

Run the same analysis without a global installation:

uvx aposlop .
cargo run -- .

Show the source for each duplicate:

aposlop . --terminal-output code

Run CI validation:

aposlop ci .

The ci command returns exit code 1 when a finding remains.

Write the complete report as JSON:

aposlop . --format json > aposlop-report.json

Read the full quick-start guide.


Core Features

Duplicate Detection

A block enters analysis when it meets the line and named-node limits.

Aposlop classifies block relations in this order:

  1. Type-1 requires identical canonical syntax.
  2. Type-2 allows different identifiers and literals.
  3. Type-3 requires a Jaccard similarity at or above the configured threshold.

Aposlop reports each connected set of duplicate relations as one group. Two blocks do not match when either contains the other in the same file. A TypeScript block can match a TSX block.

Aposlop also finds Type-1 and Type-2 statement runs that a developer copied into larger functions. A run must meet the same line and named-node limits as a block.

Read the duplicate model.

Cyclomatic Complexity

Each valid block has an initial complexity score of 1. Aposlop adds one for each language-specific decision. Decisions include branches, loops, alternatives, exception paths, conditional expressions, and short-circuit operations.

A nested block has an independent score. Nested blocks include functions, closures, lambdas, field initializers, and static blocks.

A violation requires:

score > complexity_threshold

Read the complexity model.

File Length

Aposlop reports a supported source file when its line count exceeds its effective maximum. The default maximum is 300 lines.

lines > max_file_lines

Use [file_length].exclude for check-specific gitignore-style exclusions. File-length violations cannot be suppressed with aposlop allow.

Read the file-length guide.

Language Support

Language Extensions
Go .go
Rust .rs
Python .py
TypeScript .ts
TSX .tsx

Aposlop ignores unsupported extensions. Aposlop follows standard ignore files such as .gitignore.

Read the language guides.

Output Formats

The terminal report is the default. It contains duplicate groups, complexity findings, file-length violations, diagnostics, and a summary.

aposlop . --format terminal

The JSON report contains the complete report and its schema version.

aposlop . --format json

The ci command shows only the status and finding counts.

aposlop ci .

Read the output guide.

Manual Exclusions

Aposlop assigns a deterministic five-character ID to each duplicate group or complexity finding.

Add a finding to the manual exclusions:

aposlop allow aB7_x

The command writes the ID to .aposlopignore. Delete the ID from that file to restore the finding. Aposlop reports valid IDs that match no current finding as unused ignores at the end of each report. Unused ignores do not change the process exit code. File-length violations have no finding ID and cannot be added to .aposlopignore.


Configuration

Aposlop reads <PATH>/.aposlop.toml. Aposlop uses built-in values when this file does not exist.

[core]
min_lines = 5
min_nodes = 30
exclude = ["tests/", "vendor/", "node_modules/", "target/"]
use_cache = true

[duplicates_detection]
type_1 = true
type_2 = true
type_3 = true
type_3_threshold = 0.85

[metrics]
calculate_complexity = true
complexity_threshold = 15

[file_length]
max_lines = 300
exclude = []

core.exclude and file_length.exclude use the same syntax as one .gitignore line. core.exclude removes matching paths from all analysis. file_length.exclude suppresses only file-length violations. Directory patterns match at any depth, while / anchors and ** recurse.

Language and extension tables can override max_file_lines and the existing analysis rules. Command-line values override all configuration-file layers.

Read the configuration guide.


CLI Quick Reference

Command or option Purpose
aposlop ci [PATH] Print a concise finding summary and fail when findings exist
aposlop allow <FINDING> [PATH] Add a finding to the target's manual exclusions
--format <terminal|json> Select the report format
--terminal-output <locations|code> Select terminal duplicate detail
--min-lines <N> Override the minimum block line count
--min-nodes <N> Override the minimum named-node count
--exclude <GLOB> Replace configured gitignore-style exclusion patterns
--use-cache <BOOL> Enable or disable the analysis cache
--type-1 <BOOL> Enable or disable Type-1 findings
--type-2 <BOOL> Enable or disable Type-2 findings
--type-3 <BOOL> Enable or disable Type-3 findings
--type-3-threshold <RATIO> Override the Type-3 threshold
--calculate-complexity <BOOL> Enable or disable complexity findings
--complexity-threshold <N> Override the complexity threshold
--max-file-lines <N> Override the maximum source-file line count

Read the complete CLI reference.


Contributing

Open a GitHub issue to discuss a large change. Then open a pull request.

Run these checks before you submit the pull request:

cargo fmt --all -- --check
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features
cargo run -- --help

License

You can use Aposlop under either license:

Metadata

Release files for aposlop 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for aposlop 1.3.0
File Actions
aposlop-1.3.0-py3-none-win_arm64.whl Python 3 none Windows ARM64 Details for aposlop-1.3.0-py3-none-win_arm64.whl
aposlop-1.3.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for aposlop-1.3.0-py3-none-win_amd64.whl
aposlop-1.3.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details for aposlop-1.3.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
aposlop-1.3.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details for aposlop-1.3.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
aposlop-1.3.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for aposlop-1.3.0-py3-none-macosx_11_0_arm64.whl
aposlop-1.3.0-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details for aposlop-1.3.0-py3-none-macosx_10_12_x86_64.whl

Total release size: 21.5 MB

Release files / aposlop-1.3.0-py3-none-win_arm64.whl

Download URL aposlop-1.3.0-py3-none-win_arm64.whl
Size 3.4 MB
Tags Python 3 Windows ARM64
SHA-256 checksum
How to use checksums
9d145f9b4a2f4796e2c8fa31d8ae5484122d35843650b0c62c687d2d3d2fcbc3
BLAKE2b-256 checksum
How to use checksums
4590dc8fd6e2fd7cb0e06bc696210039b6da006eeb802779e3dc101c5068eb21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / aposlop-1.3.0-py3-none-win_amd64.whl

Download URL aposlop-1.3.0-py3-none-win_amd64.whl
Size 3.4 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
db01f81338a1f9bfb85882c2642fdd8bfb013f6aa9dfb1ce13d305e60a11c02f
BLAKE2b-256 checksum
How to use checksums
c72e7054ecd5d7da51de01988f89657f71907dd4a19fceefc2616a7f5c3b4b0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / aposlop-1.3.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL aposlop-1.3.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 3.9 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
9894d99907f89346f5b6f28d9b0a515072cfae2fa14ec21f64885ba08ea1bc04
BLAKE2b-256 checksum
How to use checksums
279e061c99f979b7da14e27cae9bbc418783e930af57791f949437f033a760ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / aposlop-1.3.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL aposlop-1.3.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 3.6 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
1cb886db99610f4ea0cbe426e3c312ec809e9ef60f8215f39edb516d7f7af618
BLAKE2b-256 checksum
How to use checksums
d0b2b5a91ad466edf626e38ac0efabd2913fcc8ad60121fcc4c89bb94bea44b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / aposlop-1.3.0-py3-none-macosx_11_0_arm64.whl

Download URL aposlop-1.3.0-py3-none-macosx_11_0_arm64.whl
Size 3.6 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
3942cc85b8bca94d749d6dafa25533460da8b81cc3c151e3b1e2227b887d4624
BLAKE2b-256 checksum
How to use checksums
0e709c47641657df5ba98eb0bad40440a3a2331b3a784366dd8b9a9e4a856b6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / aposlop-1.3.0-py3-none-macosx_10_12_x86_64.whl

Download URL aposlop-1.3.0-py3-none-macosx_10_12_x86_64.whl
Size 3.7 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
a340a726ff9b0fe4857a6743785151ec780f8607d39aad91311f7854bfc102cc
BLAKE2b-256 checksum
How to use checksums
63133162127af827d2d1401c5a40e1bf422d36e241b25ea587114c465460096c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Security for aposlop 1.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for aposlop-1.3.0-py3-none-win_arm64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page