Ruff

Usage of Ruff Linting and Formatting Example

[[TOC]]


Linting

Check the code for errors:

ruff check <path/file>

Check and fix the code:

ruff check --fix <path/file>

Check and fix the code with ignore list:

ruff check --fix --ignore <RULES> <path/file>
  • Example: F403 : ami_ec.py:3:1: F403 from scripts.ui import * used; unable to detect undefined names

    Ignore this fixing message by --ignore F or --ignore F403

    ruff check --ignore F --fix <path/file>
    

Formatting

Format the code:

ruff format <path/file>