Skip to content

Fix parameter naming and remove redundant awaits in iTunesController#1146

Merged
samsmithnz merged 3 commits intomainfrom
copilot/fix-camelcase-parameter-name
Dec 26, 2025
Merged

Fix parameter naming and remove redundant awaits in iTunesController#1146
samsmithnz merged 3 commits intomainfrom
copilot/fix-camelcase-parameter-name

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 26, 2025

Applies code style fixes and performance improvements to iTunesController.cs.

Changes

  • Parameter naming: Constructor parameter ServiceApiClientserviceApiClient (camelCase convention)
  • Code style: Removed trailing spaces in constructor signature
  • Redundant awaits: Replaced await task with task.Result after Task.WhenAll completes
// Before
Task<List<TopArtists>> topArtistsTask = _ServiceApiClient.GetTopArtistsSummary(showJustSummary);
Task<List<Playlist>> playlistsTask = _ServiceApiClient.GetPlaylists(showJustSummary);
await Task.WhenAll(topArtistsTask, playlistsTask);

return View(new IndexViewModel
{
    TopArtists = await topArtistsTask,  // Task already completed
    Playlists = await playlistsTask      // Task already completed
});

// After
await Task.WhenAll(topArtistsTask, playlistsTask);

return View(new IndexViewModel
{
    TopArtists = topArtistsTask.Result,
    Playlists = playlistsTask.Result
});

Applied to both Index() and PlayList() methods.

Original prompt
Please apply the following diffs and create a pull request.
Once the PR is ready, give it a title based on the messages of the fixes being applied.

[{"message":"The parameter name 'ServiceApiClient' should follow camelCase convention and be named 'serviceApiClient' to match C# naming standards.","fixFiles":[{"filePath":"src/SamSmithNZ.Web/Controllers/iTunesController.cs","diff":"diff --git a/src/SamSmithNZ.Web/Controllers/iTunesController.cs b/src/SamSmithNZ.Web/Controllers/iTunesController.cs\n--- a/src/SamSmithNZ.Web/Controllers/iTunesController.cs\n+++ b/src/SamSmithNZ.Web/Controllers/iTunesController.cs\n@@ -11,9 +11,9 @@\n     {\n         private readonly IITunesServiceApiClient _ServiceApiClient;\n \n-        public ITunesController(IITunesServiceApiClient ServiceApiClient  )\n+        public ITunesController(IITunesServiceApiClient serviceApiClient)\n         {\n-            _ServiceApiClient = ServiceApiClient;\n+            _ServiceApiClient = serviceApiClient;\n         }\n \n         public async Task<IActionResult> Index()\n"}]},{"message":"There are extra spaces before the closing parenthesis in the constructor parameter list. This should be cleaned up for consistency.","fixFiles":[{"filePath":"src/SamSmithNZ.Web/Controllers/iTunesController.cs","diff":"diff --git a/src/SamSmithNZ.Web/Controllers/iTunesController.cs b/src/SamSmithNZ.Web/Controllers/iTunesController.cs\n--- a/src/SamSmithNZ.Web/Controllers/iTunesController.cs\n+++ b/src/SamSmithNZ.Web/Controllers/iTunesController.cs\n@@ -11,7 +11,7 @@\n     {\n         private readonly IITunesServiceApiClient _ServiceApiClient;\n \n-        public ITunesController(IITunesServiceApiClient ServiceApiClient  )\n+        public ITunesController(IITunesServiceApiClient ServiceApiClient)\n         {\n             _ServiceApiClient = ServiceApiClient;\n         }\n"}]},{"message":"The tasks are already awaited with Task.WhenAll on line 24, so awaiting them again here is unnecessary and could impact performance. Use 'topArtistsTask.Result' or store the results from Task.WhenAll.","fixFiles":[{"filePath":"src/SamSmithNZ.Web/Controllers/iTunesController.cs","diff":"diff --git a/src/SamSmithNZ.Web/Controllers/iTunesController.cs b/src/SamSmithNZ.Web/Controllers/iTunesController.cs\n--- a/src/SamSmithNZ.Web/Controllers/iTunesController.cs\n+++ b/src/SamSmithNZ.Web/Controllers/iTunesController.cs\n@@ -25,8 +25,8 @@\n \n             return View(new IndexViewModel\n             {\n-                TopArtists = await topArtistsTask,\n-                Playlists = await playlistsTask\n+                TopArtists = topArtistsTask.Result,\n+                Playlists = playlistsTask.Result\n             });\n         }\n \n@@ -40,10 +40,10 @@\n \n             return View(new PlaylistViewModel\n             {\n-                Playlist = await playlistTask,\n-                TopArtists = await topArtistsTask,\n-                Movements = await movementsTask,\n-                Tracks = await tracksTask\n+                Playlist = playlistTask.Result,\n+                TopArtists = topArtistsTask.Result,\n+                Movements = movementsTask.Result,\n+                Tracks = tracksTask.Result\n             });\n         }\n \n"}]},{"message":"The tasks are already awaited with Task.WhenAll on line 24, so awaiting them again here is unnecessary and could impact performance. Use 'playlistsTask.Result' or store the results from Task.WhenAll.","fixFiles":[{"filePath":"src/SamSmithNZ.Web/Controllers/iTunesController.cs","diff":"diff --git a/src/SamSmithNZ.Web/Controllers/iTunesController.cs b/src/SamSmithNZ.Web/Controllers/iTunesController.cs\n--- a/src/SamSmithNZ.Web/Controllers/iTunesController.cs\n+++ b/src/SamSmithNZ.Web/Controllers/iTunesController.cs\n@@ -25,8 +25,8 @@\n \n             return View(new IndexViewModel\n             {\n-                TopArtists = await topArtistsTask,\n-                Playlists = await playlistsTask\n+                TopArtists = topArtistsTask.Result,\n+                Playlists = playlistsTask.Result\n             });\n         }\n \n@@ -40,10 +40,10 @@\n \n             return View(new PlaylistViewModel\n             {\n-                Playlist = await playlistTask,\n-                TopArtists = await topArtistsTask,\n-                Movements = await movementsTask,\n-                Tracks = await tracksTask\n+                Playlist = playlistTask.Result,\n+                TopArtists = topArtistsTask.Result,\n+                Movements = movementsTask.Result,\n+                Tracks = tracksTask.Result\n             });\n         }\n \n"}]},{"message":"The tasks are already awaited with Task.WhenAll on line 39, so awaiting them again here is unnecessary and could impact performance. Use 'playlistTask.Result' or store the results from Task.WhenAll.","fixFiles":[{"filePath":"src/SamSmithNZ.Web/Controllers/iTunesController.cs","diff":"diff --git a/src/SamSmithNZ.Web/Controllers/iTunesController.cs b/src...

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: samsmithnz <8389039+samsmithnz@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix parameter name to follow camelCase convention Fix parameter naming and remove redundant awaits in iTunesController Dec 26, 2025
Copilot AI requested a review from samsmithnz December 26, 2025 17:58
@samsmithnz samsmithnz marked this pull request as ready for review December 26, 2025 19:09
@samsmithnz samsmithnz enabled auto-merge December 26, 2025 19:09
@coveralls
Copy link
Copy Markdown

coveralls commented Dec 26, 2025

Pull Request Test Coverage Report for Build 20528050572

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+75.9%) to 75.879%

Totals Coverage Status
Change from base Build 20527904597: 75.9%
Covered Lines: 2206
Relevant Lines: 2805

💛 - Coveralls

@samsmithnz samsmithnz merged commit 3c1f7e3 into main Dec 26, 2025
14 checks passed
@samsmithnz samsmithnz deleted the copilot/fix-camelcase-parameter-name branch December 26, 2025 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants