← 返回命令列表

Linux command

ruff-check 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Check current directory

ruff check

Check specific files

ruff check [file.py]

Check and fix

ruff check --fix

Check with specific rules

ruff check --select [E,F]

Watch for changes

ruff check --watch

说明

ruff check is the linting subcommand of Ruff, an extremely fast Python linter written in Rust. It analyzes Python source files for style violations, potential bugs, and code quality issues, implementing rule sets from Flake8, isort, pyupgrade, and many other established Python tools in a single unified interface. The --fix flag automatically corrects fixable violations in place, while --select and --ignore control which rule categories are active. Watch mode re-checks files on every save, providing real-time feedback during development. Output formats include plain text, JSON, and GitHub Actions annotations for CI integration.

参数

--fix
Auto-fix violations.
--select _rules_
Enable specific rules.
--ignore _rules_
Ignore specific rules.
--watch
Watch for file changes.
--config _file_
Configuration file.
--output-format _format_
Output format (text, json, github).

FAQ

What is the ruff-check command used for?

ruff check is the linting subcommand of Ruff, an extremely fast Python linter written in Rust. It analyzes Python source files for style violations, potential bugs, and code quality issues, implementing rule sets from Flake8, isort, pyupgrade, and many other established Python tools in a single unified interface. The --fix flag automatically corrects fixable violations in place, while --select and --ignore control which rule categories are active. Watch mode re-checks files on every save, providing real-time feedback during development. Output formats include plain text, JSON, and GitHub Actions annotations for CI integration.

How do I run a basic ruff-check example?

Run `ruff check` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --fix do in ruff-check?

Auto-fix violations.