Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
gabyx committed Jun 28, 2024
1 parent 65fec11 commit 70be11e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 8 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4

- name: format
run: |
source .gitlab/scripts/before-script.sh &&
Expand All @@ -54,14 +55,20 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4

- name: lint
run: |
source .gitlab/scripts/before-script.sh &&
just nix-develop just l
continue-on-error: true
just nix-develop just lint
- name: lint-undefined-behavior
run: |
source .gitlab/scripts/before-script.sh &&
just nix-develop just lint-ub
- name: allow to fail
if: failure()
run: echo "Lint failed -> continue."
run: echo "lint-up failed -> continue."

build:
runs-on: ubuntu-latest
Expand All @@ -70,6 +77,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4

- name: build
run: |
source .gitlab/scripts/before-script.sh &&
Expand All @@ -86,6 +94,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4

- name: test
run: |
source .gitlab/scripts/before-script.sh &&
Expand All @@ -98,6 +107,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4

- name: package (nix)
run: |
source .gitlab/scripts/before-script.sh &&
Expand Down
5 changes: 5 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ lint *args:
cd "{{root_dir}}" && \
"{{root_dir}}/tools/lint-rust.sh" {{args}}

# Lint all code (undefined behavior).
lint-ub *args:
cd "{{root_dir}}" && \
"{{root_dir}}/tools/lint-ub-rust.sh" {{args}}

## ============================================================================


Expand Down
7 changes: 2 additions & 5 deletions tools/lint-rust.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@ cd "$ROOT_DIR"

cargo --version
cargo clippy --version
cargo miri --version

print_info "Run Rust Clippy linter."
print_warning "Currently warnings are not errors!"

cargo clippy --no-deps -- -A clippy::needless_return "$@" ||
die "Rust clippy failed."

print_info "Run Rust Miri to check undefined behaviour."
cargo miri test "$@" ||
die "Rust Miri failed."
16 changes: 16 additions & 0 deletions tools/lint-ub-rust.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
# shellcheck disable=SC1090,SC1091
set -e
set -u

ROOT_DIR=$(git rev-parse --show-toplevel)
. "$ROOT_DIR/tools/general.sh"

cd "$ROOT_DIR"

cargo --version
cargo miri --version

print_info "Run Rust Miri to check undefined behaviour."
cargo miri test "$@" ||
die "Rust Miri failed."

0 comments on commit 70be11e

Please sign in to comment.