-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.pre-commit-config.yaml
91 lines (91 loc) · 3.75 KB
/
.pre-commit-config.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
exclude: '.*\.(resx|Designer.cs|xti|tcscopex)'
repos:
- repo: https://github.com/pcdshub/pre-commit-hooks.git
rev: v1.7.0
hooks:
# Replace leading tabs with 4 spaces
- id: twincat-leading-tabs-remover
# remove TwinCAT line ID lines
- id: twincat-lineids-remover
# Use lxml to beautify TwinCAT xml files
- id: twincat-xml-format
# Check if all used libraries' version numbers are fixed
- id: check-fixed-library-versions
# Checks if the product version is saved in the TwinCAT source file.
- id: no-product-version
# Affixes newlines to ST segments
- id: twincat-st-newline
# Check if minimize id changes is selected in the plc project file.
# See https://www.youtube.com/watch?v=KKpBtaYjfWo&t=935s why to do this.
- id: minimize-id-changes
# Checks if TwinCAT versions match in different tsproj files, or if it matches the targeted one.
- id: check-twincat-versions
# Possible optional arguments
# --target-version: Set a version that you want the tsproj file to have
# --fix: Fix the version numbers if a target version is set
# --reason: Add a reason to the error message in case of a non-matching version.
# --pinned: Require the TwinCAT version to be pinned. Apply pinning if combined with --fix.
# --no-pinned: Require the TwinCAT version to not be pinned. Remove pinning if combined with --fix.
# uncomment and change to use the arguments
# args: [--target-version=3.1.4024.20, --pinned, --fix, --reason="This version has a crucial new feature"]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0 # Use the ref you want to point at
hooks:
# Removes trailing white spaces
- id: trailing-whitespace
# Checks yaml files for parseable syntax
- id: check-yaml
# Prevents git from committing large files
- id: check-added-large-files
- id: end-of-file-fixer
# These files are either edited in the IDE or auto generated. No point in adding a new line at the end.
exclude: '\.(TcPOU|TcDUT|TcTTO|TcGVL|TcGTLO|TcVMO|TcIO|TcVis|plcproj|tsproj|tcdmproj|tcdmdrv|tcmproj|xti|STweep)$'
- id: requirements-txt-fixer
# For this hook you need to have the Stweep.CLI installed and buy a license
# See https://www.stweep.com/stweep-cli-beta-releases/
- repo: local
hooks:
- id: stweep
name: Format TwinCAT files with STweep
entry: python stweep_format.py --settingsFile=settings.STweep
language: python
# All files need to be passed at once, or else the license activation/deactivation fails
require_serial: true
files: '.*\.(TcPOU|TcDUT|TcTTO|TcGVL)'
- repo: local
hooks:
- id: CSharpier
name: Format C# files
entry: dotnet csharpier
language: system
files: '.*\.(cs$)'
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.3.5
hooks:
# Run the linter.
- id: ruff
# --select I sorts imports
args: [--fix, --select, I]
# Run the formatter.
- id: ruff-format
- repo: https://gitlab.com/rruiter87/pre-commit-hooks
rev: v1.3.0
hooks:
- id: check-poetry
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.7.1
hooks:
- id: prettier
exclude_types: ["svg"]
additional_dependencies:
- "@prettier/[email protected]"
- repo: https://github.com/rruiter87/tcunit-precommit
rev: v0.2.0
hooks:
- id: unittest-name-fixer
# Remove this line to prevent the names to be automatically fixed
args: [--fix]
# Ajust this to how you name your unit tests
files: '.*_Tests\.TcPOU'