Skip to content

Commit

Permalink
chore: add Makefile and git hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
cmackenzie1 committed Oct 8, 2023
1 parent 12aeab7 commit 88db798
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 2 deletions.
24 changes: 24 additions & 0 deletions .hooks/pre-commit
@@ -0,0 +1,24 @@
#!/bin/sh

set -eu

if ! cargo fmt -- --check
then
echo "There are some code style issues."
echo "Run cargo fmt first."
exit 1
fi

if ! cargo clippy --all-targets -- -D warnings
then
echo "There are some clippy issues."
exit 1
fi

if ! cargo test
then
echo "There are some test issues."
exit 1
fi

exit 0
20 changes: 20 additions & 0 deletions Makefile
@@ -0,0 +1,20 @@
fmt:
@cargo fmt

build:
@cargo build

clean:
@cargo clean

test:
@cargo test

lint: fmt
@cargo clippy --all-targets -- -D warnings

git-hooks:
@echo "Installing git hooks..."
@cp -r .hooks/* .git/hooks/
@chmod +x .git/hooks/*
@echo "Done."
3 changes: 1 addition & 2 deletions src/formatter.rs
Expand Up @@ -210,8 +210,7 @@ mod tests {

use super::*;
use chrono::Utc;
use tracing::{debug, error, info, info_span, trace, warn};
use tracing_core::Level;
use tracing::{info, info_span};
use tracing_subscriber::fmt::{MakeWriter, SubscriberBuilder};

#[derive(Clone, Debug)]
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Expand Up @@ -21,6 +21,8 @@
//! ```
//!
//! ```rust
//! use tracing_subscriber::prelude::*;
//!
//! tracing_subscriber::registry()
//! .with(tracing_ndjson::builder().layer())
//! .init();
Expand Down

0 comments on commit 88db798

Please sign in to comment.