Skip to content

style: Make clippy happy #308

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
May 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e7b7555
chore: First step
epage Mar 29, 2023
d6b4446
docs: Set changelog base
epage Mar 29, 2023
afeff23
chore(ci): Quote strings in yaml
epage Mar 29, 2023
2768727
chore: Don't set rustflags by default
epage Mar 29, 2023
0838840
chore: Update release process
epage Mar 29, 2023
afd6a45
chore: Use workspace inheritance
epage Mar 29, 2023
037f379
chore(ci): Remove rustfmt/clippy next jobs
epage Mar 29, 2023
d1dd4ae
chore(ci): Expand approved licenses
epage Mar 29, 2023
6c8df60
chore: Include Cargo.lock
epage Mar 30, 2023
fbaab42
chore(deps): update msrv to v1.65.0
renovate[bot] Apr 1, 2023
29b981c
Merge pull request #1 from epage/renovate/rust-1.x
epage Apr 1, 2023
614b0a2
docs(contrib): Remove reference to travis
epage Mar 29, 2023
f7b990b
fix(ci): Fix Renovate regexes
epage Apr 17, 2023
4163ad7
style(ci): Match auto-generated style
epage Apr 17, 2023
563de12
chore(ci): Update stabilidyDays to new syntax
epage Apr 17, 2023
2c4a7f5
chore(ci): Delay Renovate PRs until ready
epage Apr 17, 2023
62401b8
chore(ci): Lower the MSRV churn for template
epage Apr 17, 2023
d99db2e
style(ci): Match auto-generated style
epage Apr 17, 2023
afaba35
chore(ci): Use new minimumReleaseAge field
epage Apr 17, 2023
60a8ec8
chore(ci): Ban for_each
epage Apr 18, 2023
96297f0
chore(ci): Clarify why map_or is banned
epage Apr 18, 2023
716170e
chore(gh): Ban rebase merges
epage Apr 18, 2023
80d4cdd
chore: Remove clippy lint past MSRV (needs 1.67)
epage May 18, 2023
2b6bb28
chore(ci): Catch clippy config failures
epage May 18, 2023
806a684
chore: Update from '_rust/main' template
epage May 19, 2023
7c96328
style: Make clippy happy
epage May 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .clippy.toml
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
msrv = "1.65.0" # MSRV
warn-on-all-wildcard-imports = true
allow-expect-in-tests = true
allow-unwrap-in-tests = true
allow-dbg-in-tests = true
disallowed-methods = [
{ path = "std::option::Option::map_or", reason = "prefer `map(..).unwrap_or(..)` for legibility" },
{ path = "std::option::Option::map_or_else", reason = "prefer `map(..).unwrap_or_else(..)` for legibility" },
{ path = "std::result::Result::map_or", reason = "prefer `map(..).unwrap_or(..)` for legibility" },
{ path = "std::result::Result::map_or_else", reason = "prefer `map(..).unwrap_or_else(..)` for legibility" },
{ path = "std::iter::Iterator::for_each", reason = "prefer `for` for side-effects" },
{ path = "std::iter::Iterator::try_for_each", reason = "prefer `for` for side-effects" },
]
69 changes: 54 additions & 15 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -1,26 +1,65 @@
{
"schedule": [
"before 3am on the first day of the month"
schedule: [
'before 3am on the first day of the month',
],
"semanticCommits": "enabled",
"configMigration": true,
"packageRules": [
semanticCommits: 'enabled',
configMigration: true,
dependencyDashboard: true,
regexManagers: [
{
fileMatch: [
'^rust-toolchain\\.toml$',
'Cargo.toml$',
'clippy.toml$',
'\\.clippy.toml$',
'^\\.github/workflows/ci.yml$',
'^\\.github/workflows/rust-next.yml$',
],
matchStrings: [
'MSRV.*?(?<currentValue>\\d+\\.\\d+(\\.\\d+)?)',
'(?<currentValue>\\d+\\.\\d+(\\.\\d+)?).*?MSRV',
],
depNameTemplate: 'rust',
packageNameTemplate: 'rust-lang/rust',
datasourceTemplate: 'github-releases',
},
],
packageRules: [
{
commitMessageTopic: 'MSRV',
matchManagers: [
'regex',
],
matchPackageNames: [
'rust',
],
minimumReleaseAge: "126 days", // 3 releases * 6 weeks per release * 7 days per week
internalChecksFilter: "strict",
},
// Goals:
// - Rollup safe upgrades to reduce CI runner load
// - Have lockfile and manifest in-sync
{
"matchManagers": ["cargo"],
"matchCurrentVersion": ">=0.1.0",
"matchUpdateTypes": ["patch"],
"automerge": true,
"groupName": "compatible",
matchManagers: [
'cargo',
],
matchCurrentVersion: '>=0.1.0',
matchUpdateTypes: [
'patch',
],
automerge: true,
groupName: 'compatible',
},
{
"matchManagers": ["cargo"],
"matchCurrentVersion": ">=1.0.0",
"matchUpdateTypes": ["minor"],
"automerge": true,
"groupName": "compatible",
matchManagers: [
'cargo',
],
matchCurrentVersion: '>=1.0.0',
matchUpdateTypes: [
'minor',
],
automerge: true,
groupName: 'compatible',
},
],
}
25 changes: 16 additions & 9 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,45 @@
# These settings are synced to GitHub by https://probot.github.io/apps/settings/

repository:
description: Stacked branch management for Git
topics: git rust cli
description: "Stacked branch management for Git"
topics: "git rust cli"
has_issues: true
has_projects: false
has_wiki: false
has_downloads: true
default_branch: main

allow_squash_merge: true
# Preference: people do clean commits
allow_merge_commit: true
allow_rebase_merge: true
# Backup in case we need to clean up commits
allow_squash_merge: true
# Not really needed
allow_rebase_merge: false

# Manual: allow_auto_merge: true, see https://github.com/probot/settings/issues/402
allow_auto_merge: true
delete_branch_on_merge: true

squash_merge_commit_title: "PR_TITLE"
squash_merge_commit_message: "PR_BODY"
merge_commit_message: "PR_BODY"

labels:
# Type
- name: bug
color: '#b60205'
description: Not as expected
description: "Not as expected"
- name: enhancement
color: '#1d76db'
description: Improve the expected
description: "Improve the expected"
# Flavor
- name: question
color: "#cc317c"
description: Uncertainty is involved
description: "Uncertainty is involved"
- name: breaking-change
color: "#e99695"
- name: good first issue
color: '#c2e0c6'
description: Help wanted!
description: "Help wanted!"

branches:
- name: main
Expand Down
38 changes: 33 additions & 5 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,49 @@
name: Security audit

permissions:
contents: read

on:
pull_request:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
push:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
schedule:
- cron: '7 7 7 * *'
branches:
- main

env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
CLICOLOR: 1

jobs:
security_audit:
permissions:
issues: write # to create issues (actions-rs/audit-check)
checks: write # to create check (actions-rs/audit-check)
runs-on: ubuntu-latest
# Prevent sudden announcement of a new advisory from failing ci:
continue-on-error: true
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

cargo_deny:
permissions:
issues: write # to create issues (actions-rs/audit-check)
checks: write # to create check (actions-rs/audit-check)
runs-on: ubuntu-latest
strategy:
matrix:
checks:
- bans licenses sources
steps:
- uses: actions/checkout@v3
- uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check ${{ matrix.checks }}
rust-version: stable
8 changes: 8 additions & 0 deletions .github/workflows/committed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
name: Lint Commits
on: [pull_request]

permissions:
contents: read

env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
CLICOLOR: 1

jobs:
committed:
name: Lint Commits
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
name: pre-commit

permissions: {} # none

on:
pull_request:
push:
branches: [main]

env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
CLICOLOR: 1

jobs:
pre-commit:
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
64 changes: 11 additions & 53 deletions .github/workflows/rust-next.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
name: rust-next

permissions:
contents: read

on:
schedule:
- cron: '7 7 7 * *'

env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
CLICOLOR: 1

jobs:
test:
name: Test
Expand All @@ -18,65 +28,13 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
- uses: Swatinem/rust-cache@v2
- name: Configure git
run: |
git config --global user.name "Test User"
git config --global user.email "test_user@example.com"
- name: Default features
run: cargo test --workspace
- name: All features
run: cargo test --workspace --all-features
- name: No-default features
run: cargo test --workspace --no-default-features
rustfmt:
name: rustfmt
strategy:
matrix:
rust:
- stable
- beta
continue-on-error: ${{ matrix.rust != 'stable' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
components: rustfmt
- uses: Swatinem/rust-cache@v2
- name: Check formatting
run: cargo fmt --all -- --check
clippy:
name: clippy
strategy:
matrix:
rust:
- 1.65.0 # MSRV
- stable
continue-on-error: ${{ matrix.rust != '1.65.0' }} # MSRV
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
components: clippy
- uses: Swatinem/rust-cache@v2
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --workspace --all-features --all-targets -- -D warnings
9 changes: 9 additions & 0 deletions .github/workflows/spelling.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
name: Spelling

permissions:
contents: read

on: [pull_request]

env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
CLICOLOR: 1

jobs:
spelling:
name: Spell Check with Typos
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
rev: v4.3.0
hooks:
- id: check-yaml
stages: [commit]
Expand All @@ -15,12 +15,12 @@ repos:
- id: detect-private-key
stages: [commit]
- repo: https://github.com/crate-ci/typos
rev: v1.4.1
rev: v1.11.1
hooks:
- id: typos
stages: [commit]
- repo: https://github.com/crate-ci/committed
rev: v1.0.1
rev: v1.0.4
hooks:
- id: committed
stages: [commit-msg]
21 changes: 9 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,19 @@ As a heads up, we'll be running your PR through the following gauntlet:
- `clippy`
- `rustdoc`

Check out our [CI][travis] for more information.

## Releasing

Pre-requisites
- Running `cargo login`
- A member of `ORG:Maintainers`
- Push permission to the repo
- [`cargo-release`](https://github.com/crate-ci/cargo-release/)

When we're ready to release, a project owner should do the following
- Determine what the next version is, according to semver
- Bump version in a commit
- Update CHANGELOG.md
- Update the version in `Cargo.toml`
- Update the dependency version in `src/lib.rs`
- Update the dependency version in `README.md`
- Tag the commit via `git tag -am "v<X>.<Y>.<Z>" v<X>.<Y>.<Z>`
- `git push upstream master --tag v<X>.<Y>.<Z>`
- Run `cargo publish` (run `cargo login` first if needed)
1. Update the changelog (see `cargo release changes` for ideas)
2. Determine what the next version is, according to semver
3. Run [`cargo release -x <level>`](https://github.com/crate-ci/cargo-release)

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