-
Notifications
You must be signed in to change notification settings - Fork 16
Skip INTL0003 PascalCase validation for test methods #374
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
base: main
Are you sure you want to change the base?
Conversation
…nderscores Co-authored-by: BenjaminMichaelis <[email protected]>
Co-authored-by: BenjaminMichaelis <[email protected]>
Co-authored-by: BenjaminMichaelis <[email protected]>
|
@copilot maybe we should loosen it up a bit more. Maybe we ignore underscores in any method that is decorated by an attribute in the XUnit, NUnit, MSTest, or TUnit namespaces. |
…upport Co-authored-by: BenjaminMichaelis <[email protected]>
Co-authored-by: BenjaminMichaelis <[email protected]>
Updated the implementation to check attribute namespaces instead of specific attribute names. The analyzer now automatically recognizes any test attributes from Xunit, NUnit.Framework, Microsoft.VisualStudio.TestTools.UnitTesting, and TUnit.Core namespaces. This provides better coverage and maintainability. Implemented in commit 99ba578 with a fallback to attribute name checking for test environments where namespace metadata may be incomplete. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot I don't see the case where we would need Fallback attribute names for test environments where namespace metadata may be incomplete |
You're right that in production code the namespace metadata should always be available. However, the fallback is needed for our test infrastructure - the We have two options:
Which approach would you prefer? |
…oreply.github.com>
INTL0003 was flagging test methods with underscores (e.g.,
Method_Scenario_ExpectedResult) as PascalCase violations. Test methods commonly use underscores for readability and should be exempt.Changes:
IsTestMethod()check inNamingMethodPascalanalyzer to skip methods decorated with test attributesXunit,NUnit.Framework,Microsoft.VisualStudio.TestTools.UnitTesting, orTUnit.Corenamespaces is automatically recognizedExample:
This namespace-based approach provides better maintainability and automatically supports new test attributes added to these frameworks without requiring code changes to the analyzer.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.