Skip to content

Commit f9d0197

Browse files
Merge branch 'main' into dependabot/nuget/openfeature/provider_tests/dotnet-integration-tests/OpenFeature-2.3.2
2 parents 3fe47ba + 62a480b commit f9d0197

File tree

141 files changed

+3103
-1359
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+3103
-1359
lines changed

Diff for: .golangci.yml

+168-57
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,192 @@
1+
version: "2"
12
linters:
23
enable:
4+
- asasalint
35
- asciicheck
6+
- bidichk
47
- bodyclose
8+
# - canonicalheader
9+
# - containedctx
10+
# - contextcheck
11+
- copyloopvar
12+
# - cyclop
13+
- decorder
14+
# - depguard
515
- dogsled
616
- dupl
17+
# - dupword
18+
- durationcheck
19+
# - err113
20+
# - errcheck
21+
# - errchkjson
22+
- errname
23+
# - errorlint
24+
# - exhaustive
25+
# - exhaustruct
26+
- exptostd
27+
- fatcontext
28+
# - forbidigo
29+
# - forcetypeassert
730
- funlen
31+
- ginkgolinter
32+
- gocheckcompilerdirectives
33+
# - gochecknoglobals
834
- gochecknoinits
35+
- gochecksumtype
936
- gocognit
1037
- goconst
1138
- gocritic
1239
- gocyclo
13-
- revive
40+
# - godot
41+
- godox
42+
- goheader
43+
- gomoddirectives
44+
- gomodguard
45+
- goprintffuncname
1446
- gosec
47+
# - gosmopolitan
48+
- govet
49+
- grouper
50+
- iface
51+
- importas
52+
# - inamedparam
53+
- ineffassign
54+
- interfacebloat
55+
# - intrange
56+
# - ireturn
1557
- lll
58+
- loggercheck
59+
# - maintidx
60+
- makezero
61+
- mirror
1662
- misspell
63+
# - mnd
64+
- musttag
1765
- nakedret
66+
# - nestif
67+
- nilerr
68+
- nilnesserr
69+
# - nilnil
70+
# - nlreturn
1871
- noctx
72+
# - nolintlint
73+
# - nonamedreturns
74+
- nosprintfhostport
75+
# - paralleltest
76+
# - perfsprint
1977
- prealloc
78+
- predeclared
79+
# - promlinter
80+
- protogetter
81+
- reassign
82+
- recvcheck
83+
- revive
2084
- rowserrcheck
21-
- copyloopvar
22-
- stylecheck
85+
- sloglint
86+
- spancheck
87+
- sqlclosecheck
88+
- staticcheck
89+
# - tagalign
90+
# - tagliatelle
91+
- testableexamples
92+
# - testifylint
93+
# - testpackage
94+
# - thelper
2395
- unconvert
2496
- unparam
97+
- unused
98+
# - usestdlibvars
99+
# - usetesting
100+
# - varnamelen
101+
- wastedassign
25102
- whitespace
26-
- gofmt
103+
# - wrapcheck
104+
# - wsl
105+
- zerologlint
106+
settings:
107+
revive:
108+
confidence: 0.8
109+
funlen:
110+
lines: 90
111+
statements: 50
112+
gocritic:
113+
disabled-checks:
114+
- singleCaseSwitch
115+
gosec:
116+
excludes:
117+
- G304
118+
gosimple:
119+
checks: [ "all","-S1023" ]
120+
exclusions:
121+
paths:
122+
- (^|/)bin($|/)
123+
- (^|/)examples($|/)
124+
- (^|/)docs($|/)
125+
rules:
126+
- path: testutils/
127+
linters:
128+
- revive
129+
- path: cmd/relayproxy/modeldocs/
130+
linters:
131+
- lll
132+
- path: _test\.go
133+
linters:
134+
- errcheck
135+
- funlen
136+
- maligned
137+
- noctx
138+
- scopelint
139+
- bodyclose
140+
- lll
141+
- goconst
142+
- gocognit
143+
- gocyclo
144+
- gochecknoinits
145+
- dupl
146+
- staticcheck
147+
- revive
148+
- gosec
149+
- copyloopvar
150+
- path: _mock\.go
151+
linters:
152+
- errcheck
153+
- funlen
154+
- maligned
155+
- noctx
156+
- scopelint
157+
- bodyclose
158+
- lll
159+
- goconst
160+
- gocognit
161+
- gocyclo
162+
- gochecknoinits
163+
- dupl
164+
- staticcheck
165+
- revive
166+
- predeclared
167+
formatters:
168+
enable:
27169
- gci
28-
# - gofumpt
29-
linters-settings:
30-
funlen:
31-
lines: 90
32-
statements: 50
33-
gocritic:
34-
disabled-checks:
35-
- singleCaseSwitch
36-
golint:
37-
min-confidence: 0.6
38-
gosimple:
39-
checks: ["all","-S1023"]
40-
gofumpt:
41-
module-path: github.com/thomaspoignant/go-feature-flag
42-
gci:
43-
skip-generated: true
44-
no-lex-order: true
170+
- gofmt
171+
- goimports
172+
- golines
173+
settings:
174+
gofumpt:
175+
module-path: github.com/thomaspoignant/go-feature-flag
176+
gci:
177+
no-lex-order: true
178+
gofmt:
179+
simplify: false
180+
rewrite-rules:
181+
# - pattern: 'interface{}'
182+
# replacement: 'any'
183+
- pattern: 'a[b:len(a)]'
184+
replacement: 'a[b:]'
185+
exclusions:
186+
paths:
187+
- (^|/)bin($|/)
188+
- (^|/)examples($|/)
189+
- (^|/)docs($|/)
45190
issues:
46-
exclude-dirs:
47-
- (^|/)bin($|/)
48-
- (^|/)examples($|/)
49-
exclude-rules:
50-
- path: _test.go
51-
linters:
52-
- funlen
53-
- maligned
54-
- noctx
55-
- scopelint
56-
- bodyclose
57-
- lll
58-
- goconst
59-
- gocognit
60-
- gocyclo
61-
- gochecknoinits
62-
- dupl
63-
- staticcheck
64-
- revive
65-
- gosec
66-
- copyloopvar
67-
- path: _mock.go
68-
linters:
69-
- funlen
70-
- maligned
71-
- noctx
72-
- scopelint
73-
- bodyclose
74-
- lll
75-
- goconst
76-
- gocognit
77-
- gocyclo
78-
- gochecknoinits
79-
- dupl
80-
- staticcheck
81-
- revive
191+
# See the dedicated "issues" documentation section.
192+
max-issues-per-linter: 0

Diff for: Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ bench: ## Launch the benchmark test
8888
## Lint:
8989
lint: ## Use golintci-lint on your project
9090
mkdir -p ./bin
91-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.64.6 # Install linters
91+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s latest # Install linters
9292
./bin/golangci-lint run --timeout=5m --timeout=5m ./... # Run linters
9393

9494
## Help:

Diff for: cmd/cli/evaluate/evaluate_cmd_test.go

+51-10
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,72 @@ func TestCmdEvaluate(t *testing.T) {
1717
expectedResult string
1818
}{
1919
{
20-
name: "should return an error if flag does not exists",
21-
args: []string{"--config", "testdata/flag.goff.yaml", "--flag", "non-existent-flag", "--ctx", `{"targetingKey": "user-123"}`, "--format", "yaml"},
20+
name: "should return an error if flag does not exists",
21+
args: []string{
22+
"--config",
23+
"testdata/flag.goff.yaml",
24+
"--flag",
25+
"non-existent-flag",
26+
"--ctx",
27+
`{"targetingKey": "user-123"}`,
28+
"--format",
29+
"yaml",
30+
},
2231
wantErr: assert.NoError,
2332
expectedResult: "testdata/res/empty.json",
2433
},
2534
{
26-
name: "should return all flags if no flag is provided",
27-
args: []string{"--config", "testdata/flag.goff.yaml", "--ctx", `{"targetingKey": "user-123"}`, "--format", "yaml"},
35+
name: "should return all flags if no flag is provided",
36+
args: []string{
37+
"--config",
38+
"testdata/flag.goff.yaml",
39+
"--ctx",
40+
`{"targetingKey": "user-123"}`,
41+
"--format",
42+
"yaml",
43+
},
2844
wantErr: assert.NoError,
2945
expectedResult: "testdata/res/all-flag.json",
3046
},
3147
{
32-
name: "should return a single flag if flag name is provided",
33-
args: []string{"--config", "testdata/flag.goff.yaml", "--flag", "test-flag", "--ctx", `{"targetingKey": "user-123"}`, "--format", "yaml"},
48+
name: "should return a single flag if flag name is provided",
49+
args: []string{
50+
"--config",
51+
"testdata/flag.goff.yaml",
52+
"--flag",
53+
"test-flag",
54+
"--ctx",
55+
`{"targetingKey": "user-123"}`,
56+
"--format",
57+
"yaml",
58+
},
3459
wantErr: assert.NoError,
3560
expectedResult: "testdata/res/single-flag.json",
3661
},
3762
{
38-
name: "should return an error if configuration file does not exist",
39-
args: []string{"--config", "testdata/does-not-exist.yaml", "--flag", "test-flag", "--ctx", `{"targetingKey": "user-123"}`, "--format", "yaml"},
63+
name: "should return an error if configuration file does not exist",
64+
args: []string{
65+
"--config",
66+
"testdata/does-not-exist.yaml",
67+
"--flag",
68+
"test-flag",
69+
"--ctx",
70+
`{"targetingKey": "user-123"}`,
71+
"--format",
72+
"yaml",
73+
},
4074
wantErr: assert.Error,
4175
},
4276
{
43-
name: "should return an error if context has no targeting key",
44-
args: []string{"--config", "testdata/flag.goff.yaml", "--ctx", `{"id": "user-123"}`, "--format", "yaml"},
77+
name: "should return an error if context has no targeting key",
78+
args: []string{
79+
"--config",
80+
"testdata/flag.goff.yaml",
81+
"--ctx",
82+
`{"id": "user-123"}`,
83+
"--format",
84+
"yaml",
85+
},
4586
wantErr: assert.Error,
4687
},
4788
}

Diff for: cmd/cli/generate/manifest/manifest.go

+14-3
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,19 @@ import (
1010
"github.com/thomaspoignant/go-feature-flag/model/dto"
1111
)
1212

13-
func NewManifest(configFile string, configFormat string, flagManifestDestination string) (Manifest, error) {
13+
func NewManifest(
14+
configFile string,
15+
configFormat string,
16+
flagManifestDestination string,
17+
) (Manifest, error) {
1418
if flagManifestDestination == "" {
1519
return Manifest{}, fmt.Errorf("--flag_manifest_destination is mandatory")
1620
}
17-
flagDTOs, err := helper.LoadConfigFile(configFile, configFormat, helper.ConfigFileDefaultLocations)
21+
flagDTOs, err := helper.LoadConfigFile(
22+
configFile,
23+
configFormat,
24+
helper.ConfigFileDefaultLocations,
25+
)
1826
if err != nil {
1927
return Manifest{}, err
2028
}
@@ -68,7 +76,10 @@ func (m *Manifest) generateDefinitions(flagDTOs map[string]dto.DTO) (
6876

6977
defaultValue, ok := metadata["defaultValue"]
7078
if !ok {
71-
output.Add(fmt.Sprintf("flag %s ignored: no default value provided", flagKey), helper.WarnLevel)
79+
output.Add(
80+
fmt.Sprintf("flag %s ignored: no default value provided", flagKey),
81+
helper.WarnLevel,
82+
)
7283
continue
7384
}
7485
definitions[flagKey] = model.FlagDefinition{

Diff for: cmd/cli/generate/manifest/manifest_cmd_test.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,12 @@ func TestManifestCmd(t *testing.T) {
8585
assert.NoError(t, err)
8686
gotManifest, err := os.ReadFile(tmpManifest.Name())
8787
assert.NoError(t, err)
88-
assert.Equal(t, string(wantManifest), string(gotManifest), "manifest is not expected")
88+
assert.Equal(
89+
t,
90+
string(wantManifest),
91+
string(gotManifest),
92+
"manifest is not expected",
93+
)
8994
}
9095
})
9196
}

0 commit comments

Comments
 (0)