mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-03-28 21:16:20 +01:00
ruff, ruff-{check,format}: add page (#12377)
* ruff-format: add page * ruff-check: add page * ruff: add page --------- Co-authored-by: Juri Dispan <juri.dispan@posteo.net>
This commit is contained in:
parent
8a05239fce
commit
6871fd11e9
3 changed files with 62 additions and 0 deletions
33
pages/common/ruff-check.md
Normal file
33
pages/common/ruff-check.md
Normal file
|
@ -0,0 +1,33 @@
|
|||
# ruff check
|
||||
|
||||
> An extremely fast Python linter. `check` is the default command - it can be omitted everywhere.
|
||||
> If no files or directories are specified, the current working directory is used by default.
|
||||
> More information: <https://docs.astral.sh/ruff/linter>.
|
||||
|
||||
- Run the linter on the given files or directories:
|
||||
|
||||
`ruff check {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
|
||||
|
||||
- Apply the suggested fixes, modifying the files in-place:
|
||||
|
||||
`ruff check --fix`
|
||||
|
||||
- Run the linter and re-lint on change:
|
||||
|
||||
`ruff check --watch`
|
||||
|
||||
- Only enable the specified rules (or all rules), ignoring the configuration file:
|
||||
|
||||
`ruff check --select {{ALL|rule_code1,rule_code2,...}}`
|
||||
|
||||
- Additionally enable the specified rules:
|
||||
|
||||
`ruff check --extend-select {{rule_code1,rule_code2,...}}`
|
||||
|
||||
- Disable the specified rules:
|
||||
|
||||
`ruff check --ignore {{rule_code1,rule_code2,...}}`
|
||||
|
||||
- Ignore all existing violations of a rule by adding `# noqa` directives to all lines that violate it:
|
||||
|
||||
`ruff check --select {{rule_code}} --add-noqa`
|
17
pages/common/ruff-format.md
Normal file
17
pages/common/ruff-format.md
Normal file
|
@ -0,0 +1,17 @@
|
|||
# ruff format
|
||||
|
||||
> An extremely fast Python code formatter.
|
||||
> If no files or directories are specified, the current working directory is used by default.
|
||||
> More information: <https://docs.astral.sh/ruff/formatter>.
|
||||
|
||||
- Format given files or directories in-place:
|
||||
|
||||
`ruff format {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
|
||||
|
||||
- Print which files would have been modified and return a non-zero exit code if there are files to reformat, and zero otherwise:
|
||||
|
||||
`ruff format --check`
|
||||
|
||||
- Print what changes would be made without modifying the files:
|
||||
|
||||
`ruff format --diff`
|
12
pages/common/ruff.md
Normal file
12
pages/common/ruff.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
# ruff
|
||||
|
||||
> An extremely fast Python linter and code formatter, written in Rust.
|
||||
> More information: <https://docs.astral.sh/ruff/tutorial>.
|
||||
|
||||
- View documentation for the Ruff linter:
|
||||
|
||||
`tldr ruff check`
|
||||
|
||||
- View documentation for the Ruff code formatter:
|
||||
|
||||
`tldr ruff format`
|
Loading…
Add table
Reference in a new issue