Skip to content

Instantly share code, notes, and snippets.

@daaniam
Last active August 25, 2024 15:51
Show Gist options
  • Save daaniam/563084e6261231d9f1ab869efc96f97b to your computer and use it in GitHub Desktop.
Save daaniam/563084e6261231d9f1ab869efc96f97b to your computer and use it in GitHub Desktop.
ruff pycharm file watcher

Ruff file watchers in PyCharm + basic commands

Format code file watcher:

Name: ruff-format
Program: $PyInterpreterDirectory$/ruff
Arguments: format .
Working directory: $ProjectFileDir$

Sort imports file watcher:

Name: ruff-sort
Program: $PyInterpreterDirectory$/ruff
Arguments: ruff check . --fix --select I
Working directory: $ProjectFileDir$

Basic terminal commands:

# Format code
ruff format .

# Check code
ruff check .

# Fix code (all fixable issues, like unused imports etc.)
ruff check . --fix

# Sort (fix) imports only
ruff check . --fix --select I
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment