Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit f15d4b97 authored by Dorian Turba's avatar Dorian Turba
Browse files

add ruff

parent 95ff81e1
No related branches found
No related tags found
No related merge requests found
## Objective
Run [Ruff](https://github.com/ruffle-rs/ruffle), an extremely fast Python linter, on your Python
code. This tool is written in Rust, and it is designed to quickly analyze your Python code to detect
various syntax and stylistic errors.
## How to use it
1. Configure the `pyproject.toml` file in your repository's root directory with your desired rules.
2. Include the Ruff template in your GitLab CI/CD configuration.
3. If you need to customize the job, refer to
the [jobs customization](https://docs.r2devops.io/get-started/use-templates/#job-templates-customization)
documentation.
### Global Configuration of Ruff
To add configuration to `ruff` that is shared with any other usage of Ruff (such as manual run,
pre-commit, etc), you can use a `pyproject.toml` configuration file in your project's root
directory. Learn more about [ruff configuration](https://beta.ruff.rs/docs/configuration/) files.
## Add a <a href="https://github.com/ruffle-rs/ruffle"><img alt="Code style: Ruff" src="https://img.shields.io/badge/Ruff-Linter-blue"></a> Badge to your project README.md
To display the use of Ruff in your project, you can add the following badge to your README.md:
```markdown
<a href="https://github.com/ruffle-rs/ruffle">
<img alt="Code style: Ruff" src="https://img.shields.io/badge/Ruff-Linter-blue">
</a>
```
ruff:
image: python:latest
stage: code_quality
script:
- python --version # Debug
- python -m venv venv --upgrade-deps || python -m venv venv # upgrade-deps is not supported before 3.9
- source venv/bin/activate
- pip install ruff
- ruff
only:
changes:
- ./**/*.py
- .gitlab-ci.yml
- pyproject.toml
files:
template: ./python/code_quality/ruff/ruff.yml
documentation: ./python/code_quality/ruff/README.md
data:
description: "Run ruff on your repository"
icon: 💎
public: true
labels:
- Lint
- Utilities
- Code Quality
- Python
license: MIT
deprecated: false
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment