commit 2b38e292395e1bf3d3f8891fe329b84def5853fe Author: soul-walker <31162815+soul-walker@users.noreply.github.com> Date: Thu Aug 8 15:58:56 2024 +0800 项目初始化 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..4a19a33 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,50 @@ +fail_fast: false +repos: + - repo: https://gitea.joylink.club/pre-commit/pre-commit-hooks + rev: v4.3.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: 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: 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/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..625ed1f --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "rtss_simulation" +version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..2a4cd21 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "rtss_simulation" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/README.md b/README.md new file mode 100644 index 0000000..e446914 --- /dev/null +++ b/README.md @@ -0,0 +1,54 @@ +# rtss-simulation +轨道交通信号系统仿真模块 + +## 环境设置说明 + +### 安装 Rust + +```bash +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh +``` + +### 推荐安装的 VSCode 插件 + +- Dependi: Rust 包管理 +- Even Better TOML: TOML 文件支持 +- Better Comments: 优化注释显示 +- Error Lens: 错误提示优化 +- GitLens — Git supercharged: Git 增强 +- Github Copilot: 代码提示 +- indent-rainbow: 缩进显示优化 +- Prettier - Code formatter: 代码格式化 +- REST client: REST API 调试 +- rust-analyzer: Rust 语言支持 +- Rust Test lens: Rust 测试支持 +- Rust Test Explorer: Rust 测试概览 +- TODO Highlight: TODO 高亮 +- vscode-icons: 图标优化 +- YAML: YAML 文件支持 + +### 安装 pre-commit + +pre-commit 是一个代码检查工具,可以在提交代码前进行代码检查。 + +```bash +pipx install pre-commit +``` + +安装成功后运行 `pre-commit install` 即可。 + +### 安装 typos + +typos 是一个拼写检查工具。 + +```bash +cargo install typos-cli +``` + +### 安装 cargo nextest + +cargo nextest 是一个 Rust 增强测试工具。 + +```bash +cargo install cargo-nextest --locked +``` diff --git a/_typos.toml b/_typos.toml new file mode 100644 index 0000000..645e149 --- /dev/null +++ b/_typos.toml @@ -0,0 +1,4 @@ +[default.extend-words] + +[files] +extend-exclude = ["README.md"] diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +}