Skip to content

Commit

Permalink
feat: add Makefile to easy fix-lint and test in local
Browse files Browse the repository at this point in the history
  • Loading branch information
hoank101 committed Jan 11, 2025
1 parent e8438b4 commit f5c8177
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
fmt:
cd code && cargo +nightly fmt

lint:
cd code && cargo fmt --all --check

lint-fix:
make fmt
cd code && cargo clippy --fix --allow-dirty --workspace -- -D warnings

test:
cd code && cargo test
1 change: 1 addition & 0 deletions code/crates/starknet/p2p-proto/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
config.bytes(["."]);
config.enable_type_names();
config.default_package_filename("p2p");
config.disable_comments(["."]); // This will disable doc comments generation
config.compile_protos(protos, &["./proto"])?;

Ok(())
Expand Down
9 changes: 5 additions & 4 deletions code/crates/test/cli/src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ pub fn init(log_level: LogLevel, log_format: LogFormat) -> WorkerGuard {
guard
}

/// Check if both stdout and stderr are proper terminal (tty),
/// so that we know whether or not to enable colored output,
/// using ANSI escape codes. If either is not, eg. because
/// stdout is redirected to a file, we don't enable colored output.
/// Checks if output is going to a terminal.
///
/// Determines if both stdout and stderr are proper terminals (TTY).
/// This helps decide whether to enable colored output with ANSI escape codes.
/// Colors are disabled when output is redirected to a file.
pub fn enable_ansi() -> bool {
use std::io::IsTerminal;
std::io::stdout().is_terminal() && std::io::stderr().is_terminal()
Expand Down

0 comments on commit f5c8177

Please sign in to comment.