Skip to content

Commit ff491e4

Browse files
committed
Add precious config and run on files
1 parent 387df38 commit ff491e4

File tree

6 files changed

+118
-51
lines changed

6 files changed

+118
-51
lines changed

.githooks/pre-commit

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
#
3+
# Git pre-commit hook that runs precious lint on staged files
4+
#
5+
6+
set -e
7+
8+
echo "Running precious lint on staged files..."
9+
10+
# Run precious lint on staged files
11+
if ! precious lint --staged; then
12+
echo ""
13+
echo "❌ Linting failed. Please fix the issues above before committing."
14+
echo ""
15+
echo "To fix formatting issues automatically, run:"
16+
echo " precious tidy --staged"
17+
exit 1
18+
fi
19+
20+
echo "✅ All linters passed!"

.github/dependabot.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
version: 2
22
updates:
3-
- package-ecosystem: gomod
4-
directory: "/"
5-
schedule:
6-
interval: daily
7-
time: "13:00"
8-
open-pull-requests-limit: 10
9-
- package-ecosystem: "github-actions"
10-
directory: "/"
11-
schedule:
12-
interval: daily
3+
- package-ecosystem: gomod
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
time: "13:00"
8+
open-pull-requests-limit: 10
9+
- package-ecosystem: "github-actions"
10+
directory: "/"
11+
schedule:
12+
interval: daily

.github/workflows/codeql-analysis.yml

Lines changed: 39 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,51 +3,50 @@ name: "Code scanning - action"
33
on:
44
push:
55
branches-ignore:
6-
- 'dependabot/**'
6+
- "dependabot/**"
77
pull_request:
88
schedule:
9-
- cron: '0 12 * * 5'
9+
- cron: "0 12 * * 5"
1010

1111
jobs:
1212
CodeQL-Build:
13-
1413
runs-on: ubuntu-latest
1514

1615
steps:
17-
- name: Checkout repository
18-
uses: actions/checkout@v6
19-
with:
20-
# We must fetch at least the immediate parents so that if this is
21-
# a pull request then we can checkout the head.
22-
fetch-depth: 2
23-
24-
# If this run was triggered by a pull request event, then checkout
25-
# the head of the pull request instead of the merge commit.
26-
- run: git checkout HEAD^2
27-
if: ${{ github.event_name == 'pull_request' }}
28-
29-
# Initializes the CodeQL tools for scanning.
30-
- name: Initialize CodeQL
31-
uses: github/codeql-action/init@v4
32-
# Override language selection by uncommenting this and choosing your languages
33-
# with:
34-
# languages: go, javascript, csharp, python, cpp, java
35-
36-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
37-
# If this step fails, then you should remove it and run the build manually (see below)
38-
- name: Autobuild
39-
uses: github/codeql-action/autobuild@v4
40-
41-
# ℹ️ Command-line programs to run using the OS shell.
42-
# 📚 https://git.io/JvXDl
43-
44-
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
45-
# and modify them (or add more) to build your code if your project
46-
# uses a compiled language
47-
48-
#- run: |
49-
# make bootstrap
50-
# make release
51-
52-
- name: Perform CodeQL Analysis
53-
uses: github/codeql-action/analyze@v4
16+
- name: Checkout repository
17+
uses: actions/checkout@v6
18+
with:
19+
# We must fetch at least the immediate parents so that if this is
20+
# a pull request then we can checkout the head.
21+
fetch-depth: 2
22+
23+
# If this run was triggered by a pull request event, then checkout
24+
# the head of the pull request instead of the merge commit.
25+
- run: git checkout HEAD^2
26+
if: ${{ github.event_name == 'pull_request' }}
27+
28+
# Initializes the CodeQL tools for scanning.
29+
- name: Initialize CodeQL
30+
uses: github/codeql-action/init@v4
31+
# Override language selection by uncommenting this and choosing your languages
32+
# with:
33+
# languages: go, javascript, csharp, python, cpp, java
34+
35+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
36+
# If this step fails, then you should remove it and run the build manually (see below)
37+
- name: Autobuild
38+
uses: github/codeql-action/autobuild@v4
39+
40+
# ℹ️ Command-line programs to run using the OS shell.
41+
# 📚 https://git.io/JvXDl
42+
43+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
44+
# and modify them (or add more) to build your code if your project
45+
# uses a compiled language
46+
47+
#- run: |
48+
# make bootstrap
49+
# make release
50+
51+
- name: Perform CodeQL Analysis
52+
uses: github/codeql-action/analyze@v4

.github/workflows/go.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name: Go
33
on: [push, pull_request]
44

55
jobs:
6-
76
build:
87
name: Build
98
strategy:

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
.vscode
22
*.out
33
*.test
4+
*.mmdb
5+
*.prof
6+
*.pprof
7+
*.svg
8+
*.tar.gz

.precious.toml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
exclude = [
2+
"test-data/**/*",
3+
"vendor/**/*",
4+
"GeoLite2-ASN.mmdb",
5+
"GeoLite2-City.mmdb",
6+
"*.prof",
7+
"*.pprof",
8+
"*.out",
9+
"*.svg",
10+
"*.tar.gz",
11+
"*.test",
12+
]
13+
14+
[commands.golangci-lint-fmt]
15+
type = "both"
16+
include = "**/*.go"
17+
invoke = "once"
18+
path-args = "none"
19+
cmd = ["golangci-lint", "fmt"]
20+
lint-flags = "--diff"
21+
ok-exit-codes = [0]
22+
lint-failure-exit-codes = [1]
23+
24+
[commands.golangci-lint]
25+
type = "both"
26+
include = "**/*.go"
27+
invoke = "once"
28+
path-args = "none"
29+
cmd = ["golangci-lint", "run"]
30+
tidy-flags = "--fix"
31+
ok-exit-codes = [0]
32+
lint-failure-exit-codes = [1]
33+
34+
[commands.prettier]
35+
type = "both"
36+
include = ["**/*.md", "**/*.yml", "**/*.yaml"]
37+
invoke = "once"
38+
path-args = "file"
39+
cmd = ["prettier"]
40+
lint-flags = "--check"
41+
tidy-flags = "--write"
42+
ok-exit-codes = [0]
43+
lint-failure-exit-codes = [1]
44+
expect-stderr = true

0 commit comments

Comments
 (0)