Commit 312e4c15 authored by Valentin Guyon's avatar Valentin Guyon Committed by Thibaud-Vdb
Browse files

feat(job): new job cargo_clippy

parent a956eba9
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ CI
ci
cli
CLIPPY
Clippy
clippy
clj
CLOUDFORMATION
@@ -95,6 +96,7 @@ DOCKERFILE
Dockerfile
dockerfilelint
Docstring
Docusaurus
DoD
dotenv
dotnet
@@ -215,6 +217,9 @@ markdownlint
Marp
marp
md
mdBook
mdbook
MDX
minify
Mkdocs
mkdocs
@@ -401,6 +406,8 @@ vm
Vue
vue
vulns
webpack
Webpack
webserver
Wordlists
wordlists
@@ -411,9 +418,3 @@ YamlLint
Yamllint
yamllint
zaproxy
mdBook
mdbook
Docusaurus
MDX
webpack
Webpack
+30 −0
Original line number Diff line number Diff line
## Objective

Clippy runs a format check onto your Rust project and logs any unexpected linting warning or error in your project into the pipeline.

## How to use it

1. By default, the job will not fail when encountering warnings or errors. If you want the job to fail, change `ADDITIONAL_OPTIONS` value to `-- -D clippy::all`.
1. If you want to add more options into the `clippy` command, please check the official [documentation](https://github.com/rust-lang/rust-clippy#readme){:target="_blank"}.
1. Add this job URL inside the `include` list of your `.gitlab-ci.yml` file (see the [quick setup](/use-the-hub/#quick-setup)). You can specify [a fixed version](#changelog) instead of `latest`.
    ```yaml
      - remote: 'https://jobs.r2devops.io/latest/cargo_clippy.yml'
    ```
1. If you need to customize the job (stage, variables, ...) 👉 check the [jobs
   customization](/use-the-hub/#jobs-customization){:target="_blank"}
1. Well done, your job is ready to work ! 😀

## Job details

* Job name: `cargo_clippy`
* Docker image:
[`rust:1.57-buster`](https://hub.docker.com/r/_/rust){:target="_blank"}
* Default stage: `static_tests`
* When: `always`

### Variables

| Name | Description | Default |
| ---- | ----------- | ------- |
| `PROJECT_ROOT` <img width=100/> | Relative to root of your repository, it is the path to your rust project <img width=175/>| `.` <img width=100/>|
| `ADDITIONAL_OPTIONS` <img width=100/> | Possibility to add more options into the command <img width=175/>| `-- -W clippy::all` <img width=100/>|
+21 −0
Original line number Diff line number Diff line
# Job from R2Devops hub --> r2devops.io

stages:
  - static_tests

cargo_clippy:

  image:
    name: rust:1.57-buster
    entrypoint: [""]

  stage: static_tests

  variables:
    PROJECT_ROOT: "."
    ADDITIONAL_OPTIONS: "-- -W clippy::all"

  script:
    - cd ${PROJECT_ROOT}
    - rustup component add clippy
    - cargo clippy ${ADDITIONAL_OPTIONS}
+12 −0
Original line number Diff line number Diff line
name: cargo_clippy
description: Run a format check onto your Rust project and prevent the pipeline to pass if there is any unexpected linting warning / error in your project.
default_stage: static_tests
icon: 📎
maintainer: valentin.guyon.vg
license: Apache-2.0
images:
  "rust": "1.57-buster"
tools:
  - Rust
  - Linter
  - Quality
+0 −0

Empty file added.

Loading