You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here are some key observations to aid the review process:
⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review
Null Check The IsCommandNameDefined method should validate that commandName is not null before accessing the dictionary, since it has a documented ArgumentNullException
Possible Bug The FindCommandName method compares CommandInfo objects using == operator which may not work as expected for reference equality. Consider implementing proper equality comparison
public string? FindCommandName(CommandInfo commandInfo)
{
+ if (commandInfo == null)+ throw new ArgumentNullException(nameof(commandInfo));+
foreach (KeyValuePair<string, CommandInfo> pair in this.commandDictionary)
{
if (pair.Value == commandInfo)
Apply this suggestion
Suggestion importance[1-10]: 8
Why: The suggestion addresses a critical null reference safety issue by adding parameter validation, which is especially important given the PR's focus on enabling nullable reference types and improving exception handling.
8
Add consistent null parameter validation across public methods
Add null check for commandName parameter in GetCommandInfo method to maintain consistency with other methods that throw ArgumentNullException for null command names.
public T? GetCommandInfo<T>(string commandName) where T : CommandInfo
{
+ if (commandName == null)+ throw new ArgumentNullException(nameof(commandName));+
if (this.commandDictionary.TryGetValue(commandName, out CommandInfo? info))
{
return info as T;
}
Apply this suggestion
Suggestion importance[1-10]: 8
Why: The suggestion maintains consistency with other methods in the codebase that throw ArgumentNullException for null parameters, aligning with the PR's goal of improving null safety and exception documentation.
Format issues seems to be coming from rust/src/lock.rs, and test failure is in //java/test/org/openqa/selenium:ClickTest-firefox-beta. I think this PR has no issues.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it
Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.
Description
Annotates nullability on the
CommandInfoRepositoryclass, as well as its sole implementationMotivation and Context
Contributes to #14640
Types of changes
Checklist
PR Type
enhancement
Description
CommandInfoRepositoryandW3CWireProtocolCommandInfoRepositoryclasses.GetCommandInfomethod to useTryGetValue.W3CWireProtocolCommandInfoRepositoryusing expression-bodied members.Changes walkthrough 📝
CommandInfoRepository.cs
Annotate nullability and improve method documentationdotnet/src/webdriver/CommandInfoRepository.cs
TryGetValuefor dictionary access.W3CWireProtocolCommandInfoRepository.cs
Enable nullability and simplify property gettersdotnet/src/webdriver/Remote/W3CWireProtocolCommandInfoRepository.cs