Skip to content

Commit c8be65e

Browse files
chore: add automatic validation with precommit on CI side (#30)
pre-commit will auto-fix formatting and other minor things in the PRs (server-side!), without bugging contributors. Note how I only added the precommit config file, and the rest of the fixes were auto-contributed by the CI - without bugging the contributors or the maintainers Note that this requires the repo to be enabled in the https://pre-commit.ci/ --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 656de45 commit c8be65e

File tree

4 files changed

+44
-5
lines changed

4 files changed

+44
-5
lines changed

.pre-commit-config.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
exclude: |
4+
(?x)^(
5+
.+\.(dbc|DBC)
6+
)$
7+
8+
repos:
9+
- repo: https://github.com/pre-commit/pre-commit-hooks
10+
rev: v6.0.0
11+
hooks:
12+
- id: check-added-large-files
13+
- id: check-executables-have-shebangs
14+
- id: check-json
15+
- id: check-shebang-scripts-are-executable
16+
exclude: '.+\.rs' # would be triggered by #![some_attribute]
17+
- id: check-symlinks
18+
- id: check-toml
19+
- id: check-yaml
20+
args: [ --allow-multiple-documents ]
21+
- id: destroyed-symlinks
22+
- id: end-of-file-fixer
23+
- id: mixed-line-ending
24+
args: [ --fix=lf ]
25+
- id: trailing-whitespace
26+
27+
- repo: https://github.com/Lucas-C/pre-commit-hooks
28+
rev: v1.5.5
29+
hooks:
30+
- id: forbid-tabs
31+
- id: remove-tabs
32+
33+
- repo: local
34+
hooks:
35+
- id: cargo-fmt
36+
name: Rust Format
37+
description: "Automatically format Rust code with cargo fmt"
38+
entry: sh -c "cargo fmt --all"
39+
language: rust
40+
pass_filenames: false

LICENSE.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
SOFTWARE.
22-

TODO.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
- [ ] Handle incomplete parsing by partially generating file to the point where the parser failed
1010
- [ ] Handle invalid c_string values and other values that can not easily be turned into ENUM names when generating ENUMS examples:
1111
- `VAL_ 2566722302 ReverseCurrentRangeSetting 31 "NotAvailable" 30 "Error" 16 "11101NotUsed" 15 "16" 14 "15" 13 "14" 12 "13" 11 "12" 10 "11" 9 "10" 8 "9" 7 "8" 6 "7" 5 "6" 4 "5" 3 "4" 2 "3" 1 "2" 0 "1";`
12-
- `VAL_ 2560032510 LwVltgDscnnctDsredOperatingMode 15 "NoChange" 6 "1110Reserved" 5 "ManualConnect" 4 "ManualDisconnect" 1 "0011Reserved" 0 "Automatic";`
12+
- `VAL_ 2560032510 LwVltgDscnnctDsredOperatingMode 15 "NoChange" 6 "1110Reserved" 5 "ManualConnect" 4 "ManualDisconnect" 1 "0011Reserved" 0 "Automatic";`

deny.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ notice = "warn"
4242
# a note when they are encountered.
4343
ignore = []
4444
# Threshold for security vulnerabilities, any vulnerability with a CVSS score
45-
# lower than the range specified will be ignored. Note that ignored advisories
45+
# lower than the range specified will be ignored. Note that ignored advisories
4646
# will still output a note when they are encountered.
4747
# * None - CVSS Score 0.0
4848
# * Low - CVSS Score 0.1 - 3.9
4949
# * Medium - CVSS Score 4.0 - 6.9
5050
# * High - CVSS Score 7.0 - 8.9
5151
# * Critical - CVSS Score 9.0 - 10.0
52-
#severity-threshold =
52+
#severity-threshold =
5353

5454
# This section is considered when running `cargo deny check licenses`
5555
# More documentation for the licenses section can be found here:
@@ -75,7 +75,7 @@ copyleft = "warn"
7575
# * neither - The license will be denied if is FSF/Free *OR* OSI-approved
7676
allow-osi-fsf-free = "neither"
7777
# The confidence threshold for detecting a license from license text.
78-
# The higher the value, the more closely the license text must be to the
78+
# The higher the value, the more closely the license text must be to the
7979
# canonical license text of a valid SPDX license file.
8080
# [possible values: any between 0.0 and 1.0].
8181
confidence-threshold = 0.8

0 commit comments

Comments
 (0)