Skip to content

Conversation

@jensens
Copy link
Member

@jensens jensens commented Nov 11, 2025

Summary

Adds optional ruff check --fix support to the ruff-format target, allowing automatic fixing of linting issues alongside code formatting.

Closes #61

Changes

  • New Settings:

    • RUFF_FIXES (default: false) - Enable/disable ruff check --fix when running ruff-format
    • RUFF_UNSAFE_FIXES (default: false) - Enable unsafe fixes when RUFF_FIXES is enabled
  • Enhanced ruff-format target: Conditionally runs ruff check --fix based on settings

  • Improved output: Echo messages show actual flags being used for transparency

  • Test coverage: Added test_ruff_domain_settings to verify new settings

Behavior

RUFF_FIXES RUFF_UNSAFE_FIXES Result
false (default) * Only ruff format (current behavior)
true false (default) ruff format + ruff check --fix
true true ruff format + ruff check --fix --unsafe-fixes

Usage Examples

# Default: format only (backward compatible)
make ruff-format

# Enable safe auto-fixes
RUFF_FIXES=true make ruff-format

# Enable all fixes including unsafe
RUFF_FIXES=true RUFF_UNSAFE_FIXES=true make ruff-format

# Part of format target
RUFF_FIXES=true make format

Output Examples

$ RUFF_FIXES=true make ruff-format
Run ruff format
Run ruff check --fix

$ RUFF_FIXES=true RUFF_UNSAFE_FIXES=true make ruff-format
Run ruff format
Run ruff check --fix --unsafe-fixes

Testing

  • ✅ All 32 tests pass (including new test)
  • ✅ Non-breaking change - defaults maintain current behavior
  • ✅ Manual testing verified all three scenarios work correctly

Notes

This is a non-breaking, opt-in feature. Users must explicitly set RUFF_FIXES=true to enable the new behavior.

Introduces RUFF_FIXES and RUFF_UNSAFE_FIXES settings to enable
auto-fixing linting issues. Default is false (non-breaking).
Echo output shows actual flags used for transparency.

Addresses #61
@jensens jensens requested a review from rnixx November 11, 2025 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

format: support "ruff check --fix"

2 participants