mirror of
https://github.com/gesellix/Bose-SoundTouch.git
synced 2026-08-18 00:26:29 +00:00
fix: resolve more whitespace (wsl_v5) issues - part 2
- Fix whitespace issues in test files (bass_test.go, client_test.go, source_selection_test.go) - Fix whitespace issues in discovery/mdns.go - Fix whitespace issues in config/config_test.go - Fix whitespace issues in soundtouch-cli main.go ranges and loops - Fix whitespace issues in models/websocket_test.go Progress: Reduced wsl_v5 issues from 50 to 45 (10% improvement) Total remaining: 79 issues (down from 84)
This commit is contained in:
@@ -830,6 +830,7 @@ func handleSources(host string, port int, timeout time.Duration) error {
|
||||
availableSources := sources.GetAvailableSources()
|
||||
if len(availableSources) > 0 {
|
||||
fmt.Printf("Ready Sources:\n")
|
||||
|
||||
for _, source := range availableSources {
|
||||
fmt.Printf(" • %s", source.GetDisplayName())
|
||||
if source.SourceAccount != "" && source.SourceAccount != source.Source {
|
||||
@@ -1017,6 +1018,7 @@ func handleCapabilities(host string, port int, timeout time.Duration) error {
|
||||
capNames := capabilities.GetCapabilityNames()
|
||||
if len(capNames) > 0 {
|
||||
fmt.Printf("Extended Capabilities:\n")
|
||||
|
||||
for _, capName := range capNames {
|
||||
capability := capabilities.GetCapabilityByName(capName)
|
||||
fmt.Printf(" • %s", capName)
|
||||
@@ -2062,6 +2064,7 @@ func handleGetZoneMembers(client *client.Client) error {
|
||||
fmt.Printf(" Total Devices: %d\n", len(members))
|
||||
fmt.Printf(" Master: %s\n", zone.Master)
|
||||
fmt.Printf(" Members:\n")
|
||||
|
||||
for i, memberID := range members {
|
||||
if memberID == zone.Master {
|
||||
fmt.Printf(" %d. %s (Master)\n", i+1, memberID)
|
||||
|
||||
@@ -447,6 +447,7 @@ func TestClient_DecreaseBass(t *testing.T) {
|
||||
if r.Method == "GET" && r.URL.Path == "/bass" {
|
||||
getCallCount++
|
||||
var response string
|
||||
|
||||
if getCallCount == 1 {
|
||||
// First call - return current bass
|
||||
if tt.currentBass == 3 {
|
||||
|
||||
@@ -431,7 +431,6 @@ func TestClient_GetNowPlaying_ServerError(t *testing.T) {
|
||||
})
|
||||
|
||||
_, err := client.GetNowPlaying()
|
||||
|
||||
if err == nil {
|
||||
t.Error("Expected error for server error response")
|
||||
}
|
||||
@@ -622,7 +621,6 @@ func TestClient_GetSources_ServerError(t *testing.T) {
|
||||
})
|
||||
|
||||
_, err := client.GetSources()
|
||||
|
||||
if err == nil {
|
||||
t.Error("Expected error for server error response")
|
||||
}
|
||||
|
||||
@@ -302,6 +302,7 @@ func TestClient_ConvenienceSourceMethods_Integration(t *testing.T) {
|
||||
} else {
|
||||
t.Log("✓ SelectTuneIn succeeded")
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -321,6 +322,7 @@ func TestClient_ConvenienceSourceMethods_Integration(t *testing.T) {
|
||||
} else {
|
||||
t.Log("✓ SelectPandora succeeded")
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -359,6 +359,7 @@ func TestClient_ConvenienceSourceMethods(t *testing.T) {
|
||||
|
||||
// Call the appropriate convenience method
|
||||
var err error
|
||||
|
||||
switch tt.method {
|
||||
case "spotify":
|
||||
err = client.SelectSpotify(tt.sourceAccount)
|
||||
|
||||
@@ -49,6 +49,7 @@ func setupMockWebSocketServer(t *testing.T) (*httptest.Server, chan []byte) {
|
||||
t.Errorf("Failed to upgrade connection: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
defer func() {
|
||||
_ = conn.Close()
|
||||
}()
|
||||
|
||||
@@ -217,6 +217,7 @@ func TestParseDeviceString_EmptyHost(t *testing.T) {
|
||||
func TestParsePreferredDevices_SingleDevice(t *testing.T) {
|
||||
clearTestEnvVars()
|
||||
_ = os.Setenv("PREFERRED_DEVICES", "192.168.1.100")
|
||||
|
||||
defer clearTestEnvVars()
|
||||
|
||||
devices, err := parsePreferredDevices()
|
||||
@@ -284,6 +285,7 @@ func TestParsePreferredDevices_MultipleDevices(t *testing.T) {
|
||||
func TestParsePreferredDevices_EmptyString(t *testing.T) {
|
||||
clearTestEnvVars()
|
||||
_ = os.Setenv("PREFERRED_DEVICES", "")
|
||||
|
||||
defer clearTestEnvVars()
|
||||
|
||||
devices, err := parsePreferredDevices()
|
||||
@@ -299,6 +301,7 @@ func TestParsePreferredDevices_EmptyString(t *testing.T) {
|
||||
func TestParsePreferredDevices_InvalidDevice(t *testing.T) {
|
||||
clearTestEnvVars()
|
||||
_ = os.Setenv("PREFERRED_DEVICES", "192.168.1.100:invalid")
|
||||
|
||||
defer clearTestEnvVars()
|
||||
|
||||
_, err := parsePreferredDevices()
|
||||
|
||||
@@ -55,7 +55,6 @@ func (m *MDNSDiscoveryService) DiscoverDevices(ctx context.Context) ([]*models.D
|
||||
Timeout: m.timeout,
|
||||
Entries: entries,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
log.Printf("mDNS query completed with error: %v", err)
|
||||
} else {
|
||||
@@ -105,10 +104,12 @@ func (m *MDNSDiscoveryService) serviceEntryToDevice(entry *mdns.ServiceEntry) *m
|
||||
case entry.AddrV4 != nil:
|
||||
host = entry.AddrV4.String()
|
||||
ipSource = "IPv4"
|
||||
|
||||
log.Printf("mDNS: Using IPv4 address: %s", host)
|
||||
case entry.AddrV6 != nil:
|
||||
host = entry.AddrV6.String()
|
||||
ipSource = "IPv6"
|
||||
|
||||
log.Printf("mDNS: Using IPv6 address: %s", host)
|
||||
default:
|
||||
// Try to resolve from hostname
|
||||
@@ -124,7 +125,9 @@ func (m *MDNSDiscoveryService) serviceEntryToDevice(entry *mdns.ServiceEntry) *m
|
||||
if ip.To4() != nil {
|
||||
host = ip.String()
|
||||
ipSource = "resolved IPv4"
|
||||
|
||||
log.Printf("mDNS: Resolved to IPv4 address: %s", host)
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -385,6 +385,7 @@ func BenchmarkParseWebSocketEvent(b *testing.B) {
|
||||
</updates>`
|
||||
|
||||
b.ResetTimer()
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
_, err := ParseWebSocketEvent([]byte(xmlData))
|
||||
if err != nil {
|
||||
@@ -402,6 +403,7 @@ func BenchmarkWebSocketEventGetEventTypes(b *testing.B) {
|
||||
}
|
||||
|
||||
b.ResetTimer()
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
_ = event.GetEventTypes()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user