Skip to content

Commit 08c5ab8

Browse files
authored
pre-commit stuff (#60)
* chore: added osv-scanner to pre-commit and mise * chore: refactored pre-commit * chore: ran pre-commit on all things * chore: added pre-commit ci integration
1 parent 079ea68 commit 08c5ab8

11 files changed

+178
-141
lines changed

.idea/sophrosyne.iml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/sqldialects.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.mise.toml

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ go = "1.22.3"
33
watchexec = "latest"
44
"go:github.com/golangci/golangci-lint/cmd/golangci-lint" = "1.58.1"
55
"go:golang.org/x/tools/cmd/goimports" = "latest"
6+
"go:github.com/google/osv-scanner/cmd/osv-scanner" = "v1"
7+
"pipx:pre-commit" = "latest"
68

79
[settings]
810
experimental = true

.mise/tasks/build/docker

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ done
2222

2323
mkdir -p build
2424

25-
docker buildx build --platform="$platform" -o type=oci,dest=build/sophrosyne.tar --tag sophrosyne:0.0.0 .
25+
docker buildx build --platform="$platform" -o type=oci,dest=build/sophrosyne.tar --tag sophrosyne:0.0.0 .

.mise/tasks/test/integration

-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@
33
# mise outputs=[]
44

55
go test --tags=integration ./...
6-

.pre-commit-config.yaml

+15-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,29 @@
11
repos:
2+
- repo: https://github.com/google/osv-scanner/
3+
rev: 645d5b0bb9c14741b2147a5305b684e4abc039e0 # v1.7.3
4+
hooks:
5+
- id: osv-scanner
6+
args: ["-r", "."]
27
- repo: https://github.com/pre-commit/pre-commit-hooks
38
rev: v4.6.0
49
hooks:
510
- id: check-added-large-files
611
args: ['--maxkb=4000']
712
- id: end-of-file-fixer
8-
exclude: "snapshots|docs/api.md"
913
- id: trailing-whitespace
10-
exclude: "snapshots|docs/api.md"
14+
args: ['--markdown-linebreak-ext=md']
1115
- id: check-merge-conflict
1216
- id: check-json
1317
- id: check-yaml
18+
- id: check-toml
19+
- id: check-xml
20+
- id: check-symlinks
21+
- id: destroyed-symlinks
1422
- id: check-case-conflict
1523
- id: mixed-line-ending
1624
- id: detect-private-key
17-
- id: check-executables-have-shebangs
25+
- id: pretty-format-json
26+
args: ['--autofix']
27+
ci:
28+
skip:
29+
- osv-scanner # Handled by a dedicated GitHub Action

.vscode/extensions.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"recommendations": [
3-
"charliermarsh.ruff",
4-
"ms-python.python",
5-
"tamasfe.even-better-toml",
6-
"davidanson.vscode-markdownlint",
7-
"github.copilot",
8-
"ms-python.mypy-type-checker",
9-
"bruno-api-client.bruno"
10-
]
2+
"recommendations": [
3+
"charliermarsh.ruff",
4+
"ms-python.python",
5+
"tamasfe.even-better-toml",
6+
"davidanson.vscode-markdownlint",
7+
"github.copilot",
8+
"ms-python.mypy-type-checker",
9+
"bruno-api-client.bruno"
10+
]
1111
}

.vscode/settings.json

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
{
2-
"[python]": {
3-
"editor.formatOnSave": true,
4-
"editor.defaultFormatter": "charliermarsh.ruff",
5-
"editor.codeActionsOnSave": {
6-
"source.organizeImports": "explicit"
7-
}
2+
"[python]": {
3+
"editor.codeActionsOnSave": {
4+
"source.organizeImports": "explicit"
85
},
9-
"python.testing.pytestArgs": [
10-
"tests"
11-
],
12-
"python.testing.unittestEnabled": false,
13-
"python.testing.pytestEnabled": true,
14-
"files.exclude": {
15-
"**/__pycache__": true
16-
},
17-
"sonarlint.connectedMode.project": {
18-
"connectionId": "madsrc",
19-
"projectKey": "MadsRC_sophrosyne"
20-
}
6+
"editor.defaultFormatter": "charliermarsh.ruff",
7+
"editor.formatOnSave": true
8+
},
9+
"files.exclude": {
10+
"**/__pycache__": true
11+
},
12+
"python.testing.pytestArgs": [
13+
"tests"
14+
],
15+
"python.testing.pytestEnabled": true,
16+
"python.testing.unittestEnabled": false,
17+
"sonarlint.connectedMode.project": {
18+
"connectionId": "madsrc",
19+
"projectKey": "MadsRC_sophrosyne"
20+
}
2121
}

internal/cedar/cedarschema.json

+87-63
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,97 @@
11
{
2-
"Users": {
3-
"entityTypes": {
4-
"User": {
5-
"shape": {
6-
"type": "Record",
7-
"attributes": {
8-
"id": {
9-
"type": "String"
10-
},
11-
"name": {
12-
"type": "String"
13-
},
14-
"email": {
15-
"type": "String"
16-
},
17-
"is_admin": {
18-
"type": "Boolean"
19-
},
20-
"created_at": {
21-
"type": "Long"
22-
},
23-
"updated_at": {
24-
"type": "Long"
25-
},
26-
"deleted_at": {
27-
"type": "Long",
28-
"required": false
29-
}
30-
}
31-
}
32-
}
33-
},
34-
"actions": {
35-
"GetUser": {
36-
"appliesTo": {
37-
"principalTypes": [ "User"],
38-
"resourceTypes": [ "User" ]
39-
}
2+
"Users": {
3+
"actions": {
4+
"CreateUser": {
5+
"appliesTo": {
6+
"principalTypes": [
7+
"User"
8+
],
9+
"resourceTypes": [
10+
"User"
11+
]
12+
}
13+
},
14+
"DeleteUser": {
15+
"appliesTo": {
16+
"principalTypes": [
17+
"User"
18+
],
19+
"resourceTypes": [
20+
"User"
21+
]
22+
}
23+
},
24+
"GetUser": {
25+
"appliesTo": {
26+
"principalTypes": [
27+
"User"
28+
],
29+
"resourceTypes": [
30+
"User"
31+
]
32+
}
33+
},
34+
"GetUsers": {
35+
"appliesTo": {
36+
"principalTypes": [
37+
"User"
38+
],
39+
"resourceTypes": [
40+
"User"
41+
]
42+
}
43+
},
44+
"RotateToken": {
45+
"appliesTo": {
46+
"principalTypes": [
47+
"User"
48+
],
49+
"resourceTypes": [
50+
"User"
51+
]
52+
}
53+
},
54+
"UpdateUser": {
55+
"appliesTo": {
56+
"principalTypes": [
57+
"User"
58+
],
59+
"resourceTypes": [
60+
"User"
61+
]
62+
}
63+
}
64+
},
65+
"entityTypes": {
66+
"User": {
67+
"shape": {
68+
"attributes": {
69+
"created_at": {
70+
"type": "Long"
71+
},
72+
"deleted_at": {
73+
"required": false,
74+
"type": "Long"
4075
},
41-
"GetUsers": {
42-
"appliesTo": {
43-
"principalTypes": [ "User"],
44-
"resourceTypes": [ "User" ]
45-
}
76+
"email": {
77+
"type": "String"
4678
},
47-
"CreateUser": {
48-
"appliesTo": {
49-
"principalTypes": [ "User"],
50-
"resourceTypes": [ "User" ]
51-
}
79+
"id": {
80+
"type": "String"
5281
},
53-
"UpdateUser": {
54-
"appliesTo": {
55-
"principalTypes": [ "User"],
56-
"resourceTypes": [ "User" ]
57-
}
82+
"is_admin": {
83+
"type": "Boolean"
5884
},
59-
"DeleteUser": {
60-
"appliesTo": {
61-
"principalTypes": [ "User"],
62-
"resourceTypes": [ "User" ]
63-
}
85+
"name": {
86+
"type": "String"
6487
},
65-
"RotateToken": {
66-
"appliesTo": {
67-
"principalTypes": [ "User"],
68-
"resourceTypes": [ "User" ]
69-
}
88+
"updated_at": {
89+
"type": "Long"
7090
}
91+
},
92+
"type": "Record"
7193
}
94+
}
7295
}
96+
}
7397
}

renovate.json

+43-43
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
11
{
2-
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3-
"configMigration": true,
4-
"extends": [
5-
"config:recommended",
6-
"docker:pinDigests",
7-
"helpers:pinGitHubActionDigests",
8-
":pinDevDependencies"
9-
],
10-
"packageRules": [
11-
{
12-
"matchDepTypes": [
13-
"action"
14-
],
15-
"pinDigests": true,
16-
"matchSourceUrlPrefixes": [
17-
"https://github.com/"
18-
],
19-
"prBodyDefinitions": {
20-
"OpenSSF": "[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/{{sourceRepo}}/badge)](https://securityscorecards.dev/viewer/?uri=github.com/{{sourceRepo}})"
21-
},
22-
"prBodyColumns": [
23-
"Package",
24-
"Type",
25-
"Update",
26-
"Change",
27-
"Pending",
28-
"OpenSSF"
29-
]
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"configMigration": true,
4+
"docker-compose": {
5+
"enabled": true
6+
},
7+
"dockerfile": {
8+
"enabled": true
9+
},
10+
"extends": [
11+
"config:recommended",
12+
"docker:pinDigests",
13+
"helpers:pinGitHubActionDigests",
14+
":pinDevDependencies"
15+
],
16+
"packageRules": [
17+
{
18+
"matchDepTypes": [
19+
"action"
20+
],
21+
"matchSourceUrlPrefixes": [
22+
"https://github.com/"
23+
],
24+
"pinDigests": true,
25+
"prBodyColumns": [
26+
"Package",
27+
"Type",
28+
"Update",
29+
"Change",
30+
"Pending",
31+
"OpenSSF"
32+
],
33+
"prBodyDefinitions": {
34+
"OpenSSF": "[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/{{sourceRepo}}/badge)](https://securityscorecards.dev/viewer/?uri=github.com/{{sourceRepo}})"
3035
}
31-
],
32-
"docker-compose": {
33-
"enabled": true
34-
},
35-
"dockerfile": {
36-
"enabled": true
37-
},
38-
"pre-commit": {
39-
"enabled": true
40-
},
41-
"vulnerabilityAlerts": {
42-
"enabled": true,
43-
"labels": [
44-
"vulnerability"
45-
]
4636
}
37+
],
38+
"pre-commit": {
39+
"enabled": true
40+
},
41+
"vulnerabilityAlerts": {
42+
"enabled": true,
43+
"labels": [
44+
"vulnerability"
45+
]
4746
}
47+
}

sonar-project.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ sonar.exclusions=**/*.pb.go,**/*_test.go,tests
66
sonar.test.inclusions=**/*_test.go
77
sonar.go.golangci-lint.reportPaths=build/report.xml
88
sonar.go.coverage.reportPaths=build/unit_coverage.out
9-
sonar.go.tests.reportPaths=build/unit_test_report.json
9+
sonar.go.tests.reportPaths=build/unit_test_report.json

0 commit comments

Comments
 (0)