Skip to content

Commit

Permalink
Clippy test
Browse files Browse the repository at this point in the history
  • Loading branch information
Aif4thah committed Sep 16, 2024
1 parent c2392b5 commit 5e739e9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Rust
name: Rust quality test

on:
push:
Expand All @@ -8,6 +8,7 @@ on:

env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-Dwarnings" # Make sure CI fails on all warnings, including Clippy lints

jobs:
build:
Expand All @@ -16,6 +17,9 @@ jobs:

steps:
- uses: actions/checkout@v4
-name: Run Clippy
working-directory: ./quality
run: cargo clippy --all-targets --all-features
- name: Build
working-directory: ./quality
run: cargo build --verbose
Expand Down
20 changes: 18 additions & 2 deletions Dojo-101-DevSec/Rust-security.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ démo des fonctions de sécurité de RUST
rustc.exe .\Rust-security.rs
```

## Toolchains

la version stable est recommandée

```powershell
rustup toolchain list
```

## Créer un projet avec dépendances

```powershell
Expand All @@ -28,6 +36,16 @@ Les versions des dépendances sont alors spécifié dans le fichier `Cargo.toml`
Pour mettre à jour des dépendances : `cargo-update`


## Test & linter

[Clippy](https://github.com/rust-lang/rust-clippy)

Installé par défaut, si non `rustup component add clippy` (priviliger cette commande à `cargo` pour ne pas l'avoir en dépendance)

```
cargo clippy
```

## Test via CI/CD

### github actions
Expand Down Expand Up @@ -162,5 +180,3 @@ fn concurrency() {
println!("Result: {}", *counter.lock().unwrap());
}
```

### dépendances
4 changes: 2 additions & 2 deletions quality/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fn main() {
let mut files = vec![];
let mut non_markdown_files = vec![];

for entry in WalkDir::new(&parent_dir).min_depth(2).max_depth(3) {
for entry in WalkDir::new(parent_dir).min_depth(2).max_depth(3) {
let entry = entry.unwrap();
let path = entry.path();

Expand Down Expand Up @@ -63,7 +63,7 @@ fn main() {
// 2. Vérifie qu'il n'y a pas de dossier dans les sous dossiers


for entry in WalkDir::new(&parent_dir).min_depth(1).max_depth(1) {
for entry in WalkDir::new(parent_dir).min_depth(1).max_depth(1) {
let entry = entry.unwrap();
let path = entry.path();
if path.is_dir() {
Expand Down

0 comments on commit 5e739e9

Please sign in to comment.