Skip to content

Commit 016c560

Browse files
ci: add Qodana for Go
* Added qodana.yaml & GitHub workflow. * & addressed all linting problems. Co-authored-by: Qodana Application <[email protected]> Signed-off-by: Stefan Zimmermann <[email protected]>
1 parent e0a28dd commit 016c560

File tree

4 files changed

+83
-2
lines changed

4 files changed

+83
-2
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Qodana
2+
on:
3+
workflow_dispatch:
4+
pull_request:
5+
push:
6+
branches: # Specify your branches here
7+
- main # The 'main' branch
8+
# - 'releases/*' # The release branches
9+
10+
jobs:
11+
qodana:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
pull-requests: write
16+
checks: write
17+
18+
steps:
19+
- uses: actions/checkout@v5
20+
with:
21+
ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit
22+
fetch-depth: 0 # a full history is required for pull request analysis
23+
submodules: recursive
24+
25+
- name: 'Qodana Scan'
26+
uses: JetBrains/qodana-action@27de2a744479d1d731934eeaf79287575ebc5dd3 # v2025.2.1
27+
with:
28+
pr-mode: false
29+
30+
env:
31+
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN_1941125997 }}
32+
QODANA_ENDPOINT: 'https://qodana.cloud'

pointer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ limitations under the License.
1919
package require
2020

2121
import (
22-
lo "github.com/samber/lo"
22+
"github.com/samber/lo"
2323
)
2424

2525
// NilPtr asserts that the given value is a nil pointer & returns it on success.

pointer_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package require_test
33
import (
44
"testing"
55

6-
assert "github.com/stretchr/testify/assert"
6+
"github.com/stretchr/testify/assert"
77
"github.com/zimmermanncode/go-require"
88
)
99

qodana.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#-------------------------------------------------------------------------------#
2+
# Qodana analysis is configured by qodana.yaml file #
3+
# https://www.jetbrains.com/help/qodana/qodana-yaml.html #
4+
#-------------------------------------------------------------------------------#
5+
6+
#################################################################################
7+
# WARNING: Do not store sensitive information in this file, #
8+
# as its contents will be included in the Qodana report. #
9+
#################################################################################
10+
version: "1.0"
11+
12+
#Specify inspection profile for code analysis
13+
profile:
14+
name: qodana.recommended
15+
16+
#Enable inspections
17+
include:
18+
# - name: <SomeEnabledInspectionId>
19+
- name: CheckDependencyLicenses
20+
21+
#Disable inspections
22+
#exclude:
23+
# - name: <SomeDisabledInspectionId>
24+
# paths:
25+
# - <path/where/not/run/inspection>
26+
27+
#Execute shell command before Qodana execution (Applied in CI/CD pipeline)
28+
#bootstrap: sh ./prepare-qodana.sh
29+
30+
#Install IDE plugins before Qodana execution (Applied in CI/CD pipeline)
31+
#plugins:
32+
# - id: <plugin.id> #(plugin id can be found at https://plugins.jetbrains.com)
33+
34+
# Quality gate. Will fail the CI/CD pipeline if any condition is not met
35+
# severityThresholds - configures maximum thresholds for different problem severities
36+
# testCoverageThresholds - configures minimum code coverage on a whole project and newly added code
37+
# Code Coverage is available in Ultimate and Ultimate Plus plans
38+
39+
failureConditions:
40+
severityThresholds:
41+
any: 0 # 15
42+
critical: 0 # 5
43+
44+
# testCoverageThresholds:
45+
# fresh: 70
46+
# total: 50
47+
48+
#Specify Qodana linter for analysis (Applied in CI/CD pipeline)
49+
linter: jetbrains/qodana-go:2025.2

0 commit comments

Comments
 (0)