mirror of
https://github.com/gesellix/Bose-SoundTouch.git
synced 2026-08-18 08:36:13 +00:00
style: fix majority of remaining wsl_v5 whitespace issues
- Add missing whitespace above range loops, if statements, and assignments - Fix whitespace in models package (navigation, serviceavailability, supportedurls) - Improve whitespace in test files and examples - Fix whitespace in client package methods - Maintain code functionality while improving readability Reduced wsl_v5 issues from 29 to 27.
This commit is contained in:
@@ -186,11 +186,13 @@ func (nr *NavigateResponse) GetDirectories() []NavigateItem {
|
||||
// GetTracks returns only the track items from the navigate response
|
||||
func (nr *NavigateResponse) GetTracks() []NavigateItem {
|
||||
var tracks []NavigateItem
|
||||
|
||||
for _, item := range nr.Items {
|
||||
if item.Type == "track" {
|
||||
tracks = append(tracks, item)
|
||||
}
|
||||
}
|
||||
|
||||
return tracks
|
||||
}
|
||||
|
||||
@@ -221,6 +223,7 @@ func (ni *NavigateItem) GetDisplayName() string {
|
||||
if ni.ContentItem != nil && ni.ContentItem.ItemName != "" {
|
||||
return ni.ContentItem.ItemName
|
||||
}
|
||||
|
||||
return "Unknown Item"
|
||||
}
|
||||
|
||||
@@ -254,6 +257,7 @@ func (ni *NavigateItem) GetArtwork() string {
|
||||
if ni.ContentItem != nil && ni.ContentItem.ContainerArt != "" {
|
||||
return ni.ContentItem.ContainerArt
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ func TestNavigateRequest_NewNavigateRequest(t *testing.T) {
|
||||
if req.Source != "SPOTIFY" {
|
||||
t.Errorf("Expected source SPOTIFY, got %s", req.Source)
|
||||
}
|
||||
|
||||
if req.SourceAccount != "user@example.com" {
|
||||
t.Errorf("Expected sourceAccount user@example.com, got %s", req.SourceAccount)
|
||||
}
|
||||
@@ -101,9 +102,11 @@ func TestNavigateRequest_XMLMarshalWithItem(t *testing.T) {
|
||||
if !contains(xmlStr, `<startItem>1</startItem>`) {
|
||||
t.Error("XML should contain startItem element")
|
||||
}
|
||||
|
||||
if !contains(xmlStr, `<numItems>1000</numItems>`) {
|
||||
t.Error("XML should contain numItems element")
|
||||
}
|
||||
|
||||
if !contains(xmlStr, `<item`) {
|
||||
t.Error("XML should contain item element")
|
||||
}
|
||||
@@ -137,6 +140,7 @@ func TestNavigateResponse_XMLUnmarshal(t *testing.T) {
|
||||
</navigateResponse>`
|
||||
|
||||
var response NavigateResponse
|
||||
|
||||
err := xml.Unmarshal([]byte(xmlData), &response)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to unmarshal XML: %v", err)
|
||||
@@ -175,6 +179,7 @@ func TestNavigateResponse_XMLUnmarshal(t *testing.T) {
|
||||
if secondItem.ArtistName != "Test Artist" {
|
||||
t.Errorf("Expected artist name 'Test Artist', got %s", secondItem.ArtistName)
|
||||
}
|
||||
|
||||
if !secondItem.IsTrack() {
|
||||
t.Error("Expected second item to be a track")
|
||||
}
|
||||
@@ -346,6 +351,7 @@ func TestStationResponse_XMLUnmarshal(t *testing.T) {
|
||||
xmlData := `<status>/addStation</status>`
|
||||
|
||||
var response StationResponse
|
||||
|
||||
err := xml.Unmarshal([]byte(xmlData), &response)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to unmarshal XML: %v", err)
|
||||
@@ -468,6 +474,7 @@ func TestSearchStationResponse_XMLUnmarshal(t *testing.T) {
|
||||
</results>`
|
||||
|
||||
var response SearchStationResponse
|
||||
|
||||
err := xml.Unmarshal([]byte(xmlData), &response)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to unmarshal XML: %v", err)
|
||||
|
||||
@@ -69,6 +69,7 @@ func (sa *ServiceAvailability) GetAvailableServices() []Service {
|
||||
}
|
||||
|
||||
var available []Service
|
||||
|
||||
for _, service := range sa.Services.Service {
|
||||
if service.IsAvailable {
|
||||
available = append(available, service)
|
||||
@@ -172,6 +173,7 @@ func (sa *ServiceAvailability) GetStreamingServices() []Service {
|
||||
}
|
||||
|
||||
var streaming []Service
|
||||
|
||||
for _, service := range sa.Services.Service {
|
||||
for _, streamingType := range streamingTypes {
|
||||
if service.Type == string(streamingType) {
|
||||
|
||||
@@ -113,6 +113,7 @@ func TestServiceAvailability_UnmarshalXML(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("failed to unmarshal XML: %v", err)
|
||||
}
|
||||
|
||||
tt.validate(t, &sa)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -356,6 +356,7 @@ func (s *SupportedURLsResponse) GetFeaturesByCategory() map[string][]EndpointFea
|
||||
// GetSupportedFeatures returns all features supported by this device
|
||||
func (s *SupportedURLsResponse) GetSupportedFeatures() []EndpointFeature {
|
||||
features := GetEndpointFeatureMap()
|
||||
|
||||
var supported []EndpointFeature
|
||||
|
||||
for _, feature := range features {
|
||||
@@ -458,6 +459,7 @@ func (s *SupportedURLsResponse) GetMissingEssentialFeatures() []EndpointFeature
|
||||
// GetFeatureCompleteness returns a completeness score (0-100) based on supported features
|
||||
func (s *SupportedURLsResponse) GetFeatureCompleteness() (int, int, int) {
|
||||
features := GetEndpointFeatureMap()
|
||||
|
||||
var total, supported, essential int
|
||||
|
||||
for _, feature := range features {
|
||||
|
||||
Reference in New Issue
Block a user