From c80c8edf70398d50365bfcbb6cc9e811f77e375e Mon Sep 17 00:00:00 2001 From: Martin Milata Date: Wed, 8 Sep 2021 13:50:56 +0200 Subject: [PATCH] ci(core): add rustfmt to style checks [no changelog] --- Makefile | 13 +++++++++++-- ci/shell.nix | 3 +++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6869a5160..67249ce64 100644 --- a/Makefile +++ b/Makefile @@ -9,9 +9,9 @@ PY_FILES = $(shell find . -type f -name '*.py' | grep -f ./tools/style.py.incl C_FILES = $(shell find . -type f -name '*.[ch]' | grep -f ./tools/style.c.include | grep -v -f ./tools/style.c.exclude ) -style_check: pystyle_check cstyle_check changelog_check yaml_check editor_check ## run all style checks (C+Py) +style_check: pystyle_check ruststyle_check cstyle_check changelog_check yaml_check editor_check ## run all style checks -style: pystyle cstyle ## apply all code styles (C+Py) +style: pystyle ruststyle cstyle ## apply all code styles (C+Rust+Py) pystyle_check: ## run code style check on application sources and tests flake8 --version @@ -71,6 +71,15 @@ defs_check: ## check validity of coin definitions and protobuf files python3 common/protob/check.py python3 common/protob/graph.py common/protob/*.proto +ruststyle: + @echo [RUSTFMT] + @cd core/embed/rust ; cargo fmt + +ruststyle_check: + rustfmt --version + @echo [RUSTFMT] + @cd core/embed/rust ; cargo fmt -- --check + ## code generation commands: mocks: ## generate mock python headers from C modules diff --git a/ci/shell.nix b/ci/shell.nix index 0f5fc3230..10d8a29c9 100644 --- a/ci/shell.nix +++ b/ci/shell.nix @@ -28,6 +28,9 @@ let "thumbv7em-none-eabihf" # TT "thumbv7m-none-eabi" # T1 ]; + # we use rustfmt from nixpkgs because it's built with the nighly flag needed for wrap_comments + # to use official binary, remove rustfmt from buildInputs below and uncomment next line: + # extensions = [ "rustfmt" ]; }; in with nixpkgs;