Skip to content

Commit

Permalink
remove default builtin config
Browse files Browse the repository at this point in the history
Signed-off-by: Pranav Gaikwad <pgaikwad@redhat.com>
  • Loading branch information
pranavgaikwad committed Jul 23, 2024
1 parent 513fafd commit 1e192fb
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 16 deletions.
16 changes: 15 additions & 1 deletion demo-output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,21 @@
name: io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition
package: com.example.apps
effort: 1
lang-ref-004:
description: ""
category: potential
incidents:
- uri: file:///examples/java/example/src/main/java/com/example/apps/App.java
message: found generic call
codeSnip: " 8 /**\n 9 * {@link CustomResourceDefinition}\n10 * @param args\n11 */\n12 public static void main( String[] args )\n13 {\n14 CustomResourceDefinition crd = new CustomResourceDefinition();\n15 System.out.println( crd );\n16 \n17 GenericClass<String> element = new GenericClass<String>(\"Hello world!\");\n18 element.get();\n19 }\n20 }\n"
lineNumber: 18
variables:
VariableName: element
file: file:///examples/java/example/src/main/java/com/example/apps/App.java
kind: Method
name: main
package: com.example.apps
effort: 1
maven-javax-to-jakarta-00002:
description: Move to Jakarta EE Maven Artifacts - replace groupId javax.activation
category: potential
Expand Down Expand Up @@ -1134,5 +1149,4 @@
unmatched:
- file-002
- lang-ref-002
- lang-ref-004
- python-sample-rule-003
14 changes: 8 additions & 6 deletions provider/grpc/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,15 @@ func (g *grpcProvider) Init(ctx context.Context, log logr.Logger, config provide
if !r.Successful {
return nil, provider.InitConfig{}, fmt.Errorf(r.Error)
}
additionalBuiltinConfig := provider.InitConfig{}
if r.BuiltinConfig != nil {
additionalBuiltinConfig.Location = r.BuiltinConfig.Location
}
return &grpcServiceClient{
id: r.Id,
config: config,
client: g.Client,
}, provider.InitConfig{
Location: r.BuiltinConfig.Location,
}, nil
id: r.Id,
config: config,
client: g.Client,
}, additionalBuiltinConfig, nil
}

func (g *grpcProvider) Evaluate(ctx context.Context, cap string, conditionInfo []byte) (provider.ProviderEvaluateResponse, error) {
Expand Down
7 changes: 0 additions & 7 deletions provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,8 @@ func GetConfig(filepath string) ([]Config, error) {
if err != nil {
return nil, err
}
foundBuiltin := false
for idx := range configs {
c := &configs[idx]
if c.Name == builtinConfig.Name {
foundBuiltin = true
}
// default to system-wide proxy
if c.Proxy == nil {
c.Proxy = (*Proxy)(httpproxy.FromEnvironment())
Expand All @@ -182,9 +178,6 @@ func GetConfig(filepath string) ([]Config, error) {

}
}
if !foundBuiltin {
configs = append(configs, builtinConfig)
}

// Validate provider names for duplicate providers.
if err := validateProviderName(configs); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions provider/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,8 @@ func Test_GetConfigs(t *testing.T) {
return
}
// This is true because of the builtin config that will be added if not there
if len(config) != 2 {
t.Fatalf("got config longer than one: %v", len(config))
if len(config) != 1 {
t.Fatalf("got config not equal to one: %v", len(config))
}
c := config[0]
if len(c.InitConfig) != 1 {
Expand Down

0 comments on commit 1e192fb

Please sign in to comment.