Skip to content

Commit 288cf47

Browse files
authored
Merge pull request #111 from epage/template
Template
2 parents 4a56219 + eb34a50 commit 288cf47

File tree

6 files changed

+170
-63
lines changed

6 files changed

+170
-63
lines changed

.clippy.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
warn-on-all-wildcard-imports = true
21
allow-print-in-tests = true
32
allow-expect-in-tests = true
43
allow-unwrap-in-tests = true

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
name: Test
3535
strategy:
3636
matrix:
37-
os: ["ubuntu-latest", "windows-latest", "macos-14"]
37+
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
3838
rust: ["stable"]
3939
continue-on-error: ${{ matrix.rust != 'stable' }}
4040
runs-on: ${{ matrix.os }}

.github/workflows/rust-next.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
name: Test
2222
strategy:
2323
matrix:
24-
os: ["ubuntu-latest", "windows-latest", "macos-latest", "macos-14"]
24+
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
2525
rust: ["stable", "beta"]
2626
include:
2727
- os: ubuntu-latest
@@ -53,7 +53,7 @@ jobs:
5353
toolchain: stable
5454
- uses: Swatinem/rust-cache@v2
5555
- uses: taiki-e/install-action@cargo-hack
56-
- name: Update dependencues
56+
- name: Update dependencies
5757
run: cargo update
5858
- name: Build
5959
run: cargo test --workspace --no-run

CONTRIBUTING.md

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,27 +37,42 @@ to re-work some of it and the discouragement that goes along with that.
3737

3838
### Process
3939

40-
Before posting a PR, we request that the commit history get cleaned up.
41-
However, we recommend avoiding this during the review to make it easier to
42-
check how feedback was handled. Once the PR is ready, we'll ask you to clean up
43-
the commit history from the review. Once you let us know this is done, we can
44-
move forward with merging! If you are uncomfortable with these parts of git,
45-
let us know and we can help.
46-
47-
For commit messages, we use [Conventional](https://www.conventionalcommits.org)
48-
style. If you already wrote your commits and don't feel comfortable changing
49-
them, don't worry and go ahead and create your PR. We'll work with you on the
50-
best route forward. You can check your branch locally with
51-
[`committed`](https://github.com/crate-ci/committed).
52-
5340
As a heads up, we'll be running your PR through the following gauntlet:
5441
- warnings turned to compile errors
5542
- `cargo test`
5643
- `rustfmt`
5744
- `clippy`
5845
- `rustdoc`
59-
- [`committed`](https://github.com/crate-ci/committed)
60-
- [`typos`](https://github.com/crate-ci/typos)
46+
- [`committed`](https://github.com/crate-ci/committed) as we use [Conventional](https://www.conventionalcommits.org) commit style
47+
- [`typos`](https://github.com/crate-ci/typos) to check spelling
48+
49+
Not everything can be checked automatically though.
50+
51+
We request that the commit history gets cleaned up.
52+
We ask that commits are atomic, meaning they are complete and have a single responsibility.
53+
PRs should tell a cohesive story, with test and refactor commits that keep the
54+
fix or feature commits simple and clear.
55+
56+
Specifically, we would encouage
57+
- File renames be isolated into their own commit
58+
- Add tests in a commit before their feature or fix, showing the current behavior.
59+
The diff for the feature/fix commit will then show how the behavior changed,
60+
making it clearer to reviewrs and the community and showing people that the
61+
test is verifying the expected state.
62+
- e.g. [clap#5520](https://github.com/clap-rs/clap/pull/5520)
63+
64+
Note that we are talking about ideals.
65+
We understand having a clean history requires more advanced git skills;
66+
feel free to ask us for help!
67+
We might even suggest where it would work to be lax.
68+
We also understand that editing some early commits may cause a lot of churn
69+
with merge conflicts which can make it not worth editing all of the history.
70+
71+
For code organization, we recommend
72+
- Grouping `impl` blocks next to their type (or trait)
73+
- Grouping private items after the `pub` item that uses them.
74+
- The intent is to help people quickly find the "relevant" details, allowing them to "dig deeper" as needed. Or put another way, the `pub` items serve as a table-of-contents.
75+
- The exact order is fuzzy; do what makes sense
6176

6277
## Releasing
6378

Cargo.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ include = [
2121
]
2222

2323
[workspace.lints.rust]
24-
rust_2018_idioms = "warn"
24+
rust_2018_idioms = { level = "warn", priority = -1 }
2525
unreachable_pub = "warn"
2626
unsafe_op_in_unsafe_fn = "warn"
2727
unused_lifetimes = "warn"
@@ -55,15 +55,13 @@ inconsistent_struct_constructor = "warn"
5555
inefficient_to_string = "warn"
5656
infinite_loop = "warn"
5757
invalid_upcast_comparisons = "warn"
58-
items_after_statements = "warn"
5958
large_digit_groups = "warn"
6059
large_stack_arrays = "warn"
6160
large_types_passed_by_value = "warn"
6261
let_and_return = "allow" # sometimes good to name what you are returning
6362
linkedlist = "warn"
6463
lossy_float_literal = "warn"
6564
macro_use_imports = "warn"
66-
match_wildcard_for_single_variants = "warn"
6765
mem_forget = "warn"
6866
mutex_integer = "warn"
6967
needless_continue = "warn"
@@ -78,7 +76,6 @@ rest_pat_in_fully_bound_structs = "warn"
7876
same_functions_in_if_condition = "warn"
7977
self_named_module_files = "warn"
8078
semicolon_if_nothing_returned = "warn"
81-
single_match_else = "warn"
8279
str_to_string = "warn"
8380
string_add = "warn"
8481
string_add_assign = "warn"

deny.toml

Lines changed: 136 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,82 @@
44
# * allow - No warning or error will be produced, though in some cases a note
55
# will be
66

7+
# Root options
8+
9+
# The graph table configures how the dependency graph is constructed and thus
10+
# which crates the checks are performed against
11+
[graph]
12+
# If 1 or more target triples (and optionally, target_features) are specified,
13+
# only the specified targets will be checked when running `cargo deny check`.
14+
# This means, if a particular package is only ever used as a target specific
15+
# dependency, such as, for example, the `nix` crate only being used via the
16+
# `target_family = "unix"` configuration, that only having windows targets in
17+
# this list would mean the nix crate, as well as any of its exclusive
18+
# dependencies not shared by any other crates, would be ignored, as the target
19+
# list here is effectively saying which targets you are building for.
20+
targets = [
21+
# The triple can be any string, but only the target triples built in to
22+
# rustc (as of 1.40) can be checked against actual config expressions
23+
#"x86_64-unknown-linux-musl",
24+
# You can also specify which target_features you promise are enabled for a
25+
# particular target. target_features are currently not validated against
26+
# the actual valid features supported by the target architecture.
27+
#{ triple = "wasm32-unknown-unknown", features = ["atomics"] },
28+
]
29+
# When creating the dependency graph used as the source of truth when checks are
30+
# executed, this field can be used to prune crates from the graph, removing them
31+
# from the view of cargo-deny. This is an extremely heavy hammer, as if a crate
32+
# is pruned from the graph, all of its dependencies will also be pruned unless
33+
# they are connected to another crate in the graph that hasn't been pruned,
34+
# so it should be used with care. The identifiers are [Package ID Specifications]
35+
# (https://doc.rust-lang.org/cargo/reference/pkgid-spec.html)
36+
#exclude = []
37+
# If true, metadata will be collected with `--all-features`. Note that this can't
38+
# be toggled off if true, if you want to conditionally enable `--all-features` it
39+
# is recommended to pass `--all-features` on the cmd line instead
40+
all-features = false
41+
# If true, metadata will be collected with `--no-default-features`. The same
42+
# caveat with `all-features` applies
43+
no-default-features = false
44+
# If set, these feature will be enabled when collecting metadata. If `--features`
45+
# is specified on the cmd line they will take precedence over this option.
46+
#features = []
47+
48+
# The output table provides options for how/if diagnostics are outputted
49+
[output]
50+
# When outputting inclusion graphs in diagnostics that include features, this
51+
# option can be used to specify the depth at which feature edges will be added.
52+
# This option is included since the graphs can be quite large and the addition
53+
# of features from the crate(s) to all of the graph roots can be far too verbose.
54+
# This option can be overridden via `--feature-depth` on the cmd line
55+
feature-depth = 1
56+
757
# This section is considered when running `cargo deny check advisories`
858
# More documentation for the advisories section can be found here:
959
# https://embarkstudios.github.io/cargo-deny/checks/advisories/cfg.html
1060
[advisories]
11-
# The lint level for security vulnerabilities
12-
vulnerability = "deny"
13-
# The lint level for unmaintained crates
14-
unmaintained = "warn"
15-
# The lint level for crates that have been yanked from their source registry
16-
yanked = "warn"
17-
# The lint level for crates with security notices. Note that as of
18-
# 2019-12-17 there are no security notice advisories in
19-
# https://github.com/rustsec/advisory-db
20-
notice = "warn"
61+
# The path where the advisory databases are cloned/fetched into
62+
#db-path = "$CARGO_HOME/advisory-dbs"
63+
# The url(s) of the advisory databases to use
64+
#db-urls = ["https://github.com/rustsec/advisory-db"]
2165
# A list of advisory IDs to ignore. Note that ignored advisories will still
2266
# output a note when they are encountered.
23-
#
24-
# e.g. "RUSTSEC-0000-0000",
2567
ignore = [
68+
#"RUSTSEC-0000-0000",
69+
#{ id = "RUSTSEC-0000-0000", reason = "you can specify a reason the advisory is ignored" },
70+
#"[email protected]", # you can also ignore yanked crate versions if you wish
71+
#{ crate = "[email protected]", reason = "you can specify why you are ignoring the yanked crate" },
2672
]
73+
# If this is true, then cargo deny will use the git executable to fetch advisory database.
74+
# If this is false, then it uses a built-in git library.
75+
# Setting this to true can be helpful if you have special authentication requirements that cargo-deny does not support.
76+
# See Git Authentication for more information about setting up git authentication.
77+
#git-fetch-with-cli = true
2778

2879
# This section is considered when running `cargo deny check licenses`
2980
# More documentation for the licenses section can be found here:
3081
# https://embarkstudios.github.io/cargo-deny/checks/licenses/cfg.html
3182
[licenses]
32-
unlicensed = "deny"
3383
# List of explicitly allowed licenses
3484
# See https://spdx.org/licenses/ for list of possible licenses
3585
# [possible values: any SPDX 3.11 short identifier (+ optional exception)].
@@ -42,26 +92,8 @@ allow = [
4292
"Unicode-DFS-2016",
4393
"CC0-1.0",
4494
"ISC",
95+
"OpenSSL",
4596
]
46-
# List of explicitly disallowed licenses
47-
# See https://spdx.org/licenses/ for list of possible licenses
48-
# [possible values: any SPDX 3.11 short identifier (+ optional exception)].
49-
deny = [
50-
]
51-
# Lint level for licenses considered copyleft
52-
copyleft = "deny"
53-
# Blanket approval or denial for OSI-approved or FSF Free/Libre licenses
54-
# * both - The license will be approved if it is both OSI-approved *AND* FSF
55-
# * either - The license will be approved if it is either OSI-approved *OR* FSF
56-
# * osi-only - The license will be approved if is OSI-approved *AND NOT* FSF
57-
# * fsf-only - The license will be approved if is FSF *AND NOT* OSI-approved
58-
# * neither - This predicate is ignored and the default lint level is used
59-
allow-osi-fsf-free = "neither"
60-
# Lint level used when no other predicates are matched
61-
# 1. License isn't in the allow or deny lists
62-
# 2. License isn't copyleft
63-
# 3. License isn't OSI/FSF, or allow-osi-fsf-free = "neither"
64-
default = "deny"
6597
# The confidence threshold for detecting a license from license text.
6698
# The higher the value, the more closely the license text must be to the
6799
# canonical license text of a valid SPDX license file.
@@ -72,7 +104,25 @@ confidence-threshold = 0.8
72104
exceptions = [
73105
# Each entry is the crate and version constraint, and its specific allow
74106
# list
75-
#{ allow = ["Zlib"], name = "adler32", version = "*" },
107+
#{ allow = ["Zlib"], crate = "adler32" },
108+
]
109+
110+
# Some crates don't have (easily) machine readable licensing information,
111+
# adding a clarification entry for it allows you to manually specify the
112+
# licensing information
113+
[[licenses.clarify]]
114+
# The package spec the clarification applies to
115+
crate = "ring"
116+
# The SPDX expression for the license requirements of the crate
117+
expression = "MIT AND ISC AND OpenSSL"
118+
# One or more files in the crate's source used as the "source of truth" for
119+
# the license expression. If the contents match, the clarification will be used
120+
# when running the license check, otherwise the clarification will be ignored
121+
# and the crate will be checked normally, which may produce warnings or errors
122+
# depending on the rest of your configuration
123+
license-files = [
124+
# Each entry is a crate relative path, and the (opaque) hash of its contents
125+
{ path = "LICENSE", hash = 0xbd0eed23 }
76126
]
77127

78128
[licenses.private]
@@ -81,6 +131,12 @@ exceptions = [
81131
# To see how to mark a crate as unpublished (to the official registry),
82132
# visit https://doc.rust-lang.org/cargo/reference/manifest.html#the-publish-field.
83133
ignore = true
134+
# One or more private registries that you might publish crates to, if a crate
135+
# is only published to private registries, and ignore is true, the crate will
136+
# not have its license(s) checked
137+
registries = [
138+
#"https://sekretz.com/registry
139+
]
84140

85141
# This section is considered when running `cargo deny check bans`.
86142
# More documentation about the 'bans' section can be found here:
@@ -89,7 +145,7 @@ ignore = true
89145
# Lint level for when multiple versions of the same crate are detected
90146
multiple-versions = "warn"
91147
# Lint level for when a crate version requirement is `*`
92-
wildcards = "warn"
148+
wildcards = "allow"
93149
# The graph highlighting used when creating dotgraphs for crates
94150
# with multiple versions
95151
# * lowest-version - The path to the lowest versioned duplicate is highlighted
@@ -106,17 +162,53 @@ workspace-default-features = "allow"
106162
external-default-features = "allow"
107163
# List of crates that are allowed. Use with care!
108164
allow = [
109-
#{ name = "ansi_term", version = "=0.11.0" },
165+
166+
#{ crate = "[email protected]", reason = "you can specify a reason it is allowed" },
110167
]
111168
# List of crates to deny
112169
deny = [
113-
# Each entry the name of a crate and a version range. If version is
114-
# not specified, all versions will be matched.
115-
#{ name = "ansi_term", version = "=0.11.0" },
116-
#
170+
171+
#{ crate = "[email protected]", reason = "you can specify a reason it is banned" },
117172
# Wrapper crates can optionally be specified to allow the crate when it
118173
# is a direct dependency of the otherwise banned crate
119-
#{ name = "ansi_term", version = "=0.11.0", wrappers = [] },
174+
#{ crate = "[email protected]", wrappers = ["this-crate-directly-depends-on-ansi_term"] },
175+
]
176+
177+
# List of features to allow/deny
178+
# Each entry the name of a crate and a version range. If version is
179+
# not specified, all versions will be matched.
180+
#[[bans.features]]
181+
#crate = "reqwest"
182+
# Features to not allow
183+
#deny = ["json"]
184+
# Features to allow
185+
#allow = [
186+
# "rustls",
187+
# "__rustls",
188+
# "__tls",
189+
# "hyper-rustls",
190+
# "rustls",
191+
# "rustls-pemfile",
192+
# "rustls-tls-webpki-roots",
193+
# "tokio-rustls",
194+
# "webpki-roots",
195+
#]
196+
# If true, the allowed features must exactly match the enabled feature set. If
197+
# this is set there is no point setting `deny`
198+
#exact = true
199+
200+
# Certain crates/versions that will be skipped when doing duplicate detection.
201+
skip = [
202+
203+
#{ crate = "[email protected]", reason = "you can specify a reason why it can't be updated/removed" },
204+
]
205+
# Similarly to `skip` allows you to skip certain crates during duplicate
206+
# detection. Unlike skip, it also includes the entire tree of transitive
207+
# dependencies starting at the specified crate, up to a certain depth, which is
208+
# by default infinite.
209+
skip-tree = [
210+
#"[email protected]", # will be skipped along with _all_ of its direct and transitive dependencies
211+
#{ crate = "[email protected]", depth = 20 },
120212
]
121213

122214
# This section is considered when running `cargo deny check sources`.
@@ -138,3 +230,7 @@ allow-git = []
138230
[sources.allow-org]
139231
# 1 or more github.com organizations to allow git sources for
140232
github = []
233+
# 1 or more gitlab.com organizations to allow git sources for
234+
gitlab = []
235+
# 1 or more bitbucket.org organizations to allow git sources for
236+
bitbucket = []

0 commit comments

Comments
 (0)