Skip to content

Latest commit

 

History

History
54 lines (43 loc) · 1.6 KB

File metadata and controls

54 lines (43 loc) · 1.6 KB

Contributing to PySweep

Thank you for your interest in contributing to PySweep! We welcome contributions of all forms, including bug reports, feature suggestions, documentation updates, and pull requests.

Development Setup

  1. Clone the repository:

    git clone https://github.com/yourusername/pysweep.git
    cd pysweep
  2. Create and activate a virtual environment (Python 3.12+):

    python -m venv .venv
    # Windows:
    .venv\Scripts\activate
    # macOS/Linux:
    source .venv/bin/activate
  3. Install dependencies:

    pip install -e .[dev]

Code Quality Standards

We enforce strict linting and type checking:

  • Formatting: Run black .
  • Linting: Run ruff check .
  • Type Checking: Run mypy .
  • Testing: Run pytest

Please make sure all checks pass before submitting a pull request.

Creating Custom Detector Plugins

PySweep allows you to add custom detectors as plugins without changing the core codebase:

  1. Create a directory named .pysweep/plugins in your project's root.
  2. Create a new python file, e.g. my_detector.py.
  3. Import the decorators and models from pysweep:
    from pysweep.detectors import register_file_detector
    from pysweep.models import Issue, FileContext
    from pysweep.config import Config
    
    @register_file_detector
    def detect_custom_pattern(context: FileContext, config: Config):
        issues = []
        # Your custom AST or token detection logic here
        return issues
  4. Run pysweep scan . and PySweep will automatically discover and execute your new detector!