Skip to content

Commit 2540e10

Browse files
authored
Merge pull request #308 from epage/template
style: Make clippy happy
2 parents 74859a6 + 7c96328 commit 2540e10

File tree

15 files changed

+333
-107
lines changed

15 files changed

+333
-107
lines changed

.clippy.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
11
msrv = "1.65.0" # MSRV
2+
warn-on-all-wildcard-imports = true
3+
allow-expect-in-tests = true
4+
allow-unwrap-in-tests = true
5+
allow-dbg-in-tests = true
6+
disallowed-methods = [
7+
{ path = "std::option::Option::map_or", reason = "prefer `map(..).unwrap_or(..)` for legibility" },
8+
{ path = "std::option::Option::map_or_else", reason = "prefer `map(..).unwrap_or_else(..)` for legibility" },
9+
{ path = "std::result::Result::map_or", reason = "prefer `map(..).unwrap_or(..)` for legibility" },
10+
{ path = "std::result::Result::map_or_else", reason = "prefer `map(..).unwrap_or_else(..)` for legibility" },
11+
{ path = "std::iter::Iterator::for_each", reason = "prefer `for` for side-effects" },
12+
{ path = "std::iter::Iterator::try_for_each", reason = "prefer `for` for side-effects" },
13+
]

.github/renovate.json5

Lines changed: 54 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,65 @@
11
{
2-
"schedule": [
3-
"before 3am on the first day of the month"
2+
schedule: [
3+
'before 3am on the first day of the month',
44
],
5-
"semanticCommits": "enabled",
6-
"configMigration": true,
7-
"packageRules": [
5+
semanticCommits: 'enabled',
6+
configMigration: true,
7+
dependencyDashboard: true,
8+
regexManagers: [
9+
{
10+
fileMatch: [
11+
'^rust-toolchain\\.toml$',
12+
'Cargo.toml$',
13+
'clippy.toml$',
14+
'\\.clippy.toml$',
15+
'^\\.github/workflows/ci.yml$',
16+
'^\\.github/workflows/rust-next.yml$',
17+
],
18+
matchStrings: [
19+
'MSRV.*?(?<currentValue>\\d+\\.\\d+(\\.\\d+)?)',
20+
'(?<currentValue>\\d+\\.\\d+(\\.\\d+)?).*?MSRV',
21+
],
22+
depNameTemplate: 'rust',
23+
packageNameTemplate: 'rust-lang/rust',
24+
datasourceTemplate: 'github-releases',
25+
},
26+
],
27+
packageRules: [
28+
{
29+
commitMessageTopic: 'MSRV',
30+
matchManagers: [
31+
'regex',
32+
],
33+
matchPackageNames: [
34+
'rust',
35+
],
36+
minimumReleaseAge: "126 days", // 3 releases * 6 weeks per release * 7 days per week
37+
internalChecksFilter: "strict",
38+
},
839
// Goals:
940
// - Rollup safe upgrades to reduce CI runner load
1041
// - Have lockfile and manifest in-sync
1142
{
12-
"matchManagers": ["cargo"],
13-
"matchCurrentVersion": ">=0.1.0",
14-
"matchUpdateTypes": ["patch"],
15-
"automerge": true,
16-
"groupName": "compatible",
43+
matchManagers: [
44+
'cargo',
45+
],
46+
matchCurrentVersion: '>=0.1.0',
47+
matchUpdateTypes: [
48+
'patch',
49+
],
50+
automerge: true,
51+
groupName: 'compatible',
1752
},
1853
{
19-
"matchManagers": ["cargo"],
20-
"matchCurrentVersion": ">=1.0.0",
21-
"matchUpdateTypes": ["minor"],
22-
"automerge": true,
23-
"groupName": "compatible",
54+
matchManagers: [
55+
'cargo',
56+
],
57+
matchCurrentVersion: '>=1.0.0',
58+
matchUpdateTypes: [
59+
'minor',
60+
],
61+
automerge: true,
62+
groupName: 'compatible',
2463
},
2564
],
2665
}

.github/settings.yml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,45 @@
11
# These settings are synced to GitHub by https://probot.github.io/apps/settings/
22

33
repository:
4-
description: Stacked branch management for Git
5-
topics: git rust cli
4+
description: "Stacked branch management for Git"
5+
topics: "git rust cli"
66
has_issues: true
77
has_projects: false
88
has_wiki: false
99
has_downloads: true
1010
default_branch: main
1111

12-
allow_squash_merge: true
12+
# Preference: people do clean commits
1313
allow_merge_commit: true
14-
allow_rebase_merge: true
14+
# Backup in case we need to clean up commits
15+
allow_squash_merge: true
16+
# Not really needed
17+
allow_rebase_merge: false
1518

16-
# Manual: allow_auto_merge: true, see https://github.com/probot/settings/issues/402
19+
allow_auto_merge: true
1720
delete_branch_on_merge: true
1821

22+
squash_merge_commit_title: "PR_TITLE"
23+
squash_merge_commit_message: "PR_BODY"
24+
merge_commit_message: "PR_BODY"
25+
1926
labels:
2027
# Type
2128
- name: bug
2229
color: '#b60205'
23-
description: Not as expected
30+
description: "Not as expected"
2431
- name: enhancement
2532
color: '#1d76db'
26-
description: Improve the expected
33+
description: "Improve the expected"
2734
# Flavor
2835
- name: question
2936
color: "#cc317c"
30-
description: Uncertainty is involved
37+
description: "Uncertainty is involved"
3138
- name: breaking-change
3239
color: "#e99695"
3340
- name: good first issue
3441
color: '#c2e0c6'
35-
description: Help wanted!
42+
description: "Help wanted!"
3643

3744
branches:
3845
- name: main

.github/workflows/audit.yml

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,49 @@
11
name: Security audit
2+
3+
permissions:
4+
contents: read
5+
26
on:
37
pull_request:
48
paths:
59
- '**/Cargo.toml'
610
- '**/Cargo.lock'
711
push:
8-
paths:
9-
- '**/Cargo.toml'
10-
- '**/Cargo.lock'
11-
schedule:
12-
- cron: '7 7 7 * *'
12+
branches:
13+
- main
14+
15+
env:
16+
RUST_BACKTRACE: 1
17+
CARGO_TERM_COLOR: always
18+
CLICOLOR: 1
19+
1320
jobs:
1421
security_audit:
22+
permissions:
23+
issues: write # to create issues (actions-rs/audit-check)
24+
checks: write # to create check (actions-rs/audit-check)
1525
runs-on: ubuntu-latest
26+
# Prevent sudden announcement of a new advisory from failing ci:
27+
continue-on-error: true
1628
steps:
1729
- name: Checkout repository
1830
uses: actions/checkout@v3
1931
- uses: actions-rs/audit-check@v1
2032
with:
2133
token: ${{ secrets.GITHUB_TOKEN }}
34+
35+
cargo_deny:
36+
permissions:
37+
issues: write # to create issues (actions-rs/audit-check)
38+
checks: write # to create check (actions-rs/audit-check)
39+
runs-on: ubuntu-latest
40+
strategy:
41+
matrix:
42+
checks:
43+
- bans licenses sources
44+
steps:
45+
- uses: actions/checkout@v3
46+
- uses: EmbarkStudios/cargo-deny-action@v1
47+
with:
48+
command: check ${{ matrix.checks }}
49+
rust-version: stable

.github/workflows/committed.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
name: Lint Commits
44
on: [pull_request]
55

6+
permissions:
7+
contents: read
8+
9+
env:
10+
RUST_BACKTRACE: 1
11+
CARGO_TERM_COLOR: always
12+
CLICOLOR: 1
13+
614
jobs:
715
committed:
816
name: Lint Commits

.github/workflows/pre-commit.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
name: pre-commit
2+
3+
permissions: {} # none
4+
25
on:
36
pull_request:
47
push:
58
branches: [main]
9+
10+
env:
11+
RUST_BACKTRACE: 1
12+
CARGO_TERM_COLOR: always
13+
CLICOLOR: 1
14+
615
jobs:
716
pre-commit:
17+
permissions:
18+
contents: read
819
runs-on: ubuntu-latest
920
steps:
1021
- uses: actions/checkout@v3

.github/workflows/rust-next.yml

Lines changed: 11 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
name: rust-next
2+
3+
permissions:
4+
contents: read
5+
26
on:
37
schedule:
48
- cron: '7 7 7 * *'
9+
10+
env:
11+
RUST_BACKTRACE: 1
12+
CARGO_TERM_COLOR: always
13+
CLICOLOR: 1
14+
515
jobs:
616
test:
717
name: Test
@@ -18,65 +28,13 @@ jobs:
1828
- name: Checkout repository
1929
uses: actions/checkout@v3
2030
- name: Install Rust
21-
uses: actions-rs/toolchain@v1
31+
uses: dtolnay/rust-toolchain@stable
2232
with:
2333
toolchain: ${{ matrix.rust }}
24-
profile: minimal
25-
override: true
2634
- uses: Swatinem/rust-cache@v2
27-
- name: Configure git
28-
run: |
29-
git config --global user.name "Test User"
30-
git config --global user.email "test_user@example.com"
3135
- name: Default features
3236
run: cargo test --workspace
3337
- name: All features
3438
run: cargo test --workspace --all-features
3539
- name: No-default features
3640
run: cargo test --workspace --no-default-features
37-
rustfmt:
38-
name: rustfmt
39-
strategy:
40-
matrix:
41-
rust:
42-
- stable
43-
- beta
44-
continue-on-error: ${{ matrix.rust != 'stable' }}
45-
runs-on: ubuntu-latest
46-
steps:
47-
- name: Checkout repository
48-
uses: actions/checkout@v3
49-
- name: Install Rust
50-
uses: actions-rs/toolchain@v1
51-
with:
52-
toolchain: ${{ matrix.rust }}
53-
profile: minimal
54-
override: true
55-
components: rustfmt
56-
- uses: Swatinem/rust-cache@v2
57-
- name: Check formatting
58-
run: cargo fmt --all -- --check
59-
clippy:
60-
name: clippy
61-
strategy:
62-
matrix:
63-
rust:
64-
- 1.65.0 # MSRV
65-
- stable
66-
continue-on-error: ${{ matrix.rust != '1.65.0' }} # MSRV
67-
runs-on: ubuntu-latest
68-
steps:
69-
- name: Checkout repository
70-
uses: actions/checkout@v3
71-
- name: Install Rust
72-
uses: actions-rs/toolchain@v1
73-
with:
74-
toolchain: ${{ matrix.rust }}
75-
profile: minimal
76-
override: true
77-
components: clippy
78-
- uses: Swatinem/rust-cache@v2
79-
- uses: actions-rs/clippy-check@v1
80-
with:
81-
token: ${{ secrets.GITHUB_TOKEN }}
82-
args: --workspace --all-features --all-targets -- -D warnings

.github/workflows/spelling.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
name: Spelling
2+
3+
permissions:
4+
contents: read
5+
26
on: [pull_request]
37

8+
env:
9+
RUST_BACKTRACE: 1
10+
CARGO_TERM_COLOR: always
11+
CLICOLOR: 1
12+
413
jobs:
514
spelling:
615
name: Spell Check with Typos

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v2.3.0
3+
rev: v4.3.0
44
hooks:
55
- id: check-yaml
66
stages: [commit]
@@ -15,12 +15,12 @@ repos:
1515
- id: detect-private-key
1616
stages: [commit]
1717
- repo: https://github.com/crate-ci/typos
18-
rev: v1.4.1
18+
rev: v1.11.1
1919
hooks:
2020
- id: typos
2121
stages: [commit]
2222
- repo: https://github.com/crate-ci/committed
23-
rev: v1.0.1
23+
rev: v1.0.4
2424
hooks:
2525
- id: committed
2626
stages: [commit-msg]

CONTRIBUTING.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,19 @@ As a heads up, we'll be running your PR through the following gauntlet:
5454
- `clippy`
5555
- `rustdoc`
5656

57-
Check out our [CI][travis] for more information.
58-
5957
## Releasing
6058

59+
Pre-requisites
60+
- Running `cargo login`
61+
- A member of `ORG:Maintainers`
62+
- Push permission to the repo
63+
- [`cargo-release`](https://github.com/crate-ci/cargo-release/)
64+
6165
When we're ready to release, a project owner should do the following
62-
- Determine what the next version is, according to semver
63-
- Bump version in a commit
64-
- Update CHANGELOG.md
65-
- Update the version in `Cargo.toml`
66-
- Update the dependency version in `src/lib.rs`
67-
- Update the dependency version in `README.md`
68-
- Tag the commit via `git tag -am "v<X>.<Y>.<Z>" v<X>.<Y>.<Z>`
69-
- `git push upstream master --tag v<X>.<Y>.<Z>`
70-
- Run `cargo publish` (run `cargo login` first if needed)
66+
1. Update the changelog (see `cargo release changes` for ideas)
67+
2. Determine what the next version is, according to semver
68+
3. Run [`cargo release -x <level>`](https://github.com/crate-ci/cargo-release)
7169

7270
[issues]: https://github.com/gitext-rs/git-stack/issues
7371
[new issue]: https://github.com/gitext-rs/git-stack/issues/new
7472
[all issues]: https://github.com/gitext-rs/git-stack/issues?utf8=%E2%9C%93&q=is%3Aissue
75-
[travis]: https://github.com/gitext-rs/git-stack/blob/master/.travis.yml

0 commit comments

Comments
 (0)