Skip to content

Commit 9c21791

Browse files
authored
test: add new pre-commit hooks (#706)
1 parent 49f58ab commit 9c21791

File tree

5 files changed

+31
-3
lines changed

5 files changed

+31
-3
lines changed

.pre-commit-config.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ repos:
77
stages: [commit-msg]
88
additional_dependencies: ["@commitlint/config-conventional"]
99

10+
- repo: https://github.com/shellcheck-py/shellcheck-py
11+
rev: v0.9.0.5
12+
hooks:
13+
- id: shellcheck
14+
1015
- repo: https://github.com/dnephin/pre-commit-golang
1116
rev: v0.5.1
1217
hooks:
@@ -20,6 +25,13 @@ repos:
2025
hooks:
2126
- id: prettier
2227

28+
- repo: https://github.com/pre-commit/pre-commit-hooks
29+
rev: v4.4.0
30+
hooks:
31+
- id: end-of-file-fixer
32+
exclude: ^api
33+
- id: trailing-whitespace
34+
2335
- repo: local
2436
hooks:
2537
- id: swag fmt
@@ -35,3 +47,14 @@ repos:
3547
pass_filenames: false
3648
entry: swag init --parseDependency --output ./api
3749
files: ^pkg/.*
50+
51+
# Taken from https://github.com/rstcheck/rstcheck/blob/178e8c1001aebe2dcbf006e7e6980246704d2315/.pre-commit-config.yaml#L141
52+
#
53+
# Find FIXME:|BUG: comments in all files
54+
# Inline skip: `#i#` directly after the colon after the tag-word
55+
- id: find-todos
56+
name: "Find FIXME:|BUG: comments"
57+
description: "Check for FIXME:|BUG: comments in all files"
58+
language: pygrep
59+
entry: '(^|//!?|#|<!--|;|/\*(\*|!)?|\.\.)\s*(FIXME:|BUG:)(?!#i#)'
60+
exclude: CONTRIBUTING.md

CONTRIBUTING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ Once those are installed, run `make setup` to perform the repository setup.
1818
- `make coverage` runs all tests and opens the coverage report in your browser
1919
- `make build` builds the software with production configuration
2020

21+
## Comments
22+
23+
- Use `// FIXME: What to fix` or `// BUG: what is broken` to make pre-commit fail as a reminder to fix something before opening a PR
24+
- Use `// TODO: What needs to be done` for things that need to be changed at a later point in time
25+
2126
## Commit messages
2227

2328
This project uses [Conventional commits](https://www.conventionalcommits.org/en/v1.0.0-beta.4/)

pkg/models/budget.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ func (b Budget) Month(db *gorm.DB, month types.Month) (Month, error) {
238238
categoryEnvelopes.Spent = categoryEnvelopes.Spent.Add(envelopeMonth.Spent)
239239
categoryEnvelopes.Allocation = categoryEnvelopes.Allocation.Add(envelopeMonth.Allocation)
240240

241-
// FIXME: The remove this with the integration of allocations into MonthConfigs.
241+
// TODO: The remove this with the integration of allocations into MonthConfigs.
242242
url := db.Statement.Context.Value(database.ContextURL)
243243

244244
// Set the allocation link. If there is no allocation, we send the collection endpoint.

testdata/importer/Budget.yfull

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3515,4 +3515,4 @@
35153515
"name": "Checking"
35163516
}
35173517
]
3518-
}
3518+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Date,Payee,Memo,Outflow,Inflow
22
04/01/2019,,Test,59.97,
33
04/01/2019,,ISHSII-MSCI EUR.SRI EOACC WPKNR: A1H7ZS ISIN: IE00B52VJ196,119.98,
4-
04/01/2019,Leo Bernard,Lastschrift Sparplan 1,,180.00
4+
04/01/2019,Leo Bernard,Lastschrift Sparplan 1,,180.00

0 commit comments

Comments
 (0)