mirror of
https://github.com/astral-sh/ruff-action.git
synced 2026-05-12 20:50:14 +02:00
Update README to reflect fork (#2)
This commit is contained in:
@@ -1,15 +1,27 @@
|
|||||||
# ruff-action
|
# ruff-action
|
||||||
A GitHub Action for Ruff
|
|
||||||
|
|
||||||
|
A [GitHub Action](https://github.com/features/actions) to run
|
||||||
|
[Ruff](https://github.com/astral-sh/ruff).
|
||||||
|
|
||||||
Ruff can now be used as a [GitHub Action](https://github.com/features/actions).
|
> [!TIP] This Action is a fork of
|
||||||
|
> [chartboost/ruff-action](https://github.com/ChartBoost/ruff-action), which is
|
||||||
|
> no longer maintained. The Action is largely unchanged, but will be updated in
|
||||||
|
> a future major release.
|
||||||
|
|
||||||
This action is commonly used as a pass/fail test to ensure your repository stays clean, abiding the [Rules](https://docs.astral.sh/ruff/rules/) specified in your configuration. Though it runs `ruff`, the action can do anything `ruff` can (ex, fix).
|
This action is commonly used as a pass/fail test to ensure your repository stays
|
||||||
|
clean, abiding the [Rules](https://docs.astral.sh/ruff/rules/) specified in your
|
||||||
|
configuration. Though it runs `ruff`, the action can do anything `ruff` can (ex,
|
||||||
|
fix).
|
||||||
|
|
||||||
## Compatibility
|
## Compatibility
|
||||||
This action is known to support all GitHub-hosted runner OSes. It likely can run on self-hosted runners, but might need specific dependencies. Only published versions of Ruff are supported (i.e. whatever is available on PyPI).
|
|
||||||
|
This action is known to support all GitHub-hosted runner OSes. It likely can run
|
||||||
|
on self-hosted runners, but might need specific dependencies. Only published
|
||||||
|
versions of Ruff are supported (i.e., whatever is available on
|
||||||
|
[PyPI](https://pypi.org/project/ruff/)).
|
||||||
|
|
||||||
## Basic Usage
|
## Basic Usage
|
||||||
|
|
||||||
Create a file (ex: `.github/workflows/ruff.yml`) inside your repository with:
|
Create a file (ex: `.github/workflows/ruff.yml`) inside your repository with:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@@ -24,15 +36,23 @@ jobs:
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Advanced Usage
|
## Advanced Usage
|
||||||
The Ruff action can be customized via optional configuration parameters passed to Ruff (using `with:`):
|
|
||||||
|
|
||||||
- version: Must be a Ruff release available on PyPI. By default, latest release of Ruff. You can pin a version, or use any valid version specifier.
|
The Ruff action can be customized via optional configuration parameters passed
|
||||||
- args: You can specify the arguments to pass to the ruff command. By default, it's `check`.
|
to Ruff (using `with:`):
|
||||||
- src: default, '.'
|
|
||||||
|
|
||||||
See [Configuring Ruff](https://github.com/astral-sh/ruff/blob/main/docs/configuration.md) for details
|
- `version`: Must be a Ruff release available on
|
||||||
|
[PyPI](https://pypi.org/project/ruff/). Defaults to the latest Ruff release.
|
||||||
|
You can pin a version, or use any valid version specifier.
|
||||||
|
- `args`: The arguments to pass to the `ruff` command. Defaults to `check`,
|
||||||
|
which lints the current directory.
|
||||||
|
- `src`: The directory to run `ruff` in. Defaults to the root of the repository.
|
||||||
|
|
||||||
|
See
|
||||||
|
[Configuring Ruff](https://github.com/astral-sh/ruff/blob/main/docs/configuration.md)
|
||||||
|
for details
|
||||||
|
|
||||||
### Use a different ruff version
|
### Use a different ruff version
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: chartboost/ruff-action@v1
|
- uses: chartboost/ruff-action@v1
|
||||||
with:
|
with:
|
||||||
@@ -40,22 +60,35 @@ See [Configuring Ruff](https://github.com/astral-sh/ruff/blob/main/docs/configur
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Specify a different source directory
|
### Specify a different source directory
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: chartboost/ruff-action@v1
|
- uses: chartboost/ruff-action@v1
|
||||||
with:
|
with:
|
||||||
src: './src'
|
src: "./src"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Use `ruff format`
|
### Use `ruff format`
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: chartboost/ruff-action@v1
|
- uses: chartboost/ruff-action@v1
|
||||||
with:
|
with:
|
||||||
args: 'format --check'
|
args: "format --check"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Only run ruff on changed files
|
### Only run ruff on changed files
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: chartboost/ruff-action@v1
|
- uses: chartboost/ruff-action@v1
|
||||||
with:
|
with:
|
||||||
changed-files: 'true'
|
changed-files: "true"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Apache
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
<a target="_blank" href="https://astral.sh" style="background:none">
|
||||||
|
<img src="https://raw.githubusercontent.com/astral-sh/uv/main/assets/svg/Astral.svg" alt="Made by Astral">
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|||||||
+6
-40
@@ -1,46 +1,12 @@
|
|||||||
|
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
|
|
||||||
select = ["A", "ANN", "B", "C90", "D", "E", "F", "I", "N", "COM", "DTZ", "PD", "RUF", "TID", "UP", "W"]
|
|
||||||
ignore = ["D203", "D212"]
|
|
||||||
|
|
||||||
fixable = ["I", "RUF100"]
|
|
||||||
unfixable = []
|
|
||||||
|
|
||||||
# Exclude a variety of commonly ignored directories.
|
|
||||||
exclude = [
|
|
||||||
".bzr",
|
|
||||||
".direnv",
|
|
||||||
".eggs",
|
|
||||||
".git",
|
|
||||||
".hg",
|
|
||||||
".mypy_cache",
|
|
||||||
".nox",
|
|
||||||
".pants.d",
|
|
||||||
".pytype",
|
|
||||||
".ruff_cache",
|
|
||||||
".svn",
|
|
||||||
".tox",
|
|
||||||
".venv",
|
|
||||||
"__pypackages__",
|
|
||||||
"_build",
|
|
||||||
"buck-out",
|
|
||||||
"build",
|
|
||||||
"dist",
|
|
||||||
"node_modules",
|
|
||||||
"venv",
|
|
||||||
]
|
|
||||||
|
|
||||||
line-length = 88
|
|
||||||
|
|
||||||
# Allow unused variables when underscore-prefixed.
|
|
||||||
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
|
|
||||||
|
|
||||||
target-version = "py311"
|
target-version = "py311"
|
||||||
|
|
||||||
[tool.ruff.mccabe]
|
[tool.ruff.lint]
|
||||||
# Unlike Flake8, default to a complexity level of 10.
|
extend-select = ["B", "UP"]
|
||||||
max-complexity = 10
|
fixable = ["I", "RUF100"]
|
||||||
|
unfixable = []
|
||||||
|
|
||||||
[tool.pyright]
|
[tool.pyright]
|
||||||
typeCheckingMode = "lazy"
|
typeCheckingMode = "lazy"
|
||||||
|
|||||||
Reference in New Issue
Block a user