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

Ruff CI/CD job

Ruff Pipeline License: MIT

Objective

Run Ruff, an extremely fast Python linter, on your Python code.

How to use it

  1. Configure ruff for your project
  2. Include the ruff component in your CI/CD pipeline (GitLab/GitHub compatible)

GitLab

Add the following to your .gitlab-ci.yml file:

include:
  - component: $CI_SERVER_FQDN/swepy/cicd-templates/ruff/ruff@4.0.0

Supported by GitLab.com Supported by Frogg.it

See more for GitLab here: docs/gitlab.md.

GitHub

Add the following jobs to your .github/workflows lint file:

jobs:
  ruff_check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: ruff check
        uses: astral-sh/ruff-action@v1
  ruff_format:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: ruff format
        uses: astral-sh/ruff-action@v1
        with:
          args: "format --check"

See more for GitHub here: github/marketplace/ruff-action.

Add an official Ruff 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:

[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)

A more "classic" version of the badge (Code style: Ruff) is also available:

[![Code style: Ruff](https://img.shields.io/badge/Linter-Ruff-blue)](https://github.com/astral-sh/ruff)