-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v3.5.0 #60
v3.5.0 #60
Conversation
Added a new team, "Utah Hockey Club," to various parts of the codebase, including `TeamNames`, `FranchiseEnum`, `TeamEnum`, and `TeamCodes`. Updated project versions in `Nhl.Api.Common.csproj`, `Nhl.Api.Domain.csproj`, and `Nhl.Api.Tests.csproj` from `3.4.2` to `3.5.0`. Enhanced `PlayerFilterExpressionBuilder` with new filter methods for `PlayerRealtimeStatisticsFilter` and `PlayerTimeOnIceStatisticsFilter`. Made properties in `GoalieStatisticsResult` and `PlayerStatisticsResult` nullable. Improved documentation comments in `PlayerFilterExpressionBuilder`. Updated `NhlTeamService` to include mappings for the new team. Modified `LeagueTests` and `StatisticsTests` with new test methods and `[DataRow]` attributes. Corrected typos and formatting in various test files. Added new methods to `NhlApi` and `NhlStatisticsApi` for retrieving real-time and time on ice player statistics. Introduced new classes and enums for handling these statistics results.
Removed various methods related to player and team statistics, game logs, and other functionalities from the README.md file. Added two new methods to the NhlStatisticsApi class: GetRealtimePlayerStatisticsBySeasonAndFilterExpressionAsync and GetTimeOnIcePlayerStatisticsBySeasonAndFilterExpressionAsync, providing detailed real-time player statistics and time on ice statistics for a specific player and season.
📝 Walkthrough📝 WalkthroughWalkthroughThis pull request introduces two new asynchronous methods to the NHL API, enhancing the functionality for retrieving player statistics. The methods, Changes
Possibly related PRs
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 17
Outside diff range and nitpick comments (18)
Nhl.Api.Common/Nhl.Api.Common.csproj (1)
Line range hint
12-12
: Consider updating Newtonsoft.Json packageWhile not directly related to the version change, I noticed that the Newtonsoft.Json package is not at the latest version. Consider updating it to the latest stable version (13.0.3 as of September 2024) to ensure you have the latest bug fixes and performance improvements.
You can update the package by modifying the following line:
- <PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> + <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />Nhl.Api.Domain/Models/Player/StatisticsReportType.cs (1)
6-9
: Fix typo in documentation and LGTM for enum declaration.The enum declaration and its documentation look good. However, there's a small typo in the documentation comment:
- /// A statistics filter for the retreival of player and goalie statistics in the NHL using Cayenne expressions + /// A statistics filter for the retrieval of player and goalie statistics in the NHL using Cayenne expressionsPlease correct this typo to maintain the quality of the documentation.
Nhl.Api.Domain/Models/Statistics/PlayerTimeOnIceStatisticsFilterResult.cs (1)
1-3
: Consider adding a license header to the file.It's a good practice to include a license header at the top of each source file in open-source projects. This helps to clearly communicate the terms under which the code is distributed. Consider adding a license header similar to:
// Copyright (c) [year] [copyright holders] // SPDX-License-Identifier: [license identifier] // See the LICENSE file in the project root for full license information.Replace
[year]
,[copyright holders]
, and[license identifier]
with the appropriate information for your project.Nhl.Api.Domain/Models/Statistics/GoalieStatisticsFilterResult.cs (1)
Line range hint
94-153
: Summary of changes and suggestion for documentationThe changes in this PR (v3.5.0) consistently update four properties in the
GoalieStatisticsResult
class to allow for nullable values:
OvertimeLosses
(int? instead of int)SavePercentage
(decimal? instead of double)Saves
(int? instead of int)ShotsAgainst
(int? instead of int)These changes improve the flexibility of the data model by allowing for scenarios where certain statistics might not be available. However, this could potentially impact how consumers of this API handle these properties, as they now need to account for null values.
Consider updating the API documentation or release notes to highlight these changes. This will help API consumers understand the new nullable nature of these properties and update their code accordingly to handle potential null values.
Nhl.Api.Domain/Models/Statistics/PlayerStatisticsFilterResult.cs (1)
210-211
: Remove unnecessary empty linesThere are two empty lines at the end of the file. It's generally a good practice to end a file with a single newline character. Consider removing one of these empty lines to adhere to common coding standards.
} -
Nhl.Api.Domain/Models/Statistics/PlayerRealtimeStatisticsFilterResult.cs (1)
24-203
: LGTM: Comprehensive player statistics class with proper JSON serialization.The
PlayerRealtimeStatisticsResult
class is well-implemented, covering a wide range of player statistics with appropriate use of nullable types and consistent JSON serialization attributes. The property names and documentation are clear and follow C# conventions.For consistency, consider making the
GiveawaysPer60
,HitsPer60
, andTakeawaysPer60
properties nullable (double?) like other similar properties. This would maintain consistency with other statistical properties and allow for the possibility of missing data.Example:
[JsonProperty("giveawaysPer60")] public double? GiveawaysPer60 { get; set; }Nhl.Api.Domain/Models/Team/TeamCodes.cs (1)
241-244
: LGTM! Consider adding more context about the team's status.The addition of the
UtahHockeyClub
constant is correct and consistent with the existing code style. The three-letter code "UTA" follows the established pattern for team identifiers.Consider adding a brief note about the team's current status or expected start date in the summary comment. For example:
/// <summary> /// Utah Hockey Club (Expected to join in 20XX or: Placeholder for future expansion) /// </summary> public const string UtahHockeyClub = "UTA";This additional context could be helpful for developers using this constant in the future.
Nhl.Api/Src/StatisticsApi/INhlStatisticsApi.cs (1)
141-151
: LGTM with a minor suggestion.The new method
GetRealtimePlayerStatisticsBySeasonAndFilterExpressionAsync
is well-documented and consistent with the interface's style. However, consider changing the default value ofplayerRealtimeStatisticsFilterToSortBy
to a more commonly used statistic, such asGoals
orPoints
, instead ofOvertimeGoals
.-public Task<PlayerRealtimeStatisticsFilterResult> GetRealtimePlayerStatisticsBySeasonAndFilterExpressionAsync(string seasonYear, ExpressionPlayerFilter expressionPlayerFilter, PlayerRealtimeStatisticsFilter playerRealtimeStatisticsFilterToSortBy = PlayerRealtimeStatisticsFilter.OvertimeGoals, int limit = -1, int offsetStart = 0, CancellationToken cancellationToken = default); +public Task<PlayerRealtimeStatisticsFilterResult> GetRealtimePlayerStatisticsBySeasonAndFilterExpressionAsync(string seasonYear, ExpressionPlayerFilter expressionPlayerFilter, PlayerRealtimeStatisticsFilter playerRealtimeStatisticsFilterToSortBy = PlayerRealtimeStatisticsFilter.Goals, int limit = -1, int offsetStart = 0, CancellationToken cancellationToken = default);Nhl.Api.Tests/LeagueTests.cs (2)
382-382
: Document the reason for changing from TeamEnum to teamId.The method signature has been updated to use
int teamId
instead ofTeamEnum team
, and the method name now includes "With_TeamId". While this change might be part of a larger refactoring effort, it's not immediately clear why this change was made.Consider adding a comment explaining the rationale behind this change. This will help future maintainers understand the decision-making process and the potential implications of this change.
Example comment:
// Changed from TeamEnum to int teamId to align with the new team identification strategy across the API. // This allows for more flexibility in team representation and better integration with external systems. public async Task GetTeamStatisticsBySeasonAndGameTypeAsync_Return_Valid_Information_With_TeamId(int teamId, string seasonYear, GameType gameType)
344-382
: Consider documenting the overall refactoring strategy.The changes in this file appear to be part of a larger refactoring effort, particularly in how teams are identified and how tests are structured. While these changes may be necessary, there are a few concerns:
- The significant reduction in test coverage by commenting out multiple test cases.
- The shift from using
TeamEnum
toint teamId
without clear documentation.- Lack of overall context for these changes.
To improve the maintainability and understandability of the code:
- Document the overall refactoring strategy, perhaps in a comment at the top of the file or in a separate document referenced in the code.
- Reconsider the approach to test case reduction. If possible, update and re-enable the commented-out tests to maintain good coverage.
- Add comments explaining significant changes, such as the switch from
TeamEnum
toint teamId
.Consider creating a separate document or wiki page that outlines the refactoring strategy, including the rationale for changes, the expected benefits, and any known trade-offs. This will provide valuable context for current and future developers working on this codebase.
Nhl.Api/Src/LeagueApi/NhlLeagueApi.cs (1)
413-418
: LGTM! Consider adding a comment about the team's status.The addition of the Utah Hockey Club team colors is implemented correctly and follows the existing pattern. The color scheme (blue, black, white) seems appropriate for a hockey team.
Consider adding a comment above this case to indicate the status of the Utah Hockey Club (e.g., if it's a new expansion team or a rebranded existing team). This would provide helpful context for future maintainers.
Nhl.Api/README.md (2)
1009-1030
: Minor inconsistency in parameter descriptionThe documentation for this new method looks good and is consistent with the existing style. However, there's a small inconsistency in the parameter description for
playerRealtimeStatisticsFilterToSortBy
. The description referencesPlayerStatisticsFilter
instead ofPlayerRealtimeStatisticsFilter
.Consider updating the parameter description as follows:
-| playerRealtimeStatisticsFilterToSortBy | [Nhl.Api.Models.Player.PlayerRealtimeStatisticsFilter](#T-Nhl-Api-Models-Player-PlayerRealtimeStatisticsFilter 'Nhl.Api.Models.Player.PlayerRealtimeStatisticsFilter') | The player statistics filter to sort the player statistics by, see [PlayerStatisticsFilter](#T-Nhl-Api-Models-Player-PlayerStatisticsFilter 'Nhl.Api.Models.Player.PlayerStatisticsFilter') for more information on valid player statistics filters | +| playerRealtimeStatisticsFilterToSortBy | [Nhl.Api.Models.Player.PlayerRealtimeStatisticsFilter](#T-Nhl-Api-Models-Player-PlayerRealtimeStatisticsFilter 'Nhl.Api.Models.Player.PlayerRealtimeStatisticsFilter') | The player real-time statistics filter to sort the player statistics by, see [PlayerRealtimeStatisticsFilter](#T-Nhl-Api-Models-Player-PlayerRealtimeStatisticsFilter 'Nhl.Api.Models.Player.PlayerRealtimeStatisticsFilter') for more information on valid player real-time statistics filters |This change will make the documentation more accurate and consistent.
Overall, the addition of this method is well-documented and follows the existing style.
Tools
Markdownlint
1012-1012: Expected: h4; Actual: h5
Heading levels should only increment by one level at a time(MD001, heading-increment)
1024-1024: null
Link fragments should be valid(MD051, link-fragments)
1025-1025: null
Link fragments should be valid(MD051, link-fragments)
1025-1025: null
Link fragments should be valid(MD051, link-fragments)
1026-1026: null
Link fragments should be valid(MD051, link-fragments)
1026-1026: null
Link fragments should be valid(MD051, link-fragments)
2989-3010
: Suggestion for improved method descriptionThe documentation for this new method is well-structured and consistent with the existing style. However, the method description could be slightly improved for clarity.
Consider updating the method description as follows:
-Returns all the NHL time on ice player game center statistics for a specific player for a specific season including even time on ice, overtime time on ice, over time on ice per over time game time on ice per game and more +Returns all the NHL time on ice player game center statistics for a specific season, including even strength time on ice, overtime time on ice, time on ice per game, and moreThis change makes the description more concise and easier to read while still conveying the key information about the method's functionality.
Overall, the addition of this method is well-documented and follows the existing style.
Tools
Markdownlint
2992-2992: Expected: h4; Actual: h5
Heading levels should only increment by one level at a time(MD001, heading-increment)
3004-3004: null
Link fragments should be valid(MD051, link-fragments)
3005-3005: null
Link fragments should be valid(MD051, link-fragments)
3005-3005: null
Link fragments should be valid(MD051, link-fragments)
3006-3006: null
Link fragments should be valid(MD051, link-fragments)
3006-3006: null
Link fragments should be valid(MD051, link-fragments)
Nhl.Api.Domain/Models/Player/ExpressionPlayerFilterBuilder.cs (2)
Line range hint
129-236
: Ensure proper handling of user-provided input to prevent injection vulnerabilitiesIn the comparison methods (
EqualTo
,NotEqualTo
,GreaterThan
,GreaterThanOrEqualTo
,LessThan
,LessThanOrEqualTo
), user-providedvalue
is appended directly to the_filterExpression
without sanitization. This could lead to injection vulnerabilities ifvalue
contains malicious input.Consider sanitizing or validating
value
before appending it to the expression. Alternatively, implement parameterization to securely handle user-provided values.
483-845
: Consider consolidating common statistics into a base enum to reduce duplicationSeveral statistics, such as
GamesPlayed
,LastName
,PlayerId
,SeasonId
,ShootsCatches
,SkaterFullName
, andTeamAbbreviation
, appear in multiple enums (PlayerStatisticsFilter
,PlayerRealtimeStatisticsFilter
,PlayerTimeOnIceStatisticsFilter
).Consider consolidating these common statistics into a shared base enum or interface to reduce code duplication and improve maintainability.
Nhl.Api/Src/StatisticsApi/NhlStatisticsApi.cs (3)
Line range hint
880-895
: Bug in 'takeaway' case: Incorrect statistic incrementIn the
GetPlayerStatisticTotal
method, within thetakeaway
case, the code incorrectly increments theGiveaway
statistic instead of theTakeaway
statistic. This leads to inaccurate statistics being recorded.Apply the following diff to fix the issue:
case "takeaway": if (play.Details.PlayerId.HasValue) { - gameStatisticTotals[PlayerGameCenterStatistic.Takeaway] = play.Details.PlayerId == playerId - ? gameStatisticTotals[PlayerGameCenterStatistic.Giveaway] += 1 - : gameStatisticTotals[PlayerGameCenterStatistic.Giveaway]; + gameStatisticTotals[PlayerGameCenterStatistic.Takeaway] = play.Details.PlayerId == playerId + ? gameStatisticTotals[PlayerGameCenterStatistic.Takeaway] += 1 + : gameStatisticTotals[PlayerGameCenterStatistic.Takeaway]; } break;
Line range hint
733-736
: Typo in variable name 'teamAbbreviaton'The variable
teamAbbreviaton
seems to have a typographical error. It should beteamAbbreviation
.Apply the following diff to correct the typo:
- var teamAbbreviaton = _nhlTeamService.GetTeamCodeIdentifierByTeamId(teamId); + var teamAbbreviation = _nhlTeamService.GetTeamCodeIdentifierByTeamId(teamId);Ensure to update all occurrences of this variable name throughout the code.
Line range hint
734-737
: Possible NullReferenceException riskIn the method
GetTeamStatisticsBySeasonAndGameTypeAsync
, after retrievingteamAbbreviation
, the code directly uses it without checking for null or empty values. If_nhlTeamService.GetTeamCodeIdentifierByTeamId(teamId)
returns null, this could lead to aNullReferenceException
.Consider adding a check to ensure
teamAbbreviation
is not null or empty before using it:+ if (string.IsNullOrWhiteSpace(teamAbbreviation)) + { + throw new ArgumentException("Invalid team ID provided."); + }
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (24)
- Nhl.Api.Common/Helpers/TeamNames.cs (2 hunks)
- Nhl.Api.Common/Nhl.Api.Common.csproj (1 hunks)
- Nhl.Api.Domain/Enumerations/Franchise/FranchiseEnum.cs (2 hunks)
- Nhl.Api.Domain/Enumerations/Team/TeamEnum.cs (2 hunks)
- Nhl.Api.Domain/Models/Player/ExpressionPlayerFilterBuilder.cs (13 hunks)
- Nhl.Api.Domain/Models/Player/StatisticsReportType.cs (1 hunks)
- Nhl.Api.Domain/Models/Statistics/GoalieStatisticsFilterResult.cs (3 hunks)
- Nhl.Api.Domain/Models/Statistics/PlayerRealtimeStatisticsFilterResult.cs (1 hunks)
- Nhl.Api.Domain/Models/Statistics/PlayerStatisticsFilterResult.cs (6 hunks)
- Nhl.Api.Domain/Models/Statistics/PlayerTimeOnIceStatisticsFilterResult.cs (1 hunks)
- Nhl.Api.Domain/Models/Team/TeamCodes.cs (2 hunks)
- Nhl.Api.Domain/Nhl.Api.Domain.csproj (1 hunks)
- Nhl.Api.Domain/Services/NhlTeamService.cs (5 hunks)
- Nhl.Api.Tests/LeagueTests.cs (1 hunks)
- Nhl.Api.Tests/Nhl.Api.Tests.csproj (1 hunks)
- Nhl.Api.Tests/ProjectStructureTests.cs (2 hunks)
- Nhl.Api.Tests/StatisticsTests.cs (7 hunks)
- Nhl.Api.Tests/TeamTests.cs (1 hunks)
- Nhl.Api/Nhl.Api.csproj (2 hunks)
- Nhl.Api/README.md (7 hunks)
- Nhl.Api/Src/Api/NhlApi.cs (2 hunks)
- Nhl.Api/Src/LeagueApi/NhlLeagueApi.cs (1 hunks)
- Nhl.Api/Src/StatisticsApi/INhlStatisticsApi.cs (2 hunks)
- Nhl.Api/Src/StatisticsApi/NhlStatisticsApi.cs (2 hunks)
Files skipped from review due to trivial changes (1)
- Nhl.Api.Tests/TeamTests.cs
Additional context used
Markdownlint
Nhl.Api/README.md
1012-1012: Expected: h4; Actual: h5
Heading levels should only increment by one level at a time(MD001, heading-increment)
1024-1024: null
Link fragments should be valid(MD051, link-fragments)
1025-1025: null
Link fragments should be valid(MD051, link-fragments)
1025-1025: null
Link fragments should be valid(MD051, link-fragments)
1026-1026: null
Link fragments should be valid(MD051, link-fragments)
1026-1026: null
Link fragments should be valid(MD051, link-fragments)
1450-1450: Expected: h4; Actual: h5
Heading levels should only increment by one level at a time(MD001, heading-increment)
1462-1462: null
Link fragments should be valid(MD051, link-fragments)
1463-1463: null
Link fragments should be valid(MD051, link-fragments)
1463-1463: null
Link fragments should be valid(MD051, link-fragments)
1464-1464: null
Link fragments should be valid(MD051, link-fragments)
1464-1464: null
Link fragments should be valid(MD051, link-fragments)
2873-2873: Expected: h4; Actual: h5
Heading levels should only increment by one level at a time(MD001, heading-increment)
2885-2885: null
Link fragments should be valid(MD051, link-fragments)
2886-2886: null
Link fragments should be valid(MD051, link-fragments)
2886-2886: null
Link fragments should be valid(MD051, link-fragments)
2887-2887: null
Link fragments should be valid(MD051, link-fragments)
2887-2887: null
Link fragments should be valid(MD051, link-fragments)
2992-2992: Expected: h4; Actual: h5
Heading levels should only increment by one level at a time(MD001, heading-increment)
3004-3004: null
Link fragments should be valid(MD051, link-fragments)
3005-3005: null
Link fragments should be valid(MD051, link-fragments)
3005-3005: null
Link fragments should be valid(MD051, link-fragments)
3006-3006: null
Link fragments should be valid(MD051, link-fragments)
3006-3006: null
Link fragments should be valid(MD051, link-fragments)
Additional comments not posted (45)
Nhl.Api.Common/Nhl.Api.Common.csproj (1)
4-4
: Version update looks good!The version has been correctly updated from 3.4.2 to 3.5.0, which aligns with the PR title "v3.5.0". This minor version increment suggests new features or improvements while maintaining backward compatibility.
Nhl.Api.Domain/Models/Player/StatisticsReportType.cs (2)
1-4
: LGTM: Appropriate using statements and namespace.The using statements are correctly included for the attributes used in the enum, and the namespace follows the expected structure based on the file path.
1-30
: Overall assessment: Well-implemented enum for NHL statistics filtering.This new
StatisticsReportType
enum is a valuable addition to the Nhl.Api.Models.Player namespace. It provides a type-safe way to specify different types of statistics reports for NHL players and goalies, which aligns well with the objectives of the v3.5.0 release.The implementation is generally well-structured, following C# conventions and making good use of attributes for serialization and descriptions. The minor suggestions provided (fixing a typo and considering the use of constants for string values) would further enhance the code quality and maintainability.
Great job on this addition to the API!
Nhl.Api.Domain/Nhl.Api.Domain.csproj (1)
4-4
: Version update looks good.The version has been correctly updated from 3.4.2 to 3.5.0, which aligns with the PR title. This minor version increment suggests new features or improvements that are backwards compatible.
To ensure consistency across the project, please run the following script:
This script will help verify:
- Any other occurrences of the old or new version number in C# files.
- If CHANGELOG.md has been updated with the new version.
- If AssemblyInfo.cs (if it exists) has been updated with the new version.
Please review the results and ensure all necessary updates have been made.
Nhl.Api.Tests/Nhl.Api.Tests.csproj (2)
4-4
: Verify justification for minor version bump.While the version update itself looks good, it's important to ensure that this minor version increase (3.4.x to 3.5.0) is justified by new features or significant enhancements in the codebase.
Could you please provide a brief summary of the new features or significant changes that warrant this minor version bump? This information will be valuable for maintaining a clear changelog and helping users understand what's new in this version.
4-4
: Version update looks good.The version has been correctly updated from 3.4.2 to 3.5.0, which aligns with the PR title. This change follows semantic versioning practices, where a minor version increase typically indicates new features added in a backwards-compatible manner.
Let's verify the version consistency across the project and check for corresponding changes:
This script will help us ensure that the version update is consistent across the project and that there are changes justifying the minor version bump.
Verification successful
This script will help us get a better understanding of the codebase structure, recent modifications, and public API surface, which can indicate potential new features or changes justifying the minor version bump.
Version update to 3.5.0 is justified and consistent.
The minor version bump from 3.4.x to 3.5.0 appears to be warranted based on the following observations:
- All project files (.csproj) consistently show the updated version 3.5.0.
- Nearly all .cs files in the project have been modified within the last 7 days, indicating significant recent changes or updates to the codebase.
- The project has a substantial public API surface, as evidenced by the numerous public classes, interfaces, and enums.
These extensive modifications suggest that new features or improvements have likely been added, which aligns with semantic versioning practices for a minor version increase. However, it's crucial to ensure that these changes maintain backwards compatibility.
Recommendation: Conduct a thorough review of the recent changes to confirm they are backwards-compatible and properly documented.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check version consistency and look for changes justifying the minor version bump # Check for version strings in all .csproj files echo "Checking version consistency in .csproj files:" fd -e csproj -x grep -H '<Version>' {} # Look for new public methods or classes added since the last tag echo "\nChecking for new public methods or classes:" git diff $(git describe --tags --abbrev=0)..HEAD | grep -E '^\+.*public.*' # Check for changes in .cs files since the last tag echo "\nChecking for changes in .cs files:" git diff --name-only $(git describe --tags --abbrev=0)..HEAD | grep '\.cs$'Length of output: 834
Script:
#!/bin/bash # Description: Analyze the codebase structure and recent changes # List all .cs files in the project echo "Listing all .cs files in the project:" fd -e cs # Check for recently modified .cs files (in the last 7 days) echo -e "\nRecently modified .cs files (last 7 days):" find . -name "*.cs" -type f -mtime -7 # Search for public classes and methods in .cs files echo -e "\nPublic classes and methods in the codebase:" rg "public (class|interface|struct|enum|record|delegate|static.*method)" -t cs --no-filename | sort | uniqLength of output: 21250
Nhl.Api/Nhl.Api.csproj (1)
4-4
: Version update looks good.The version has been updated from 3.4.2 to 3.5.0, which aligns with the PR title. This minor version increment suggests new features have been added in a backwards-compatible manner.
Please ensure that:
- The CHANGELOG.md file has been updated to reflect the changes in this version.
- The version increment (minor version bump) accurately represents the scope of changes in this release.
You can verify this by running the following script:
Verification successful
Version update is justified by new features.
The increase from 3.4.2 to 3.5.0 is appropriate given the addition of new methods:
- GetRealtimePlayerStatisticsBySeasonAndFilterExpressionAsync
- GetTimeOnIcePlayerStatisticsBySeasonAndFilterExpressionAsync
These additions provide enhanced functionality for retrieving player statistics, which aligns with a minor version increment according to semantic versioning principles.
While there's no CHANGELOG.md, the README.md updates effectively document these changes. However, for future updates, consider creating a separate CHANGELOG.md file to track version changes more explicitly.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check if CHANGELOG.md exists and contains the new version if [ -f CHANGELOG.md ]; then if grep -q "## \[3.5.0\]" CHANGELOG.md; then echo "CHANGELOG.md contains an entry for version 3.5.0" else echo "Warning: CHANGELOG.md does not contain an entry for version 3.5.0" fi else echo "Warning: CHANGELOG.md file not found" fi # List all files changed in this PR to help verify the scope of changes echo "Files changed in this PR:" git diff --name-only HEAD^Length of output: 218
Script:
#!/bin/bash # Check the contents of the README.md file for version information echo "Checking README.md for version 3.5.0 information:" grep -n -A 5 -B 5 "3\.5\.0" Nhl.Api/README.md echo "\nDiff of README.md changes:" git diff HEAD^ Nhl.Api/README.mdLength of output: 29648
Nhl.Api.Domain/Enumerations/Team/TeamEnum.cs (2)
135-135
: LGTM: Comma added correctlyThe addition of the comma after
SeattleKraken = 55
is correct and necessary for extending the enum. This change maintains the existing syntax and allows for the new entry to be added.
136-139
: Verify team name and enum valueThe addition of the
UtahHockeyClub
entry follows the existing pattern and structure of the enum. However, please verify the following:
- Is "Utah Hockey Club" the official name of the team? Most NHL team names include both a city and a mascot (e.g., "Seattle Kraken").
- The enum value 59 is not consecutive with the previous entry (55). Is this intentional?
Let's check if the value 59 is already used elsewhere in the codebase:
Nhl.Api.Domain/Enumerations/Franchise/FranchiseEnum.cs (1)
163-167
: LGTM with a minor suggestion.The addition of the UtahHockeyClub franchise is correct and consistent with the existing enum structure. The value (40) follows the sequence, and the summary comment is provided as expected.
However, I have a small suggestion:
Consider using a more specific name for the franchise if available. "Utah Hockey Club" seems generic and might change once an official team name is announced. If a more specific name is not yet available, it might be worth adding a TODO comment to update it in the future.
Example:
/// <summary> /// Utah Hockey Club /// </summary> /// TODO: Update with official team name when announced UtahHockeyClub = 40To ensure this addition doesn't conflict with any existing code or documentation, let's verify its uniqueness:
Verification successful
To further investigate the discrepancy between enum values in FranchiseEnum.cs and TeamEnum.cs, let's run an additional script to compare these files:
The UtahHockeyClub entry is consistent with the codebase structure. No changes needed.
After a thorough investigation, I can confirm that the addition of UtahHockeyClub to FranchiseEnum.cs is correct and consistent with the existing codebase structure. Here's a breakdown of the findings:
The UtahHockeyClub entry is present in both FranchiseEnum.cs (value 40) and TeamEnum.cs (value 59).
The difference in enum values between these files is intentional and consistent with the overall structure of each enum:
- FranchiseEnum appears to list all historical and current NHL franchises, with values ranging from 1 to 40.
- TeamEnum likely represents current active teams, with non-consecutive values ranging from 1 to 59.
The name "Utah Hockey Club" is used consistently across multiple files in the codebase, indicating it's an established term.
Given these observations, my earlier suggestion to add a TODO comment for updating the name is unnecessary. The implementation is correct and aligns with the existing code structure.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check for any other occurrences of Utah Hockey Club or the value 40 rg -i "utah.*(hockey|club)" --type cs rg "= 40" --type csLength of output: 1260
Script:
#!/bin/bash # Compare enum values in FranchiseEnum.cs and TeamEnum.cs echo "FranchiseEnum.cs:" rg "= \d+" Nhl.Api.Domain/Enumerations/Franchise/FranchiseEnum.cs | sort -n -k3 echo "\nTeamEnum.cs:" rg "= \d+" Nhl.Api.Domain/Enumerations/Team/TeamEnum.cs | sort -n -k3Length of output: 2124
Nhl.Api.Domain/Models/Statistics/PlayerTimeOnIceStatisticsFilterResult.cs (2)
4-22
: LGTM: Well-structured class with clear purpose and proper JSON serialization.The
PlayerTimeOnIceStatisticsFilterResult
class is well-implemented with descriptive property names and appropriate use ofJsonProperty
attributes for serialization. The summary comments provide clear information about the class and its properties.
24-154
: LGTM: Comprehensive player statistics class with clear property descriptions.The
PlayerTimeOnIceStatisticsResult
class is well-implemented with descriptive property names, appropriate use ofJsonProperty
attributes for serialization, and clear summary comments for each property.Nhl.Api.Domain/Models/Statistics/GoalieStatisticsFilterResult.cs (4)
94-97
: LGTM: Nullable OvertimeLosses propertyThe change from
int
toint?
for theOvertimeLosses
property is appropriate. It allows for scenarios where overtime losses data might not be available, improving the flexibility of the data model. The updated comment accurately reflects this change.
122-125
: Approved: Improved SavePercentage propertyThe change from
double
todecimal?
for theSavePercentage
property is a good improvement:
- It allows for scenarios where save percentage data might not be available.
- Using
decimal
instead ofdouble
is more appropriate for precise decimal calculations, which is crucial for statistics like save percentages.The updated comment accurately reflects this change.
129-132
: LGTM: Nullable Saves propertyThe change from
int
toint?
for theSaves
property is appropriate. It allows for scenarios where saves data might not be available, improving the flexibility of the data model. The updated comment accurately reflects this change.
150-153
: LGTM: Nullable ShotsAgainst propertyThe change from
int
toint?
for theShotsAgainst
property is appropriate. It allows for scenarios where shots against data might not be available, improving the flexibility of the data model. The updated comment accurately reflects this change.Nhl.Api.Domain/Models/Statistics/PlayerStatisticsFilterResult.cs (9)
38-41
: LGTM: Nullable type for EvenStrengthGoalsThe change from
int
toint?
forEvenStrengthGoals
is appropriate. It allows for representing missing or undefined data, which is common in sports statistics. The updated XML comment accurately reflects this change.
45-48
: LGTM: Nullable type for EvenStrengthPointsThe change to
int?
forEvenStrengthPoints
is consistent with the previous property change. It appropriately allows for null values, and the XML comment has been updated accordingly.
108-111
: LGTM: Nullable type for PlusMinusChanging
PlusMinus
toint?
is a good decision. Plus/minus can be undefined in certain situations (e.g., goalies), so allowing null values enhances the model's flexibility. The XML comment has been appropriately updated.
136-139
: LGTM: Nullable type for PowerPlayGoalsThe change to
int?
forPowerPlayGoals
is consistent with the previous changes and appropriate for the domain. It allows for representing situations where power play goal data might be missing or undefined. The XML comment has been correctly updated.
143-146
: LGTM: Nullable type for PowerPlayPointsChanging
PowerPlayPoints
toint?
is consistent with thePowerPlayGoals
change and other properties. This allows for null values when data is missing or undefined, which is appropriate for power play statistics. The XML comment has been properly updated.
157-160
: LGTM: Nullable type for ShortHandedGoalsThe change to
int?
forShortHandedGoals
is consistent with the previous property changes. It appropriately allows for null values in cases where short-handed goal data might be missing or undefined. The XML comment has been correctly updated to reflect this change.
164-167
: LGTM: Nullable type for ShortHandedPointsChanging
ShortHandedPoints
toint?
is consistent with theShortHandedGoals
change and other properties. This allows for null values when data is missing or undefined, which is appropriate for short-handed statistics. The XML comment has been properly updated to reflect the nullable nature of the property.
171-174
: LGTM: Updated comment for ShootingPercentageThe XML comment for
ShootingPercentage
has been appropriately updated to indicate that the value can be null. This is consistent with the property's existing nullable type (decimal?
) and aligns with the changes made to other properties in this class.
Line range hint
1-211
: Overall: Improved flexibility for representing player statisticsThe changes in this file consistently update several properties in the
PlayerStatisticsResult
class from non-nullable to nullable integer types. This modification enhances the model's ability to represent missing or undefined data, which is common in sports statistics. The affected properties include various goal and point statistics for different game situations (even strength, power play, short-handed).These changes improve the robustness of the data model and allow for more accurate representation of player statistics, especially in cases where certain data points might not be available or applicable. The XML comments have been consistently updated to reflect these changes, maintaining good documentation practices.
The only minor suggestion is to remove one of the two empty lines at the end of the file to adhere to common coding standards.
Overall, these changes represent a positive improvement to the
PlayerStatisticsResult
class.Nhl.Api.Domain/Models/Statistics/PlayerRealtimeStatisticsFilterResult.cs (2)
4-22
: LGTM: Well-structured class with clear purpose and proper JSON serialization.The
PlayerRealtimeStatisticsFilterResult
class is well-implemented with appropriate documentation and JSON serialization attributes. It follows C# naming conventions and provides a clear structure for representing filtered NHL player statistics results.
1-203
: Excellent implementation of NHL player statistics models.This file demonstrates a high-quality implementation of data models for NHL player statistics. Key strengths include:
- Clear and consistent use of namespaces and JSON serialization attributes.
- Comprehensive coverage of player statistics with well-named and documented properties.
- Appropriate use of nullable types for statistical data.
- Adherence to C# naming conventions and best practices.
The models provide a solid foundation for working with NHL player statistics in the application, balancing between C# conventions and JSON serialization requirements.
Nhl.Api.Domain/Models/Team/TeamCodes.cs (1)
Line range hint
1-244
: Verify usage and update documentation for the new team constant.While the addition of the
UtahHockeyClub
constant is correct, it's important to ensure that this new team is properly integrated into the rest of the codebase and documentation.Please run the following script to check for potential places where the new team constant should be used:
Also, please ensure that any relevant documentation, such as API documentation or developer guides, is updated to include information about the Utah Hockey Club.
Nhl.Api.Domain/Services/NhlTeamService.cs (5)
116-116
: LGTM: Utah Hockey Club support added correctlyThe new case for the Utah Hockey Club has been added correctly to the
GetTeamCodeIdentifierByTeamId
method. This change is consistent with the existing pattern and properly extends support for the new team.
161-161
: LGTM: Utah Hockey Club abbreviation mapping addedThe new case for the Utah Hockey Club has been correctly added to the
GetTeamCodeIdentifierByTeamAbbreviation
method. This change maintains consistency with the existing pattern and properly extends support for the new team's abbreviation.
205-205
: LGTM: Utah Hockey Club enum mapping addedThe new case for the Utah Hockey Club has been properly added to the
GetTeamCodeIdentifierByTeamEnumeration
method. This change is in line with the existing pattern and correctly extends support for the new team's enumeration.
Line range hint
1-267
: Verify complete integration of Utah Hockey ClubThe changes to add support for the Utah Hockey Club in the
NhlTeamService
class are consistent and follow the existing patterns. However, to ensure full integration, it would be beneficial to verify if any other parts of the codebase need to be updated.Please run the following script to check for any other occurrences of team-related code that might need updating:
#!/bin/bash # Description: Check for other occurrences of team-related code echo "Checking for other team-related occurrences:" rg --type csharp "(Team(Enum|Names|Codes)|NHL\s+team)" -g '!NhlTeamService.cs' echo "Checking for test files that might need updating:" fd -e cs | rg -i "test"Review the output to ensure that all necessary updates have been made across the codebase to fully support the Utah Hockey Club.
265-265
: LGTM: Utah Hockey Club name mapping addedThe new case for the Utah Hockey Club has been correctly added to the
GetTeamCodeIdentifierByTeamName
method. This change maintains consistency with the existing pattern and properly extends support for the new team's name.Please ensure that the
TeamNames
andTeamCodes
enums have been updated in their respective files to include the Utah Hockey Club. Run the following script to verify:Verification successful
Utah Hockey Club successfully added to TeamNames and TeamCodes
The verification process has confirmed that the Utah Hockey Club has been correctly added to both the TeamNames and TeamCodes classes. Specifically:
- In
Nhl.Api.Common/Helpers/TeamNames.cs
:
public const string UtahHockeyClub = "Utah Hockey Club";
- In
Nhl.Api.Domain/Models/Team/TeamCodes.cs
:
public const string UtahHockeyClub = "UTA";
These additions ensure that the new team is properly represented in the codebase for both its full name and its abbreviated code.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that TeamNames and TeamCodes enums include Utah Hockey Club # Check TeamNames enum echo "Checking TeamNames enum:" rg --type csharp "public\s+enum\s+TeamNames" -A 50 | rg "UtahHockeyClub" # Check TeamCodes enum echo "Checking TeamCodes enum:" rg --type csharp "public\s+enum\s+TeamCodes" -A 50 | rg "UtahHockeyClub"Length of output: 105490
Script:
#!/bin/bash # Find files containing TeamNames and TeamCodes enums echo "Searching for files containing TeamNames and TeamCodes enums:" fd -e cs | xargs rg "public\s+(enum|static\s+class)\s+(TeamNames|TeamCodes)" # Search for UtahHockeyClub in the found files echo "\nSearching for UtahHockeyClub in the enum files:" fd -e cs | xargs rg "public\s+(enum|static\s+class)\s+(TeamNames|TeamCodes)" -l | xargs rg "UtahHockeyClub"Length of output: 749
Nhl.Api/Src/StatisticsApi/INhlStatisticsApi.cs (1)
141-163
: Overall, good additions to the API.The two new methods,
GetRealtimePlayerStatisticsBySeasonAndFilterExpressionAsync
andGetTimeOnIcePlayerStatisticsBySeasonAndFilterExpressionAsync
, are well-structured and consistent with the existing interface. They enhance the API's functionality by providing more specific statistical data. The minor suggestions for improvement (default sort value and documentation fix) will further refine these additions.Nhl.Api/Src/LeagueApi/NhlLeagueApi.cs (1)
413-418
: Verify the impact of adding the new team.While the addition of the Utah Hockey Club colors is correct, it's important to ensure that this change is reflected consistently across the codebase.
Please run the following script to check for any other occurrences of
TeamEnum
that might need updating:This will help identify any other places in the code that might need to be updated to accommodate the new team.
Nhl.Api/README.md (1)
Line range hint
1-3010
: Summary of README changesThe additions to the README file for the Nhl.Api project are well-documented and consistent with the existing style. Two new methods have been added:
- GetRealtimePlayerStatisticsBySeasonAndFilterExpressionAsync
- GetTimeOnIcePlayerStatisticsBySeasonAndFilterExpressionAsync
Both methods are properly integrated into the existing documentation structure, providing clear information about their parameters, return values, and functionality.
The changes to the README file are appropriate and maintain the overall quality of the documentation. The new methods enhance the API's capabilities for retrieving real-time and time-on-ice statistics, which should be valuable for users of the library.
Tools
Markdownlint
1012-1012: Expected: h4; Actual: h5
Heading levels should only increment by one level at a time(MD001, heading-increment)
1024-1024: null
Link fragments should be valid(MD051, link-fragments)
1025-1025: null
Link fragments should be valid(MD051, link-fragments)
1025-1025: null
Link fragments should be valid(MD051, link-fragments)
1026-1026: null
Link fragments should be valid(MD051, link-fragments)
1026-1026: null
Link fragments should be valid(MD051, link-fragments)
Nhl.Api.Domain/Models/Player/ExpressionPlayerFilterBuilder.cs (3)
45-53
: LGTM!The addition of the
AddFilter(PlayerRealtimeStatisticsFilter playerRealtimeStatisticsFilter)
method follows the existing pattern and extends functionality appropriately.
55-65
: LGTM!The
AddFilter(PlayerTimeOnIceStatisticsFilter playerTimeOnIceStatisticsFilter)
method is correctly implemented and consistent with the existing code base.
Line range hint
66-75
: Improved readability with<code>
tags in documentation commentsUsing
<code>
tags around keywords like'contains'
enhances the readability of the documentation. This consistent formatting is beneficial for developers referencing these methods.Nhl.Api.Tests/StatisticsTests.cs (4)
698-702
: Incorrect method call in testIn the test method
GetRealtimePlayerStatisticsBySeasonAndFilterAsync_Returns_Valid_Results_Based_On_Empty_Expression
, the methodGetPlayerStatisticsBySeasonAndFilterExpressionAsync
is called instead ofGetRealtimePlayerStatisticsBySeasonAndFilterExpressionAsync
. This mismatch can lead to incorrect test coverage.Apply this diff to correct the method call:
- var result = await nhlApi.GetPlayerStatisticsBySeasonAndFilterExpressionAsync(SeasonYear.season20102011, expression); + var result = await nhlApi.GetRealtimePlayerStatisticsBySeasonAndFilterExpressionAsync(SeasonYear.season20102011, expression);Likely invalid or redundant comment.
699-699
: Change comment to '// Assert'The comment on line 699 should be '// Assert' instead of '// Act' since the code is performing assertions.
Apply this diff to correct the comment:
- // Act + // AssertLikely invalid or redundant comment.
739-739
: Change comment to '// Assert'The comment on line 739 should be '// Assert' instead of '// Act' since the code is performing assertions.
Apply this diff to correct the comment:
- // Act + // AssertLikely invalid or redundant comment.
793-793
: Change comment to '// Assert'The comment on line 793 should be '// Assert' instead of '// Act' since the code is performing assertions.
Apply this diff to correct the comment:
- // Act + // AssertLikely invalid or redundant comment.
Nhl.Api/Src/Api/NhlApi.cs (2)
667-668
: Implementation of GetRealtimePlayerStatisticsBySeasonAndFilterExpressionAsync is correctThe method correctly delegates the call to
_nhlStatisticsApi
, passing all parameters appropriately.
680-681
: Implementation of GetTimeOnIcePlayerStatisticsBySeasonAndFilterExpressionAsync is correctThe method correctly calls
_nhlStatisticsApi
with the appropriate parameters.
Nhl.Api.Domain/Models/Statistics/PlayerTimeOnIceStatisticsFilterResult.cs
Show resolved
Hide resolved
Changed return type of `GetTeamCodeIdentifierByTeamId`, `GetTeamCodeIdentifierByTeamAbbreviation`, and `GetTeamCodeIdentifierByTeamEnumeration` methods in `NhlTeamService` class from `string` to `string?` to allow null values. This helps indicate when no valid team code identifier is found. Re-enabled test cases in `LeagueTests` class by removing commented-out `[DataRow]` attributes and re-adding them without comments for the `GetTeamStatisticsBySeasonAndGameTypeAsync_Return_Valid_Information_With_TeamId` method.
Reordered and organized `using` directives across multiple files, placing `System` namespaces at the top and `Newtonsoft.Json` after them. Moved `namespace` declarations to follow `using` directives for better readability. Made minor formatting changes in `PlayerRealtimeStatisticsFilterResult.cs` and `NhlApi.cs`. Updated `GlobalUsings.cs` by removing redundant directives. Added necessary `using` directives to test files.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Outside diff range and nitpick comments (5)
Nhl.Api/Src/GlobalUsings.cs (1)
14-14
: Approved. Consider further organizing global using directives.Moving the
Nhl.Api.Models.Enumerations.Player
namespace is fine and doesn't affect functionality. It's now grouped more logically with other project-specific namespaces.As a suggestion for future improvements, consider organizing all global using directives into logical groups (e.g., System namespaces, third-party libraries, and project-specific namespaces) and sorting them alphabetically within each group for better readability and maintenance.
Nhl.Api.Domain/Services/NhlTeamService.cs (2)
20-20
: LGTM! Consider updating documentation for nullable returns.The change to nullable string return types (
string?
) for these methods improves flexibility and aligns with C# nullable reference types. This is a good practice for handling potential null values.Consider updating the method documentation to reflect that these methods can now return null, and under what circumstances a null value might be returned.
Also applies to: 27-27, 34-34, 41-41, 55-55
Based on the script output, we can confirm the inconsistency in the
GetTeamCodeIdentifierByTeamName
method. Let's generate the final response.Inconsistent return type in
GetTeamCodeIdentifierByTeamName
methodThe
GetTeamCodeIdentifierByTeamName
method in theNhlTeamService
class is inconsistent with the other methods and its interface declaration. It currently returnsstring
instead ofstring?
.To fix this:
Change the method signature in the
NhlTeamService
class from:public string GetTeamCodeIdentifierByTeamName(string teamName)to:
public string? GetTeamCodeIdentifierByTeamName(string teamName)Consider handling the
ArgumentException
case to returnnull
instead of throwing an exception, to be consistent with the nullable return type and the behavior of other methods.This change will ensure consistency across the service and prevent potential null reference exceptions for consumers of the API.
Analysis chain
Line range hint
1-268
: Overall good changes with one inconsistency to address.The changes in this file generally improve the API by allowing for nullable returns, which provides more flexibility in handling unknown or invalid inputs. The addition of the Utah Hockey Club is consistent across all methods, which is good for maintainability.
Key points:
- The interface and most method implementations now correctly use
string?
return types.- The Utah Hockey Club has been added consistently to all relevant switch statements.
- There's an inconsistency in the
GetTeamCodeIdentifierByTeamName
method that should be addressed as per the previous comment.These changes may introduce breaking changes for consumers of this API, so ensure that this is communicated in release notes and version numbers are updated appropriately.
To ensure all methods are consistent, run the following script:
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all public methods in NhlTeamService.cs return string? # Test: Check if all public methods in the interface and class return string? rg --type csharp 'public string\?? \w+\(' Nhl.Api.Domain/Services/NhlTeamService.csLength of output: 947
Nhl.Api.Tests/StatisticsTests.cs (2)
619-653
: LGTM with a minor suggestionThis new test method effectively checks the retrieval of real-time player statistics with specific filters. It's well-structured and covers an important use case.
There's a minor issue with a comment:
- // Act + // AssertThis change aligns the comment with the actual operation being performed in that section of the test.
655-684
: LGTM with a minor suggestionThis new test method effectively checks the retrieval of real-time player statistics for the 2020-2021 season with specific filters. It's well-structured and provides good coverage for a particular use case.
There's a minor issue with a comment:
- // Act + // AssertThis change aligns the comment with the actual operation being performed in that section of the test.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (50)
- Nhl.Api.Common/Http/NhlApiHttpClient.cs (1 hunks)
- Nhl.Api.Common/Services/CachingService.cs (1 hunks)
- Nhl.Api.Domain/Enumerations/Player/PlayerEnumFileGeneratorHelper.cs (1 hunks)
- Nhl.Api.Domain/Models/Game/GameCenterBoxScore.cs (1 hunks)
- Nhl.Api.Domain/Models/Game/GameCenterLanding.cs (1 hunks)
- Nhl.Api.Domain/Models/Game/GameCenterPlayByPlay.cs (1 hunks)
- Nhl.Api.Domain/Models/Game/GameMetadata.cs (1 hunks)
- Nhl.Api.Domain/Models/Game/GameScore.cs (1 hunks)
- Nhl.Api.Domain/Models/Game/GameScoreboard.cs (1 hunks)
- Nhl.Api.Domain/Models/Game/GoalieSeasonGameLog.cs (1 hunks)
- Nhl.Api.Domain/Models/Game/PlayerSeasonGameLog.cs (1 hunks)
- Nhl.Api.Domain/Models/Game/TeamScoreboard.cs (1 hunks)
- Nhl.Api.Domain/Models/Game/TvScheduleBroadcast.cs (1 hunks)
- Nhl.Api.Domain/Models/League/LeagueMetadataInformation.cs (1 hunks)
- Nhl.Api.Domain/Models/Player/ExpressionGoalieFilterBuilder.cs (1 hunks)
- Nhl.Api.Domain/Models/Player/ExpressionPlayerFilterBuilder.cs (13 hunks)
- Nhl.Api.Domain/Models/Player/GoalieProfile.cs (1 hunks)
- Nhl.Api.Domain/Models/Player/PlayerData.cs (1 hunks)
- Nhl.Api.Domain/Models/Player/PlayerProfile.cs (1 hunks)
- Nhl.Api.Domain/Models/Player/PlayerShiftInformation.cs (1 hunks)
- Nhl.Api.Domain/Models/Player/TeamProspects.cs (1 hunks)
- Nhl.Api.Domain/Models/Schedule/LeagueSchedule.cs (1 hunks)
- Nhl.Api.Domain/Models/Schedule/LeagueScheduleCalendar.cs (1 hunks)
- Nhl.Api.Domain/Models/Schedule/TeamSchedule.cs (1 hunks)
- Nhl.Api.Domain/Models/Schedule/TeamSeasonSchedule.cs (1 hunks)
- Nhl.Api.Domain/Models/Schedule/TeamWeekSchedule.cs (1 hunks)
- Nhl.Api.Domain/Models/Season/LeagueStandingsSeasonInformation.cs (1 hunks)
- Nhl.Api.Domain/Models/Season/TeamStatisticsSeason.cs (1 hunks)
- Nhl.Api.Domain/Models/Standing/LeagueStanding.cs (1 hunks)
- Nhl.Api.Domain/Models/Statistics/GoalieStatisticsFilterResult.cs (4 hunks)
- Nhl.Api.Domain/Models/Statistics/GoalieStatisticsLeaders.cs (1 hunks)
- Nhl.Api.Domain/Models/Statistics/PlayerRealtimeStatisticsFilterResult.cs (1 hunks)
- Nhl.Api.Domain/Models/Statistics/PlayerStatisticLeaders.cs (1 hunks)
- Nhl.Api.Domain/Models/Statistics/PlayerStatisticsFilterResult.cs (6 hunks)
- Nhl.Api.Domain/Models/Statistics/PlayerTimeOnIceStatisticsFilterResult.cs (1 hunks)
- Nhl.Api.Domain/Models/Team/TeamSeasonRoster.cs (1 hunks)
- Nhl.Api.Domain/Models/Team/TeamSeasonStatistics.cs (1 hunks)
- Nhl.Api.Domain/Services/NhlTeamService.cs (11 hunks)
- Nhl.Api.Tests/GameTests.cs (1 hunks)
- Nhl.Api.Tests/GlobalUsings.cs (1 hunks)
- Nhl.Api.Tests/LeagueTests.cs (2 hunks)
- Nhl.Api.Tests/NhlApiAsyncHelperTests.cs (1 hunks)
- Nhl.Api.Tests/PlayerTests.cs (1 hunks)
- Nhl.Api.Tests/ProjectStructureTests.cs (2 hunks)
- Nhl.Api.Tests/StatisticsTests.cs (8 hunks)
- Nhl.Api.Tests/TeamTests.cs (2 hunks)
- Nhl.Api/Src/Api/NhlApi.cs (1 hunks)
- Nhl.Api/Src/GlobalUsings.cs (1 hunks)
- Nhl.Api/Src/StatisticsApi/INhlStatisticsApi.cs (2 hunks)
- Nhl.Api/Src/StatisticsApi/NhlStatisticsApi.cs (2 hunks)
Files skipped from review due to trivial changes (36)
- Nhl.Api.Common/Http/NhlApiHttpClient.cs
- Nhl.Api.Common/Services/CachingService.cs
- Nhl.Api.Domain/Enumerations/Player/PlayerEnumFileGeneratorHelper.cs
- Nhl.Api.Domain/Models/Game/GameCenterBoxScore.cs
- Nhl.Api.Domain/Models/Game/GameCenterLanding.cs
- Nhl.Api.Domain/Models/Game/GameCenterPlayByPlay.cs
- Nhl.Api.Domain/Models/Game/GameMetadata.cs
- Nhl.Api.Domain/Models/Game/GameScore.cs
- Nhl.Api.Domain/Models/Game/GameScoreboard.cs
- Nhl.Api.Domain/Models/Game/GoalieSeasonGameLog.cs
- Nhl.Api.Domain/Models/Game/PlayerSeasonGameLog.cs
- Nhl.Api.Domain/Models/Game/TeamScoreboard.cs
- Nhl.Api.Domain/Models/Game/TvScheduleBroadcast.cs
- Nhl.Api.Domain/Models/League/LeagueMetadataInformation.cs
- Nhl.Api.Domain/Models/Player/ExpressionGoalieFilterBuilder.cs
- Nhl.Api.Domain/Models/Player/GoalieProfile.cs
- Nhl.Api.Domain/Models/Player/PlayerData.cs
- Nhl.Api.Domain/Models/Player/PlayerProfile.cs
- Nhl.Api.Domain/Models/Player/PlayerShiftInformation.cs
- Nhl.Api.Domain/Models/Player/TeamProspects.cs
- Nhl.Api.Domain/Models/Schedule/LeagueSchedule.cs
- Nhl.Api.Domain/Models/Schedule/LeagueScheduleCalendar.cs
- Nhl.Api.Domain/Models/Schedule/TeamSchedule.cs
- Nhl.Api.Domain/Models/Schedule/TeamSeasonSchedule.cs
- Nhl.Api.Domain/Models/Schedule/TeamWeekSchedule.cs
- Nhl.Api.Domain/Models/Season/LeagueStandingsSeasonInformation.cs
- Nhl.Api.Domain/Models/Season/TeamStatisticsSeason.cs
- Nhl.Api.Domain/Models/Standing/LeagueStanding.cs
- Nhl.Api.Domain/Models/Statistics/GoalieStatisticsLeaders.cs
- Nhl.Api.Domain/Models/Statistics/PlayerStatisticLeaders.cs
- Nhl.Api.Domain/Models/Team/TeamSeasonRoster.cs
- Nhl.Api.Domain/Models/Team/TeamSeasonStatistics.cs
- Nhl.Api.Tests/GameTests.cs
- Nhl.Api.Tests/GlobalUsings.cs
- Nhl.Api.Tests/NhlApiAsyncHelperTests.cs
- Nhl.Api.Tests/PlayerTests.cs
Files skipped from review as they are similar to previous changes (11)
- Nhl.Api.Domain/Models/Player/ExpressionPlayerFilterBuilder.cs
- Nhl.Api.Domain/Models/Statistics/GoalieStatisticsFilterResult.cs
- Nhl.Api.Domain/Models/Statistics/PlayerRealtimeStatisticsFilterResult.cs
- Nhl.Api.Domain/Models/Statistics/PlayerStatisticsFilterResult.cs
- Nhl.Api.Domain/Models/Statistics/PlayerTimeOnIceStatisticsFilterResult.cs
- Nhl.Api.Tests/LeagueTests.cs
- Nhl.Api.Tests/ProjectStructureTests.cs
- Nhl.Api.Tests/TeamTests.cs
- Nhl.Api/Src/Api/NhlApi.cs
- Nhl.Api/Src/StatisticsApi/INhlStatisticsApi.cs
- Nhl.Api/Src/StatisticsApi/NhlStatisticsApi.cs
Additional comments not posted (8)
Nhl.Api/Src/GlobalUsings.cs (1)
3-8
: LGTM! Good addition of global using directives.The addition of these common System namespace global using directives is a positive change. It will simplify code throughout the project by reducing the need for explicit using statements in individual files. This aligns well with modern C# practices, especially since the introduction of global using directives in C# 10.
Nhl.Api.Domain/Services/NhlTeamService.cs (4)
70-70
: LGTM! Implementation correctly handles nullable return.The change to
string?
return type is consistent with the interface update. The implementation correctly handles the possibility of returning null for unknown team logo types.
82-82
: LGTM! New team added and nullable return handled correctly.The change to
string?
return type is consistent with the interface update. The new case for Utah Hockey Club is correctly implemented, and the default case returning null is appropriate for unknown team IDs.Also applies to: 116-116
125-125
: LGTM! New team added and nullable return handled correctly.The change to
string?
return type is consistent with the interface update. The new case for Utah Hockey Club is correctly implemented, and the default case returning null is appropriate for unknown team abbreviations.Also applies to: 161-161
171-171
: LGTM! New team added and nullable return handled correctly.The change to
string?
return type is consistent with the interface update. The new case for Utah Hockey Club is correctly implemented, and the default case returning null is appropriate for unknown team enumerations.Also applies to: 205-205
Nhl.Api.Tests/StatisticsTests.cs (3)
755-808
: LGTM! Comprehensive test for complex queryThis test method effectively checks the retrieval of real-time player statistics with a complex filter query, including nested conditions. It's well-structured and provides excellent coverage for intricate query scenarios.
The assertions thoroughly validate all the filter conditions, ensuring that the API correctly handles complex combinations of filters. This is crucial for maintaining the reliability and flexibility of the statistics retrieval functionality.
Line range hint
854-1461
: Excellent expansion of test coverageThe additions to this test file significantly enhance the coverage of the NHL API's statistics-related functionality. Here are the key improvements:
Comprehensive season coverage: The data-driven tests (lines 854-961 and 975-1082) ensure that the API functions correctly across a wide range of seasons, which is crucial for historical data integrity.
Edge case handling: Tests for the 2004-2005 lockout season (lines 1097-1128) verify that the API correctly handles this exceptional case.
Error case testing: The new tests for invalid inputs (e.g., lines 1249-1461) are valuable for ensuring proper input validation and error handling in the API.
Complex query testing: The tests for complex filter queries (e.g., lines 1140-1244) verify that the API can handle intricate combinations of filters correctly.
These additions significantly strengthen the test suite, providing better assurance of the API's reliability and correctness across various scenarios and edge cases.
Line range hint
1-1461
: Overall assessment: Significant improvement in test coverageThis update to the
StatisticsTests.cs
file represents a substantial enhancement to the test suite for the NHL API's statistics functionality. The key strengths of these changes include:
- Expanded coverage of complex queries and filter combinations.
- Comprehensive testing across multiple NHL seasons.
- Improved error case and edge condition testing.
- Use of data-driven tests to efficiently cover multiple scenarios.
While there are a few minor issues with comments and method names, these do not detract from the overall quality and value of the additions. Addressing these small inconsistencies will further improve the clarity and maintainability of the test suite.
These changes significantly strengthen the reliability and robustness of the NHL API by ensuring its correct behavior across a wide range of scenarios and input conditions.
Improved the documentation for `GetRealtimePlayerStatisticsBySeasonAndFilterExpressionAsync` and `GetTimeOnIcePlayerStatisticsBySeasonAndFilterExpressionAsync` methods. Clarified that these methods return statistics for players matching the provided filter expressions for a specific season. Updated parameter descriptions to specify the type of statistics filter used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range and nitpick comments (3)
Nhl.Api/README.md (3)
161-163
: LGTM! Minor formatting suggestion.The new method
GetRealtimePlayerStatisticsBySeasonAndFilterExpressionAsync
is well-documented and consistent with the existing API style. However, for better readability, consider breaking the long parameter list into multiple lines, aligning each parameter.Consider reformatting the parameter list like this:
GetRealtimePlayerStatisticsBySeasonAndFilterExpressionAsync( seasonYear, expressionPlayerFilter, playerRealtimeStatisticsFilterToSortBy, limit, offsetStart, cancellationToken)
184-186
: LGTM! Minor formatting suggestion.The new method
GetTimeOnIcePlayerStatisticsBySeasonAndFilterExpressionAsync
is well-documented and consistent with the existing API style. However, for better readability, consider breaking the long parameter list into multiple lines, aligning each parameter.Consider reformatting the parameter list like this:
GetTimeOnIcePlayerStatisticsBySeasonAndFilterExpressionAsync( seasonYear, expressionPlayerFilter, playerTimeOnIceStatisticsFilterToSortBy, limit, offsetStart, cancellationToken)
Line range hint
1-3070
: Minor markdown structure improvements neededThe README file is comprehensive and well-organized. However, there are a few minor markdown structure issues that should be addressed:
- Some heading levels are inconsistent. Ensure that heading levels only increment by one level at a time.
- There are invalid link fragments in some of the documentation. Please review and correct these links to ensure they point to the correct sections.
Addressing these issues will improve the overall structure and navigation of the documentation.
Tools
Markdownlint
1012-1012: Expected: h4; Actual: h5
Heading levels should only increment by one level at a time(MD001, heading-increment)
1024-1024: null
Link fragments should be valid(MD051, link-fragments)
1025-1025: null
Link fragments should be valid(MD051, link-fragments)
1025-1025: null
Link fragments should be valid(MD051, link-fragments)
1026-1026: null
Link fragments should be valid(MD051, link-fragments)
1026-1026: null
Link fragments should be valid(MD051, link-fragments)
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- Nhl.Api/README.md (7 hunks)
Additional context used
Markdownlint
Nhl.Api/README.md
1012-1012: Expected: h4; Actual: h5
Heading levels should only increment by one level at a time(MD001, heading-increment)
1024-1024: null
Link fragments should be valid(MD051, link-fragments)
1025-1025: null
Link fragments should be valid(MD051, link-fragments)
1025-1025: null
Link fragments should be valid(MD051, link-fragments)
1026-1026: null
Link fragments should be valid(MD051, link-fragments)
1026-1026: null
Link fragments should be valid(MD051, link-fragments)
1450-1450: Expected: h4; Actual: h5
Heading levels should only increment by one level at a time(MD001, heading-increment)
1462-1462: null
Link fragments should be valid(MD051, link-fragments)
1463-1463: null
Link fragments should be valid(MD051, link-fragments)
1463-1463: null
Link fragments should be valid(MD051, link-fragments)
1464-1464: null
Link fragments should be valid(MD051, link-fragments)
1464-1464: null
Link fragments should be valid(MD051, link-fragments)
2873-2873: Expected: h4; Actual: h5
Heading levels should only increment by one level at a time(MD001, heading-increment)
2885-2885: null
Link fragments should be valid(MD051, link-fragments)
2886-2886: null
Link fragments should be valid(MD051, link-fragments)
2886-2886: null
Link fragments should be valid(MD051, link-fragments)
2887-2887: null
Link fragments should be valid(MD051, link-fragments)
2887-2887: null
Link fragments should be valid(MD051, link-fragments)
2992-2992: Expected: h4; Actual: h5
Heading levels should only increment by one level at a time(MD001, heading-increment)
3004-3004: null
Link fragments should be valid(MD051, link-fragments)
3005-3005: null
Link fragments should be valid(MD051, link-fragments)
3005-3005: null
Link fragments should be valid(MD051, link-fragments)
3006-3006: null
Link fragments should be valid(MD051, link-fragments)
3006-3006: null
Link fragments should be valid(MD051, link-fragments)
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
- Added `System.Threading` using directive in `TestMethodWithRetryAttribute.cs`. - Changed default `RetryDelayInSeconds` to 1 second. - Updated `Execute` method to use instance properties `RetryCount` and `RetryDelayInSeconds`. - Removed unnecessary comment in `TeamTests` class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- Nhl.Api.Domain/Services/NhlTeamService.cs (11 hunks)
- Nhl.Api.Tests/Helpers/Attributes/TestMethodWithRetryAttribute.cs (2 hunks)
- Nhl.Api.Tests/TeamTests.cs (1 hunks)
Files skipped from review as they are similar to previous changes (2)
- Nhl.Api.Domain/Services/NhlTeamService.cs
- Nhl.Api.Tests/TeamTests.cs
Additional comments not posted (2)
Nhl.Api.Tests/Helpers/Attributes/TestMethodWithRetryAttribute.cs (2)
1-1
: Proper Inclusion ofSystem.Linq
NamespaceThe addition of
using System.Linq;
is appropriate and necessary for utilizing LINQ methods likeAny()
andFirst()
later in the code.
19-19
: Changed Default Value forRetryDelayInSeconds
The default value of
RetryDelayInSeconds
has been updated from0
to1
. This introduces a minimum delay of one second between retries. Ensure that this change aligns with the desired testing behavior and does not negatively impact tests that require immediate retries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- Nhl.Api/Src/GameApi/NhlGameApi.cs (1 hunks)
🔇 Additional comments (1)
Nhl.Api/Src/GameApi/NhlGameApi.cs (1)
156-167
: Efficient asynchronous data retrieval implemented correctlyThe refactored
GetGameCenterBoxScoreByGameIdAsync
method improves efficiency by fetching data concurrently usingTask.WhenAll
and combining the results. The implementation aligns with asynchronous programming best practices.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
Nhl.Api.Tests/StatisticsTests.cs (2)
1097-1111
: Inconsistent use of test method attributesThe test method
GetPlayerStatisticsBySeasonAndFilterExpressionAsync_Returns_Valid_Results_For_Each_Season_With_04_05_Lockout
is marked with[TestMethod]
, whereas other test methods in this class use[TestMethodWithRetry(RetryCount = 5)]
. For consistency, consider updating the attribute to include the retry logic.
1113-1128
: Inconsistent use of test method attributesThe test method
GetGoalieStatisticsBySeasonAndFilterAsync_Returns_Valid_Results_For_Each_Season_With_04_05_Lockout
is marked with[TestMethod]
, while other test methods use[TestMethodWithRetry(RetryCount = 5)]
. To maintain consistency and potentially improve test reliability, consider applying the retry attribute.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- Nhl.Api.Tests/StatisticsTests.cs (15 hunks)
🔇 Additional comments (1)
Nhl.Api.Tests/StatisticsTests.cs (1)
686-702
: Method name inconsistent with API call [Duplicate Issue]This issue was previously identified, and the past review comment still applies.
No description provided.