Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README to reflect fork #2

Merged
merged 1 commit into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 45 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
# 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
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

Create a file (ex: `.github/workflows/ruff.yml`) inside your repository with:

```yaml
Expand All @@ -24,38 +36,59 @@ jobs:
```

## 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.
- args: You can specify the arguments to pass to the ruff command. By default, it's `check`.
- src: default, '.'
The Ruff action can be customized via optional configuration parameters passed
to Ruff (using `with:`):

- `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
See
[Configuring Ruff](https://github.com/astral-sh/ruff/blob/main/docs/configuration.md)
for details

### Use a different ruff version

```yaml
- uses: chartboost/ruff-action@v1
with:
version: 0.2.2
```

### Specify a different source directory

```yaml
- uses: chartboost/ruff-action@v1
with:
src: './src'
src: "./src"
```

### Use `ruff format`

```yaml
- uses: chartboost/ruff-action@v1
with:
args: 'format --check'
args: "format --check"
```

### Only run ruff on changed files

```yaml
- uses: chartboost/ruff-action@v1
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>
44 changes: 5 additions & 39 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,46 +1,12 @@
[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]+?))$"

[tool.ruff]
target-version = "py311"

[tool.ruff.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 10

[tool.ruff.lint]
extend-select = ["B", "UP"]
fixable = ["I", "RUF100"]
unfixable = []

[tool.pyright]
typeCheckingMode = "lazy"
Expand Down