add pre-commit hook

This commit is contained in:
creating2morrow 2024-01-02 13:57:33 -05:00
parent e34f38cf38
commit 7d6c792c6a
4 changed files with 31 additions and 2 deletions

View file

@ -1,8 +1,11 @@
#![deny(clippy::all)] #![deny(clippy::all)]
#![forbid(unsafe_code)] #![forbid(unsafe_code)]
use egui::{RichText, Color32};
use eframe::egui; use eframe::egui;
use egui::{
Color32,
RichText,
};
use image::Luma; use image::Luma;
use neveko_core::*; use neveko_core::*;
use qrcode::QrCode; use qrcode::QrCode;
@ -423,7 +426,6 @@ impl eframe::App for HomeApp {
.size(16.0) .size(16.0)
.color(color), .color(color),
).on_hover_text(hover_txt); ).on_hover_text(hover_txt);
}); });
}); });
ui.horizontal(|ui| { ui.horizontal(|ui| {

View file

@ -1,4 +1,8 @@
#!/bin/bash #!/bin/bash
# set the latest pre-commit script
cp -u scripts/pre-commit.sample .git/hooks/pre-commit
cd neveko-auth && cargo build cd neveko-auth && cargo build
cd ../neveko-contact && cargo build cd ../neveko-contact && cargo build
cd ../neveko-core && cargo build cd ../neveko-core && cargo build

10
scripts/check_all.sh Executable file
View file

@ -0,0 +1,10 @@
#!/bin/bash
# Run from the neveko root
cd neveko-auth && cargo check
cd ../neveko-contact && cargo check
cd ../neveko-core && cargo check
cd ../neveko-gui && cargo check
cd ../neveko-market && cargo check
cd ../neveko-message && cargo check
cd ../ && cargo check

13
scripts/pre-commit.sample Executable file
View file

@ -0,0 +1,13 @@
#!/usr/bin/env bash
# Run the formatter and linter before commits
# If any command fails exit immediately with that code
set -eo pipefail
# Check source without compiling
./scripts/check_all.sh
echo "source code checks passed"
# Run the formatter
./scripts/fmtall.sh
echo "source code formatting complete"