Browse Source

Merge branch 'kcommaille/ci-clippy' into 'main'

ci: Improve clippy output

See merge request World/fractal!2151
merge-requests/2151/merge
Kévin Commaille 1 week ago
parent
commit
9e5a9980ae
  1. 13
      .gitlab-ci/check.yml
  2. 7
      Cargo.toml

13
.gitlab-ci/check.yml

@ -20,13 +20,18 @@ flatpak-checks:
- flatpak
interruptible: true
variables:
CARGO_CODECLIMATE_DOWNLOAD_URL: "https://gitlab.com/woshilapin/cargo-sonar/-/releases/1.3.1/downloads/bin/x86_64-unknown-linux-musl/cargo-codeclimate"
CARGO_CODECLIMATE_SHA256SUM: "401d1cf22d2f1b6f1986b479517c31e0544e8b7ecbb70f30e684ca7c171a0f17"
CARGO_CODECLIMATE_DOWNLOAD_URL: "https://gitlab.com/woshilapin/cargo-sonar/-/releases/1.5.0/downloads/bin/x86_64-unknown-linux-musl/cargo-codeclimate"
CARGO_CODECLIMATE_SHA256SUM: "3343a9c4e8b11fc5bdd63fbdecd883e5d37af1ca03414c289c7d57613146c1cf"
script:
# Initialize the Flatpak sandbox.
- flatpak-builder --keep-build-dirs --user --disable-rofiles-fuse --stop-at=${FLATPAK_MODULE} flatpak_app --repo=repo ${BRANCH:+--default-branch=$BRANCH} ${MANIFEST_PATH}
# Lint the Rust code with clippy.
- echo "cargo clippy --message-format=json -- -D warnings > clippy-report.json " | flatpak-builder --disable-rofiles-fuse --build-shell=${FLATPAK_MODULE} flatpak_app ${MANIFEST_PATH}
# We need to run it twice: the first time generates the JSON output for the
# code quality report, and the second time generates the regular output with
# more details.
- echo "cargo clippy --message-format=json -- -D warnings > clippy-report.json || cargo clippy -- -D warnings" | flatpak-builder --disable-rofiles-fuse --build-shell=${FLATPAK_MODULE} flatpak_app ${MANIFEST_PATH}
# Move the report file or it will be deleted when running the next command.
- mv .flatpak-builder/build/${FLATPAK_MODULE}/_flatpak_build/clippy-report.json ./
# Lint the Blueprint files.
- echo "blueprint-compiler format ../src" | flatpak-builder --disable-rofiles-fuse --build-shell=${FLATPAK_MODULE} flatpak_app ${MANIFEST_PATH}
# Lint the Meson files.
@ -39,7 +44,7 @@ flatpak-checks:
- sha256sum -c cargo-codeclimate.sha256sum
- chmod +x cargo-codeclimate
# Convert the clippy report to CodeClimate / GitLab Code Quality format.
- ./cargo-codeclimate --clippy --clippy-path .flatpak-builder/build/${FLATPAK_MODULE}/_flatpak_build/clippy-report.json
- ./cargo-codeclimate --clippy --clippy-path clippy-report.json
artifacts:
reports:
codequality: codeclimate.json

7
Cargo.toml

@ -4,11 +4,14 @@ version = "13.0.0"
authors = ["Julian Sparber <julian@sparber.net>"]
license = "GPL-3.0-or-later"
edition = "2024"
rust-version = "1.88"
rust-version = "1.93"
publish = false
[package.metadata.cargo-machete]
ignored = ["serde_bytes"] # Used by the SecretFile API.
ignored = [
# Used by the SecretFile API.
"serde_bytes",
]
[profile.release]
debug = true

Loading…
Cancel
Save