[TT-16109] Export GenerateTykServers so it can be used by Dashboard API #7532
probelabs / Visor: quality
succeeded
Nov 11, 2025 in 3m 16s
✅ Check Passed (Warnings Found)
quality check passed. Found 1 warning, but fail_if condition was not met.
Details
📊 Summary
- Total Issues: 1
- Warning Issues: 1
🐛 Issues by Category
🎨 Style (1)
⚠️ apidef/oas/servers_regeneration_test.go:819 - The assertion logic to find a specific URL within the generated servers is verbose. Using a loop with a boolean flag can be simplified for better readability and conciseness. A more idiomatic approach would be to collect the URLs into a slice and useassert.Contains.
Powered by Visor from Probelabs
💡 TIP: You can chat with Visor using /visor ask <your question>
Annotations
Check warning on line 826 in apidef/oas/servers_regeneration_test.go
probelabs / Visor: quality
style Issue
The assertion logic to find a specific URL within the generated servers is verbose. Using a loop with a boolean flag can be simplified for better readability and conciseness. A more idiomatic approach would be to collect the URLs into a slice and use `assert.Contains`.
Raw output
Refactor the URL check to be more idiomatic. Collect all server URLs into a slice and then use `assert.Contains` to check for the presence of the expected URL. This makes the test's intent clearer and reduces boilerplate code.
```go
// Should have versioned URL
require.NotEmpty(t, servers)
urls := make([]string, len(servers))
for i, server := range servers {
urls[i] = server.URL
}
assert.Contains(t, urls, "https://api.example.com/products/v2", "Expected to find versioned URL https://api.example.com/products/v2")
```
Loading