Skip to content

Commit c6d0120

Browse files
committed
added linting and formatting
1 parent 8b2c545 commit c6d0120

File tree

4 files changed

+11
-21
lines changed

4 files changed

+11
-21
lines changed

.golangci.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,8 @@ linters:
4444

4545
gocritic:
4646
disabled-checks:
47-
# These are too noisy for Terraform providers
4847
- ifElseChain # Sometimes clearer than switch
4948

50-
gosec:
51-
excludes:
52-
- G101 # Hardcoded credentials (false positives on test constants)
53-
- G104 # Unhandled errors (too noisy for terraform providers)
54-
- G304 # File path from variable (needed for terraform)
55-
5649
misspell:
5750
locale: US
5851

@@ -61,20 +54,17 @@ linters:
6154
- std-error-handling
6255
- common-false-positives
6356
rules:
64-
# Exclude some linters from running on test files
57+
# Test files have repetitive patterns and don't need strict error handling
6558
- path: _test\.go
6659
linters:
6760
- dupl
68-
- gosec
6961
- goconst
7062
- errorlint
7163

72-
# Terraform provider resources often have similar structure
7364
- path: internal/resources/
7465
linters:
7566
- dupl
7667

77-
# Terraform provider datasources often have similar structure
7868
- path: internal/datasources/
7969
linters:
8070
- dupl

internal/acctest/acctest.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ func AccPreCheck(t *testing.T) {
7171
}
7272

7373
// Set environment variables for the provider to use
74-
os.Setenv("ORY_PROJECT_ID", project.ID)
75-
os.Setenv("ORY_PROJECT_SLUG", project.Slug)
76-
os.Setenv("ORY_PROJECT_API_KEY", project.APIKey)
77-
os.Setenv("ORY_PROJECT_ENVIRONMENT", project.Environment)
74+
_ = os.Setenv("ORY_PROJECT_ID", project.ID)
75+
_ = os.Setenv("ORY_PROJECT_SLUG", project.Slug)
76+
_ = os.Setenv("ORY_PROJECT_API_KEY", project.APIKey)
77+
_ = os.Setenv("ORY_PROJECT_ENVIRONMENT", project.Environment)
7878
}
7979

8080
// GetTestProject returns the shared test project, loading from env vars or creating if necessary.

internal/provider/provider_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ func TestResolveString(t *testing.T) {
7676
for _, tt := range tests {
7777
t.Run(tt.name, func(t *testing.T) {
7878
if tt.envValue != "" {
79-
os.Setenv(tt.envVar, tt.envValue)
80-
defer os.Unsetenv(tt.envVar)
79+
_ = os.Setenv(tt.envVar, tt.envValue)
80+
defer func() { _ = os.Unsetenv(tt.envVar) }()
8181
}
8282

8383
result := resolveString(tt.tfValue, tt.envVar)
@@ -142,8 +142,8 @@ func TestResolveStringDefault(t *testing.T) {
142142
for _, tt := range tests {
143143
t.Run(tt.name, func(t *testing.T) {
144144
if tt.envValue != "" {
145-
os.Setenv(tt.envVar, tt.envValue)
146-
defer os.Unsetenv(tt.envVar)
145+
_ = os.Setenv(tt.envVar, tt.envValue)
146+
defer func() { _ = os.Unsetenv(tt.envVar) }()
147147
}
148148

149149
result := resolveStringDefault(tt.tfValue, tt.envVar, tt.defaultValue)

internal/testutil/testutil.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ const (
2525
// Test API key constants - fake keys for unit tests
2626
const (
2727
// TestWorkspaceAPIKey is a fake workspace API key for tests.
28-
TestWorkspaceAPIKey = "ory_wak_test"
28+
TestWorkspaceAPIKey = "ory_wak_test" //nolint:gosec // G101 false positive - this is a fake test constant
2929

3030
// TestProjectAPIKey is a fake project API key for tests.
31-
TestProjectAPIKey = "ory_pat_test"
31+
TestProjectAPIKey = "ory_pat_test" //nolint:gosec // G101 false positive - this is a fake test constant
3232

3333
// TestProjectSlug is a test project slug.
3434
TestProjectSlug = "test-project-slug"

0 commit comments

Comments
 (0)