Skip to content

Commit 5956ef0

Browse files
committed
CI: Run pre-commit
1 parent d81aa25 commit 5956ef0

30 files changed

Lines changed: 542 additions & 274 deletions

.codespellignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 slowtec GmbH <post@slowtec.de>
2+
# SPDX-License-Identifier: CC0-1.0
3+
4+
crate

.github/workflows/continuous_integration.yaml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 slowtec GmbH <post@slowtec.de>
2+
# SPDX-License-Identifier: CC0-1.0
3+
14
name: Continuous integration
25

36
on:
@@ -21,21 +24,21 @@ jobs:
2124
- x86_64-apple-darwin
2225
- x86_64-pc-windows-msvc
2326
include:
24-
- target: x86_64-unknown-linux-gnu
27+
- target: x86_64-unknown-linux-gnu
2528
runner_os: ubuntu-latest
2629
- target: x86_64-apple-darwin
2730
runner_os: macos-latest
2831
- target: x86_64-pc-windows-msvc
2932
runner_os: windows-latest
3033

3134
steps:
32-
- name: Checkout code
33-
uses: actions/checkout@v2
34-
3535
- name: Install Rust toolchain
36-
uses: actions-rs/toolchain@v1
36+
uses: dtolnay/rust-toolchain@stable
3737
with:
38-
profile: minimal
38+
targets: ${{ matrix.target }}
39+
40+
- name: Checkout code
41+
uses: actions/checkout@v4
3942

4043
- name: Install all-features cargo subcommand
4144
uses: actions-rs/cargo@v1

.github/workflows/pre-commit.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 slowtec GmbH <post@slowtec.de>
2+
# SPDX-License-Identifier: CC0-1.0
3+
4+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow
5+
6+
name: pre-commit
7+
8+
permissions:
9+
contents: read
10+
11+
on:
12+
pull_request:
13+
push:
14+
branches:
15+
- "*"
16+
workflow_dispatch:
17+
18+
env:
19+
CARGO_TERM_COLOR: always
20+
21+
jobs:
22+
run:
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- name: Setup Python
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: "3.x"
30+
31+
- name: Install Rust toolchain
32+
uses: dtolnay/rust-toolchain@stable
33+
with:
34+
components: clippy, rustfmt
35+
36+
- name: Check out repository
37+
uses: actions/checkout@v4
38+
39+
- name: Generate Cargo.lock
40+
run: cargo generate-lockfile
41+
42+
- name: Cache Rust toolchain and build artifacts
43+
uses: Swatinem/rust-cache@v2
44+
with:
45+
# The cache should not be shared between different workflows and jobs.
46+
shared-key: ${{ github.workflow }}-${{ github.job }}
47+
48+
- name: Detect code style issues (push)
49+
uses: pre-commit/action@v3.0.1
50+
if: github.event_name == 'push'
51+
52+
- name: Detect code style issues (pull_request)
53+
uses: pre-commit/action@v3.0.1
54+
if: github.event_name == 'pull_request'
55+
env:
56+
SKIP: no-commit-to-branch

.github/workflows/security_audit.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 slowtec GmbH <post@slowtec.de>
2+
# SPDX-License-Identifier: CC0-1.0
3+
14
name: Security audit
25
on:
36
push:
47
paths:
5-
- '**/Cargo.toml'
6-
- '**/Cargo.lock'
8+
- "**/Cargo.toml"
9+
- "**/Cargo.lock"
710
# schedule:
811
# - cron: '0 0 * * *'
912

.gitignore

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 slowtec GmbH <post@slowtec.de>
2+
# SPDX-License-Identifier: CC0-1.0
3+
4+
# Don't add any custom patterns for platform-specific files like .DS_Store
5+
# or generated by custom development tools like .vscode or .idea that don't
6+
# affect other developers. Instead add those custom patterns to your global
7+
# .gitignore file that can be configured by setting core.excludesFile.
8+
# See also: https://git-scm.com/docs/gitignore
9+
10+
# Cargo artifacts
11+
/Cargo.lock
12+
13+
# Build directories (or a symbolic link, i.e. without a trailing slash)
114
/target
2-
**/*.rs.bk
3-
**/*.rs.swp
4-
Cargo.lock

.markdownlint-cli2.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2018-2024 slowtec GmbH <post@slowtec.de>
2+
# SPDX-License-Identifier: CC0-1.0
3+
4+
# Disable some built-in rules
5+
config:
6+
default: true
7+
8+
# The same headline in different nested sections is okay (and necessary for
9+
# CHANGELOG.md).
10+
no-duplicate-header:
11+
allow_different_nesting: true
12+
13+
# We use ordered lists to make stuff easier to read in a text editor.
14+
ol-prefix:
15+
style: ordered
16+
17+
# Not wrapping long lines makes diffs easier to read, especially for prose.
18+
# Instead, we should follow the "one sentence per line" pattern.
19+
line-length: false
20+
21+
# Dollar signs are useful to indicate shell commands/type and help
22+
# distinguishing wrapped lines from new commands.
23+
commands-show-output: false
24+
25+
# Indented code blocks are easier to read in a text editor, but don't allow
26+
# specifying a language for syntax highlighting. Therefore both indented and
27+
# fenced code block should be allowed depending on the use case.
28+
code-block-style: false
29+
30+
# MD024/no-duplicate-heading: Multiple headings with the same content
31+
# Used in CHANGELOG.md
32+
no-duplicate-heading: false
33+
34+
# MD026/no-trailing-punctuation: Trailing punctuation in heading
35+
# Used in README.md
36+
no-trailing-punctuation: false
37+
38+
# Fix any fixable errors
39+
fix: true
40+
41+
# Disable inline config comments
42+
noInlineConfig: true
43+
44+
# Disable progress on stdout (only valid at root)
45+
noProgress: true

.pre-commit-config.yaml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2017-2025 slowtec GmbH <post@slowtec.de>
2+
# SPDX-License-Identifier: CC0-1.0
3+
4+
default_stages:
5+
# Prevent that hooks run twice, triggered by both
6+
# the Git commit-msg and the pre-commit hook.
7+
- commit
8+
9+
repos:
10+
- repo: https://github.com/pre-commit/pre-commit-hooks
11+
rev: v4.6.0
12+
hooks:
13+
- id: check-case-conflict
14+
- id: check-json
15+
- id: check-merge-conflict
16+
- id: check-symlinks
17+
- id: check-toml
18+
- id: check-xml
19+
- id: check-yaml
20+
- id: destroyed-symlinks
21+
- id: detect-private-key
22+
- id: end-of-file-fixer
23+
- id: fix-byte-order-marker
24+
- id: forbid-new-submodules
25+
- id: mixed-line-ending
26+
- id: trailing-whitespace
27+
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
28+
rev: v9.16.0
29+
hooks:
30+
- id: commitlint
31+
stages:
32+
- commit-msg
33+
- repo: https://github.com/DavidAnson/markdownlint-cli2
34+
rev: v0.13.0
35+
hooks:
36+
- id: markdownlint-cli2
37+
- repo: https://github.com/shellcheck-py/shellcheck-py
38+
rev: v0.10.0.1
39+
hooks:
40+
- id: shellcheck
41+
- repo: https://github.com/codespell-project/codespell
42+
rev: v2.3.0
43+
hooks:
44+
- id: codespell
45+
args: [--ignore-words=.codespellignore]
46+
- repo: https://github.com/sirosen/check-jsonschema
47+
rev: 0.28.6
48+
hooks:
49+
- id: check-github-actions
50+
- id: check-github-workflows
51+
- repo: https://github.com/pre-commit/mirrors-prettier
52+
rev: v3.1.0
53+
hooks:
54+
- id: prettier
55+
types_or:
56+
- yaml
57+
- markdown
58+
# https://reuse.software
59+
- repo: https://github.com/fsfe/reuse-tool
60+
rev: v3.1.0a1
61+
hooks:
62+
- id: reuse
63+
- repo: https://github.com/doublify/pre-commit-rust
64+
rev: v1.0
65+
hooks:
66+
- id: fmt
67+
args: [--all, --]
68+
- id: clippy
69+
name: clippy --all-features
70+
args:
71+
[
72+
--locked,
73+
--workspace,
74+
--all-features,
75+
--all-targets,
76+
--,
77+
-D,
78+
warnings,
79+
]
80+
- id: clippy
81+
name: clippy --no-default-features
82+
args:
83+
[
84+
--locked,
85+
--workspace,
86+
--no-default-features,
87+
--all-targets,
88+
--,
89+
-D,
90+
warnings,
91+
]
92+
- repo: local
93+
hooks:
94+
- id: cargo-doc
95+
name: cargo-doc
96+
entry: env RUSTDOCFLAGS=-Dwarnings cargo
97+
language: system
98+
pass_filenames: false
99+
args: [doc, --locked, --workspace, --all-features, --no-deps]

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
<!-- SPDX-FileCopyrightText: Copyright (c) 2018-2025 slowtec GmbH <post@slowtec.de> -->
2+
<!-- SPDX-License-Identifier: MIT OR Apache-2.0 -->
3+
14
# Changelog
25

36
## v0.1.1 (2025-02-23)

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 slowtec GmbH <post@slowtec.de>
2+
# SPDX-License-Identifier: MIT OR Apache-2.0
3+
14
[package]
25
name = "modbus-core"
36
description = "Modbus base library"
47
version = "0.1.1"
58
authors = ["slowtec GmbH", "Markus Kohlhase <markus.kohlhase@slowtec.de>"]
6-
license = "MIT/Apache-2.0"
9+
license = "MIT OR Apache-2.0"
710
keywords = ["fieldbus", "modbus", "hardware", "automation"]
811
homepage = "https://github.com/slowtec/modbus-core"
912
repository = "https://github.com/slowtec/modbus-core"
@@ -21,14 +24,11 @@ std = ["byteorder/std"]
2124
defmt = ["dep:defmt"]
2225

2326
[dependencies]
24-
log = { version = "0.4.26" }
27+
log = { version = "0.4.28" }
2528
byteorder = { version = "1.5.0", default-features = false }
2629

2730
[target.'cfg(target_os = "none")'.dependencies]
2831
defmt = { version = "1.0.1", optional = true }
2932

30-
31-
32-
3333
[badges]
3434
maintenance = { status = "actively-developed" }

0 commit comments

Comments
 (0)