Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Architecture

Overview

AntiSlop is built as a library with a CLI binary, enabling programmatic use and extensibility.

graph TD
    CLI[CLI Args & Output] --> Lib[AntiSlop Library]
    Lib --> Config[Configuration]
    Lib --> Walker[Walker]
    Lib --> Scanner[Scanner]
    Lib --> Reporter[Reporter]
    
    Scanner --> Detector[Detector Module]
    
    subgraph Detector Module
        TS[Tree-sitter]
        Regex[Regex Fallback]
    end
    
    Detector --> TS
    Detector --> Regex

Modules

walker

Parallel file traversal with gitignore support using the ignore crate.

detector

Core detection engine with:

  • Pattern registry and compilation
  • Tree-sitter integration for accurate comment extraction (15+ languages)
  • AST-level slop detection via tree-sitter queries
  • Regex fallback for languages without tree-sitter support
  • Language detection from file extensions

config

Configuration management with TOML support and layered defaults.

report

Output formatting with human-readable colored terminal output, JSON export, and SARIF for GitHub Security.

Quality Assurance Strategy

AntiSlop uses an Orthogonal Strategy with tools like MegaLinter.

  • Hygiene Test: scripts/check_overlap.py ensures no pattern overlaps with standard linter defaults.
  • Goal: AntiSlop only flags “AI Slop” (intent/laziness), leaving syntax/style to specialized tools.

Language Support

LanguageTree-sitterRegex FallbackFeature Flag
C/C++cpp
C#c-sharp
Gogo
Haskellhaskell
Javajava
JavaScriptjavascript
JSXjavascript
Kotlinkotlin
Lualua
Perl
PHPphp
Pythonpython
R
Rubyruby
Rustrust
Scalascala
Shell (bash/sh/zsh/fish)
Swift
TypeScripttypescript
TSXtypescript