Skip to content

Commit ad64d32

Browse files
committed
Add precious config and run on files
1 parent 94d533f commit ad64d32

File tree

4 files changed

+68
-12
lines changed

4 files changed

+68
-12
lines changed

.githooks/pre-commit

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
#
3+
# Git pre-commit hook that runs precious lint on staged files
4+
#
5+
6+
set -e
7+
8+
echo "Running precious lint on staged files..."
9+
10+
# Run precious lint on staged files
11+
if ! precious lint --staged; then
12+
echo ""
13+
echo "Linting failed. Please fix the issues above before committing."
14+
echo ""
15+
echo "To fix formatting issues automatically, run:"
16+
echo " precious tidy --staged"
17+
exit 1
18+
fi
19+
20+
echo "All linters passed!"

.github/workflows/rust.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Rust
33
on:
44
push:
55
branches-ignore:
6-
- 'dependabot/**'
6+
- "dependabot/**"
77
pull_request:
88

99
env:

.precious.toml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
exclude = [
2+
"target/**/*",
3+
"test-data/**/*",
4+
"supply-chain/**/*",
5+
]
6+
7+
[commands.clippy]
8+
type = "lint"
9+
include = "**/*.rs"
10+
invoke = "once"
11+
path-args = "none"
12+
cmd = ["cargo", "clippy", "--all-features", "--", "-D", "warnings"]
13+
ok-exit-codes = [0]
14+
lint-failure-exit-codes = [101]
15+
expect-stderr = true
16+
17+
[commands.rustfmt]
18+
type = "both"
19+
include = "**/*.rs"
20+
invoke = "once"
21+
path-args = "none"
22+
cmd = ["cargo", "fmt"]
23+
lint-flags = "--check"
24+
ok-exit-codes = [0]
25+
lint-failure-exit-codes = [1]
26+
27+
[commands.prettier]
28+
type = "both"
29+
include = ["**/*.md", "**/*.yml", "**/*.yaml"]
30+
invoke = "once"
31+
path-args = "file"
32+
cmd = ["prettier"]
33+
lint-flags = "--check"
34+
tidy-flags = "--write"
35+
ok-exit-codes = [0]
36+
lint-failure-exit-codes = [1]
37+
expect-stderr = true

README.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
# Rust MaxMind DB Reader #
1+
# Rust MaxMind DB Reader
22

3-
[![crates.io]( https://img.shields.io/crates/v/maxminddb.svg)](https://crates.io/crates/maxminddb) [![Released API docs](https://docs.rs/maxminddb/badge.svg)](http://docs.rs/maxminddb)
3+
[![crates.io](https://img.shields.io/crates/v/maxminddb.svg)](https://crates.io/crates/maxminddb) [![Released API docs](https://docs.rs/maxminddb/badge.svg)](http://docs.rs/maxminddb)
44

55
This library reads the MaxMind DB format, including the GeoIP2 and GeoLite2
66
databases.
77

8-
## Building ##
8+
## Building
99

1010
To build everything:
1111

1212
```
1313
cargo build
1414
```
1515

16-
## Testing ##
16+
## Testing
1717

1818
This crate manages its test data within a git submodule.
1919
To run the tests, you will first need to run the following command.
@@ -22,7 +22,7 @@ To run the tests, you will first need to run the following command.
2222
git submodule update --init
2323
```
2424

25-
## Usage ##
25+
## Usage
2626

2727
Add this to your `Cargo.toml`:
2828

@@ -37,15 +37,15 @@ and this to your crate root:
3737
extern crate maxminddb;
3838
```
3939

40-
## API Documentation ##
40+
## API Documentation
4141

4242
The API docs are on [Docs.rs](https://docs.rs/maxminddb/latest/maxminddb/struct.Reader.html).
4343

44-
## Example ##
44+
## Example
4545

4646
See [`examples/lookup.rs`](https://github.com/oschwald/maxminddb-rust/blob/main/examples/lookup.rs) for a basic example.
4747

48-
## Benchmarks ##
48+
## Benchmarks
4949

5050
The projects include benchmarks using [Criterion.rs](https://github.com/bheisler/criterion.rs).
5151

@@ -68,12 +68,11 @@ Result of doing 100 random IP lookups:
6868

6969
![](/assets/pdf_small.svg)
7070

71-
## Contributing ##
71+
## Contributing
7272

7373
Contributions welcome! Please fork the repository and open a pull request
7474
with your changes.
7575

76-
## License ##
76+
## License
7777

7878
This is free software, licensed under the ISC license.
79-

0 commit comments

Comments
 (0)