Skip to content
This repository was archived by the owner on Jul 12, 2026. It is now read-only.

Commit 7b31c5e

Browse files
authored
fix: cicd and linter issues (#1)
* build: enable ci-cd * fix: wsl linter issues * fix: misspell linter issues * fix: varnamelen linter issues * fix: depguard linter issues * fix: govet linter - non-constant format string in call to fmt fprintf * fix: wrapcheck linter issues * fix: unparam linter issues * fix: generate mocks using mockery * fix: high sec issue yaml v3 * fix: set code coverage to 0 as creator did not write any tests * fix: revive linter issues * fix: perfsprint linter issues * fix: nonamedreturns linter issues * fix: nlreturns linter issues * fix: cyclop linter issues * fix: lll linter issues * fix: errorlint linter issues * fix: dupword linter issues * fix: errcheck linter issues * fix: funcorder linter issues * fix: magicnumber linter issues * fix: gosec http listener linter issues * fix: gosec uint32 linter issues
1 parent e2db87b commit 7b31c5e

22 files changed

Lines changed: 962 additions & 285 deletions

File tree

.github/dependabot.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
version: 2
3+
updates:
4+
- package-ecosystem: "docker"
5+
commit-message:
6+
prefix: "build(deps)"
7+
directory: "/"
8+
schedule:
9+
interval: "weekly"
10+
groups:
11+
docker-all:
12+
patterns:
13+
- "*"
14+
- package-ecosystem: "github-actions"
15+
commit-message:
16+
prefix: "build(deps)"
17+
directory: "/"
18+
schedule:
19+
interval: "weekly"
20+
groups:
21+
github-actions-all:
22+
patterns:
23+
- "*"
24+
- package-ecosystem: "gomod"
25+
commit-message:
26+
prefix: "build(deps)"
27+
directory: "/"
28+
schedule:
29+
interval: "weekly"
30+
groups:
31+
gomod-all:
32+
patterns:
33+
- "*"

.github/workflows/general.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
name: General
3+
"on": pull_request
4+
permissions:
5+
contents: read
6+
packages: read
7+
jobs:
8+
mcvs-general-action:
9+
strategy:
10+
matrix:
11+
args:
12+
- testing-type: lint-git
13+
runs-on: ubuntu-24.04
14+
steps:
15+
- uses: actions/checkout@v4.2.2
16+
- uses: schubergphilis/mcvs-general-action@v0.2.0
17+
with:
18+
testing-type: ${{ matrix.args.testing-type }}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: golang-releases
3+
"on": push
4+
permissions:
5+
contents: write
6+
packages: read
7+
jobs:
8+
mcvs-golang-action:
9+
strategy:
10+
matrix:
11+
args:
12+
- release-application-name: rpi_exporter
13+
release-architecture: amd64
14+
release-dir: cmd/rpi_exporter
15+
release-type: binary
16+
- release-application-name: rpi_exporter
17+
release-architecture: arm64
18+
release-dir: cmd/rpi_exporter
19+
release-type: binary
20+
runs-on: ubuntu-24.04
21+
env:
22+
TASK_X_REMOTE_TASKFILES: 1
23+
steps:
24+
- uses: actions/checkout@v4.2.2
25+
- uses: schubergphilis/mcvs-golang-action@v3.3.1
26+
with:
27+
release-application-name: ${{ matrix.args.release-application-name }}
28+
release-architecture: ${{ matrix.args.release-architecture }}
29+
release-build-tags: ${{ matrix.args.release-build-tags }}
30+
release-dir: ${{ matrix.args.release-dir }}
31+
release-type: ${{ matrix.args.release-type }}
32+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/golang.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
name: golang
3+
"on": pull_request
4+
permissions:
5+
contents: read
6+
packages: read
7+
jobs:
8+
mcvs-golang-action:
9+
strategy:
10+
matrix:
11+
args:
12+
- testing-type: component
13+
- testing-type: coverage
14+
- testing-type: integration
15+
- testing-type: lint
16+
build-tags: component
17+
- testing-type: lint
18+
build-tags: e2e
19+
- testing-type: lint
20+
build-tags: integration
21+
- testing-type: lint-commit
22+
- testing-type: lint-git
23+
- testing-type: mocks-tidy
24+
- testing-type: security-golang-modules
25+
- testing-type: security-grype
26+
- testing-type: security-trivy
27+
- testing-type: unit
28+
runs-on: ubuntu-24.04
29+
env:
30+
TASK_X_REMOTE_TASKFILES: 1
31+
steps:
32+
- uses: actions/checkout@v4.2.2
33+
- uses: schubergphilis/mcvs-golang-action@v3.3.1
34+
env:
35+
test-timeout: 10m0s
36+
with:
37+
build-tags: ${{ matrix.args.build-tags }}
38+
code-coverage-expected: 0
39+
code-coverage-timeout: ${{ env.test-timeout }}
40+
golang-unit-tests-exclusions: |-
41+
\(deprecated\|filesystem\|mocks\|swagger\|cmd\/mcvs-.*\|mcvs-\(chart-designer\|reporter\)\)$\?
42+
golangci-timeout: 10
43+
test-timeout: ${{ env.test-timeout }}
44+
testing-type: ${{ matrix.args.testing-type }}
45+
token: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
name: gomod-go-version-updater-action
3+
"on":
4+
schedule:
5+
- cron: "42 6 * * *"
6+
permissions:
7+
contents: write
8+
pull-requests: write
9+
jobs:
10+
gomod-go-version-updater-action:
11+
runs-on: ubuntu-22.04
12+
steps:
13+
- uses: 030/gomod-go-version-updater-action@v0.3.5
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: MCVS-PR-validation-action
3+
"on":
4+
pull_request:
5+
types:
6+
- edited
7+
- opened
8+
- reopened
9+
- synchronize
10+
workflow_call:
11+
permissions:
12+
contents: read
13+
pull-requests: read
14+
jobs:
15+
MCVS-PR-validation-action:
16+
runs-on: ubuntu-24.04
17+
steps:
18+
- uses: actions/checkout@v4.2.2
19+
- uses: schubergphilis/mcvs-pr-validation-action@v0.2.0

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
rpi_exporter
1+
.task
2+
.vscode
3+
cmd/rpi_exporter/rpi_exporter

.golangci.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# yamllint disable rule:line-length
2+
---
3+
version: "2"
4+
linters:
5+
default: all
6+
disable:
7+
# err113 is disabled as it does not make any sense to use wrapped static
8+
# errors as it contains superfluous escaped double quotes.
9+
- err113
10+
# exhaustruct is disabled as there are scenarios in this code base where a
11+
# some keys of a struct should be empty while testing.
12+
- exhaustruct
13+
# gochecknoglobals is disabled as there are global errors and component
14+
# test variables.
15+
- gochecknoglobals
16+
# testpackage is disabled as it is a bad practice to make methods public to
17+
# be able to test them.
18+
- testpackage
19+
settings:
20+
depguard:
21+
rules:
22+
main:
23+
files:
24+
- "!**/*_a _file.go"
25+
allow:
26+
- $gostd
27+
- github.com/schubergphilis/rpi_exporter/pkg/export/prometheus
28+
- github.com/schubergphilis/rpi_exporter/pkg/ioctl
29+
- github.com/schubergphilis/rpi_exporter/pkg/mbox
30+
- github.com/sirupsen/logrus
31+
deny:
32+
- pkg: log
33+
desc: Use 'log "github.com/sirupsen/logrus"' instead
34+
- pkg: github.com/pkg/errors
35+
desc: Should be replaced by standard lib errors package
36+
- pkg: github.com/anchore/go-homedir
37+
desc: Must be replaced by 'github.com/mitchellh/go-homedir'
38+
exclusions:
39+
generated: lax
40+
presets:
41+
- comments
42+
- common-false-positives
43+
- legacy
44+
- std-error-handling
45+
paths:
46+
- internal/app/mcvs-scanner-cli/application/swagger
47+
- third_party$
48+
- builtin$
49+
- examples$
50+
rules:
51+
- linters:
52+
- funlen
53+
path: _test\.go
54+
formatters:
55+
enable:
56+
- gci
57+
- gofmt
58+
- gofumpt
59+
- goimports
60+
exclusions:
61+
generated: lax
62+
paths:
63+
- internal/app/mcvs-scanner-cli/application/swagger
64+
- third_party$
65+
- builtin$
66+
- examples$

.mockery.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
dir: "{{.InterfaceDir}}/mocks"
3+
filename: "{{.InterfaceName | snakecase}}.go"
4+
structname: "{{.InterfaceName}}"
5+
pkgname: mocks
6+
template: testify
7+
packages:
8+
github.com/schubergphilis/rpi_exporter/internal/app/rpi_exporter/application:
9+
interfaces:
10+
Executor: {}
11+
github.com/schubergphilis/rpi_exporter/internal/app/rpi_exporter/data:
12+
interfaces:
13+
Storer: {}
14+
github.com/schubergphilis/rpi_exporter/internal/app/rpi_exporter/presentation:
15+
interfaces:
16+
Presenter: {}

Taskfile.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
version: 3
3+
4+
vars:
5+
REMOTE_URL: https://raw.githubusercontent.com
6+
REMOTE_URL_REF: v3.2.1
7+
REMOTE_URL_REPO: schubergphilis/mcvs-golang-action
8+
9+
includes:
10+
remote:
11+
taskfile: >-
12+
{{.REMOTE_URL}}/{{.REMOTE_URL_REPO}}/{{.REMOTE_URL_REF}}/build/task.yml

0 commit comments

Comments
 (0)