Skip to content

Commit

Permalink
NO-JIRA: Adding lint configuration (#935)
Browse files Browse the repository at this point in the history
  • Loading branch information
carnellj-genesys authored Mar 26, 2024
1 parent 067a152 commit 0f32e76
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ type registerTestInstance struct {

// registerTestResources registers all resources used in the tests
func (r *registerTestInstance) registerTestResources() {
r.resourceMapMutex.Lock()
defer r.resourceMapMutex.Unlock()
providerResources["genesyscloud_architect_datatable"] = ResourceArchitectDatatable()
}

// registerTestDataSources registers all data sources used in the tests.
func (r *registerTestInstance) registerTestDataSources() {
r.datasourceMapMutex.Lock()
defer r.datasourceMapMutex.Unlock()
providerDataSources["genesyscloud_architect_datatable"] = DataSourceArchitectDatatable()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,19 @@ func readArchitectDatatable(ctx context.Context, d *schema.ResourceData, meta in
return retry.NonRetryableError(fmt.Errorf("Failed to read architect_datatable %s: %s", d.Id(), getErr))
}
cc := consistency_checker.NewConsistencyCheck(ctx, d, meta, ResourceArchitectDatatable())
d.Set("name", *datatable.Name)
d.Set("division_id", *datatable.Division.Id)
_ = d.Set("name", *datatable.Name)
_ = d.Set("division_id", *datatable.Division.Id)

if datatable.Description != nil {
d.Set("description", *datatable.Description)
_ = d.Set("description", *datatable.Description)
} else {
d.Set("description", nil)
_ = d.Set("description", nil)
}

if datatable.Schema != nil && datatable.Schema.Properties != nil {
d.Set("properties", flattenDatatableProperties(*datatable.Schema.Properties))
_ = d.Set("properties", flattenDatatableProperties(*datatable.Schema.Properties))
} else {
d.Set("properties", nil)
_ = d.Set("properties", nil)
}

log.Printf("Read architect_datatable %s %s", d.Id(), *datatable.Name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func createOrUpdateArchitectDatatableFn(ctx context.Context, p *architectDatatab
// create path and map variables
path := p.architectApi.Configuration.BasePath + "/api/v2/flows/datatables"

if createAction == false {
if !createAction {
action = http.MethodPut
path += "/" + *datatable.Id
}
Expand Down Expand Up @@ -156,9 +156,7 @@ func getAllArchitectDatatableFn(ctx context.Context, p *architectDatatableProxy)
return &totalRecords, nil
}

for _, table := range *tables.Entities {
totalRecords = append(totalRecords, table)
}
totalRecords = append(totalRecords, *tables.Entities...)

for pageNum := 2; pageNum <= *tables.PageCount; pageNum++ {
tables, _, getErr := p.architectApi.GetFlowsDatatables("", pageNum, pageSize, "", "", nil, "")
Expand All @@ -170,9 +168,7 @@ func getAllArchitectDatatableFn(ctx context.Context, p *architectDatatableProxy)
break
}

for _, table := range *tables.Entities {
totalRecords = append(totalRecords, table)
}
totalRecords = append(totalRecords, *tables.Entities...)
}

return &totalRecords, nil
Expand Down
24 changes: 24 additions & 0 deletions golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
linters:
enable:
- gosec
- godot
- misspell
- stylecheck

linters-settings:
stylecheck:
# Select the Go version to target. The default is '1.13'.
go: "1.18"
checks: ["all","ST1*"]

issues:
exclude-use-default: false

output:
format: colored-line-number

# print lines of code with issue, default is true
print-issued-lines: false

# print linter name in the end of issue text, default is true
print-linter-name: true

0 comments on commit 0f32e76

Please sign in to comment.