Skip to content

Code fixes - #2460

Merged
Vincent Biret (baywet) merged 2 commits into
microsoft:mainfrom
martincostello:code-fixes
Aug 15, 2025
Merged

Code fixes#2460
Vincent Biret (baywet) merged 2 commits into
microsoft:mainfrom
martincostello:code-fixes

Conversation

@martincostello

Copy link
Copy Markdown
Contributor

Fixes some issues I found while working on #2459.

  • Add missing entry to .resx file.
  • Regenerate resource designer code in Visual Studio to remove redundant properties.
  • Fix the namespace the resource designer generates with.
  • Use TryGetValue() and Count/Length to improve performance.
  • Fix typo in test name.
  • Sort usings.

- Add missing entry.
- Regenerate designer code to remove redundant properties.
- Fix the namespace the resource designer generates with.
- Use `TryGetValue()` and `Count`/`Length` to improve performance.
- Fix typo in test name.
- Sort usings.
CopilotAI review requested due to automatic review settings August 8, 2025 13:32

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses various code quality improvements and fixes discovered while working on issue #2459, focusing on performance optimizations, typo corrections, and resource file maintenance.

  • Fixes typo in test method name from "RemoveValidatioRule" to "RemoveValidationRule"
  • Improves performance by replacing LINQ .Any() calls with more efficient .Count > 0 and .Length != 0 checks
  • Optimizes dictionary operations using TryGetValue() to avoid multiple key lookups

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

FileDescription
test/Microsoft.OpenApi.Tests/Validations/ValidationRuleSetTests.csFixes typo in test name and replaces .Any() with .Count > 0 and .Length != 0 for performance
src/Microsoft.OpenApi/Validations/ValidationRuleSet.csSorts using statements and optimizes dictionary operations with TryGetValue() and .Count > 0
src/Microsoft.OpenApi/Properties/SRResource.resxAdds missing "ArgumentNull" resource entry
src/Microsoft.OpenApi/Microsoft.OpenApi.csprojAdds CustomToolNamespace for resource file generation
Files not reviewed (1)
  • src/Microsoft.OpenApi/Properties/SRResource.Designer.cs: Language not supported

@baywetVincent Biret (baywet) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

@baywet
Vincent Biret (baywet) merged commit c0b7adc into microsoft:mainAug 15, 2025
9 checks passed
Sign up for freeto 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

@martincostello@baywet