Run targeted linting, formatting, and code quality checks on modified files. Use this to validate code style, type safety, security, and other quality metrics before committing...
This skill helps you efficiently validate and format code using the project's comprehensive linting infrastructure.
Use this skill when you:
scripts/lint fmt -- <file> immediately after code changesscripts/lint checks before pushing-- <file> syntax to validate only what you changed, not the entire codebasefmt instead of manually fixing style issuesscripts/lint typing -- <file> after adding type annotationsRun all checks (broad validation):
scripts/lint checks
Format and validate a specific file:
scripts/lint fmt -- path/to/file.py
Check types on a specific file:
scripts/lint typing -- path/to/file.py
fmt - Format code (recommended for most edits)Formats and validates code style using Ruff.
Usage:
# Format entire codebase
scripts/lint fmt
# Format specific files
scripts/lint fmt -- ddtrace/tracer.py tests/test_tracer.py
# Format specific directory
scripts/lint fmt -- ddtrace/contrib/flask/
What it does:
When to use: After making code changes to automatically format and fix style issues.
fmt-snapshots - Format snapshot filesFormats snapshot test files used in snapshot-based testing.
Usage:
scripts/lint fmt-snapshots -- tests/snapshots/
When to use: After snapshot test updates or when snapshot files need reformatting.
style - Check all style issues (no auto-fix)Validates code style without automatically fixing issues.
Usage:
# Check entire codebase
scripts/lint style
# Check specific files
scripts/lint style -- ddtrace/
What it validates:
When to use: To verify style compliance before committing without auto-fixes.
format_check - Check formattingValidates Python code formatting with ruff format (no auto-fix).
Usage:
scripts/lint format_check -- ddtrace/tracer.py
When to use: Quick check of Python formatting before committing.
typing - Type check with mypyValidates Python type hints and catches type-related errors.
Usage:
# Check all types
scripts/lint typing
# Check specific files (mypy path format)
scripts/lint typing -- ddtrace/tracer.py
When to use: After adding type hints or modifying functions with type annotations.
security - Security audit with BanditScans code for common security issues and vulnerabilities.
Usage:
# Scan entire codebase
scripts/lint security
# Scan specific directory
scripts/lint security -- -r ddtrace/contrib/
When to use: Before committing code that handles user input, credentials, or sensitive operations.
spelling - Check spellingValidates spelling in documentation, comments, and docstrings.
Usage:
# Check all spelling
scripts/lint spelling
# Check specific files
scripts/lint spelling -- docs/ releasenotes/
When to use: Before committing documentation or user-facing text.
riot - Validate riotfileDoctests the riotfile to ensure test venv definitions are valid.
Usage:
scripts/lint riot
When to use: After modifying riotfile.py to validate syntax and doctest examples.
suitespec-check - Validate test suite specificationsChecks that test suite patterns in tests/suitespec.yml cover all test files.
Usage:
scripts/lint suitespec-check
When to use: After adding new test files or modifying suite specifications.
error-log-check - Validate error log messagesEnsures error log messages follow project conventions.
Usage:
scripts/lint error-log-check
When to use: After adding new error logging statements.
sg - Static analysis with ast-grepPerforms static code analysis using ast-grep patterns.
Usage:
# Scan all files
scripts/lint sg
# Scan specific directory
scripts/lint sg -- ddtrace/
When to use: To find code patterns that may need refactoring or optimization.
sg-test - Test ast-grep rulesValidates ast-grep rule definitions.
Usage:
scripts/lint sg-test
When to use: After modifying ast-grep rules or patterns.
cformat - Check C code formattingValidates C code formatting.
Usage:
scripts/lint cformat
When to use: After modifying C extension code.
cmakeformat - Check CMake formattingValidates CMake file formatting.
Usage:
scripts/lint cmakeformat
When to use: After modifying CMakeLists.txt or other CMake files.
After editing a Python file, format and validate it:
# Edit the file...
# Then run:
scripts/lint fmt -- path/to/edited/file.py
After adding type hints:
scripts/lint typing -- ddtrace/contrib/flask/patch.py
Run all checks before creating a commit:
scripts/lint checks
This runs:
Before committing code handling sensitive operations:
scripts/lint security -- -r ddtrace/contrib/
After writing documentation or docstrings:
scripts/lint spelling -- docs/ ddtrace/
scripts/lint fmt -- <file> to auto-fix style issueschecks before pushing: Ensures all quality gates pass-- <file> syntax to validate only what you changedtyping after adding type annotationsfmt insteadAll lint commands support passing arguments with -- syntax:
# Basic format
scripts/lint <subcommand> -- <args>
# Examples:
scripts/lint fmt -- ddtrace/tracer.py # Format specific file
scripts/lint typing -- ddtrace/ # Type check directory
scripts/lint security -- -r ddtrace/contrib/ # Security scan with args
scripts/lint spelling -- docs/ releasenotes/ # Spelling check specific paths
Ensure you've run scripts/lint fmt to auto-fix style issues first:
scripts/lint fmt -- <file>
scripts/lint style -- <file> # Should now pass
Make sure type hints are correct and all imports are available:
scripts/lint typing -- <file>
Ensure you're running from the project root:
cd /path/to/dd-trace-py
scripts/lint checks
Use fmt to auto-fix most issues:
scripts/lint fmt -- .
[dependency-groups]: Source of truth for all lint tool versions