Skip to content

Commit

Permalink
add pre-commit config (#61)
Browse files Browse the repository at this point in the history
* add pre-commit config

* run pre-commit checks in CI

* fix typos
  • Loading branch information
code-inflation authored Feb 4, 2024
1 parent 5368613 commit cc32196
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: pre-commit

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/action@v3.0.0
21 changes: 21 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-yaml
stages: [commit]
- id: check-json
stages: [commit]
- id: check-toml
stages: [commit]
- id: check-merge-conflict
stages: [commit]
- id: check-case-conflict
stages: [commit]
- id: detect-private-key
stages: [commit]
- repo: https://github.com/crate-ci/typos
rev: v1.16.20
hooks:
- id: typos
stages: [commit]
4 changes: 2 additions & 2 deletions src/measurements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ fn log_measurements_by_test_type(
if !type_measurements.is_empty() {
let (min, q1, median, q3, max, avg) = calc_stats(type_measurements).unwrap();

let formated_payload = format_bytes(payload_size);
let formatted_payload = format_bytes(payload_size);
let fmt_test_type = format!("{:?}", test_type);
stat_measurements.push(StatMeasurement {
test_type,
Expand All @@ -118,7 +118,7 @@ fn log_measurements_by_test_type(
});
if output_format == OutputFormat::StdOut {
println!(
"{fmt_test_type:<9} {formated_payload:<7}| min {min:<7.2} max {max:<7.2} avg {avg:<7.2}"
"{fmt_test_type:<9} {formatted_payload:<7}| min {min:<7.2} max {max:<7.2} avg {avg:<7.2}"
);
if verbose {
let plot = boxplot::render_plot(min, q1, median, q3, max);
Expand Down

0 comments on commit cc32196

Please sign in to comment.