Closed16
Rust Repo 初期設定メモ

cargo new rust-base

cd rust-base

RustRover

git remote add origin https://dddrop@github.com/dddrop/rust-base.git

cargo install cargo-deny

cargo deny init

cargo deny check
error[unlicensed]: rust-base = 0.1.0 is unlicensed
┌─ path+file:///Users/dddrop/Development/rust-base#0.1.0:2:9
│
2 │ name = "rust-base"
│ ━━━━━━━━━ a valid license expression could not be retrieved for the crate
3 │ version = "0.1.0"
4 │ license = ""
│ ─ license expression was not specified
│
├ rust-base v0.1.0
advisories ok, bans ok, licenses FAILED, sources ok

diff --git a/Cargo.toml b/Cargo.toml
index d655fdb..b47f8d9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -2,5 +2,6 @@
name = "rust-base"
version = "0.1.0"
edition = "2021"
+license = "MIT"
[dependencies]
cargo deny check
error[rejected]: failed to satisfy license requirements
┌─ path+file:///Users/dddrop/Development/rust-base#0.1.0:4:12
│
4 │ license = "MIT"
│ ━━━
│ │
│ license expression retrieved via Cargo.toml `license`
│ rejected: license is not explicitly allowed
│
├ MIT - MIT License:
├ - OSI approved
├ - FSF Free/Libre
├ rust-base v0.1.0
advisories ok, bans ok, licenses FAILED, sources ok

diff --git a/deny.toml b/deny.toml
index bd776cf..d49cff0 100644
--- a/deny.toml
+++ b/deny.toml
@@ -89,7 +89,7 @@ ignore = [
# See https://spdx.org/licenses/ for list of possible licenses
# [possible values: any SPDX 3.11 short identifier (+ optional exception)].
allow = [
- #"MIT",
+ "MIT",
#"Apache-2.0",
#"Apache-2.0 WITH LLVM-exception",
]
cargo deny check
advisories ok, bans ok, licenses ok, sources ok

cargo install --locked typos-cli

cargo install --locked git-cliff

cargo install --locked cargo-nextest

pip install pre-commit

# .pre-commit-config.yaml
fail_fast: false
repo:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-byte-order-marker
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: v24.8.0
hooks:
- id: black
- repo: local
hooks:
- id: cargo-fmt
name: cargo fmt
description: Format files with rustfmt.
entry: bash -c 'cargo fmt -- --check'
language: rust
files: \.rs$
args: []
- id: cargo-deny
name: cargo deny check
description: Check cargo dependencies
entry: bash -c 'cargo deny check -d'
language: rust
files: \.rs$
args: []
- id: typos
name: typos
description: check typo
entry: bash -c 'typos'
language: rust
files: \.*$
pass_filenames: false
- id: cargo-check
name: cargo check
description: Check the package for errors.
entry: bash -c 'cargo check --all'
language: rust
files: \.rs$
pass_filenames: false
- id: cargo-clippy
name: cargo clippy
description: Lint rust sources
entry: bash -c 'cargo clippy --all-targets --all-features --tests --benches -- -D warnings'
language: rust
files: \.rs$
pass_filenames: false
- id: cargo-test
name: cargo test
description: unit test for the project
entry: bash -c 'cargo nextest run --all-features'
language: rust
files: \.rs$
pass_filenames: false
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..1f028b7
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,64 @@
+fail_fast: false
+
+repo:
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v4.6.0
+ hooks:
+ - id: check-byte-order-marker
+ - id: check-case-conflict
+ - id: check-merge-conflict
+ - id: check-symlinks
+ - id: check-yaml
+ - id: end-of-file-fixer
+ - id: mixed-line-ending
+ - id: trailing-whitespace
+
+ - repo: https://github.com/psf/black
+ rev: v24.8.0
+ hooks:
+ - id: black
+
+ - repo: local
+ hooks:
+ - id: cargo-fmt
+ name: cargo fmt
+ description: Format files with rustfmt.
+ entry: bash -c 'cargo fmt -- --check'
+ language: rust
+ files: \.rs$
+ args: []
+ - id: cargo-deny
+ name: cargo deny check
+ description: Check cargo dependencies
+ entry: bash -c 'cargo deny check -d'
+ language: rust
+ files: \.rs$
+ args: []
+ - id: typos
+ name: typos
+ description: check typo
+ entry: bash -c 'typos'
+ language: rust
+ files: \.*$
+ pass_filenames: false
+ - id: cargo-check
+ name: cargo check
+ description: Check the package for errors.
+ entry: bash -c 'cargo check --all'
+ language: rust
+ files: \.rs$
+ pass_filenames: false
+ - id: cargo-clippy
+ name: cargo clippy
+ description: Lint rust sources
+ entry: bash -c 'cargo clippy --all-targets --all-features --tests --benches -- -D warnings'
+ language: rust
+ files: \.rs$
+ pass_filenames: false
+ - id: cargo-test
+ name: cargo test
+ description: unit test for the project
+ entry: bash -c 'cargo nextest run --all-features'
+ language: rust
+ files: \.rs$
+ pass_filenames: false
pre-commit install

git cliff --init

git cliff -o CHANGELOG.md
このスクラップは2024/09/13にクローズされました