Conversation
Co-authored-by: meziantou <509220+meziantou@users.noreply.github.com>
Co-authored-by: meziantou <509220+meziantou@users.noreply.github.com>
|
@copilot Can you add an option to enable reporting object containing properties decorated with DataClassificationAttribute. Follow the format used in other rule: |
…tion detection Co-authored-by: meziantou <509220+meziantou@users.noreply.github.com>
Done in commit 32c4185. Added configuration option |
|
@copilot Can you change the default value to false? |
…tes to false Co-authored-by: meziantou <509220+meziantou@users.noreply.github.com>
| var operation = (IInvocationOperation)context.Operation; | ||
| if (operation.TargetMethod.ContainingType.IsEqualTo(LoggerExtensionsSymbol) && FindLogParameters(operation.TargetMethod, out var argumentsParameter)) | ||
| { | ||
| var options = context.Options.AnalyzerConfigOptionsProvider.GetOptions(operation.Syntax.SyntaxTree); |
There was a problem hiding this comment.
@copilot You can simplify it by using the extension method GetConfigurationValue, which also supports a boolean default value.
There was a problem hiding this comment.
Done in commit cb5885f. Simplified by using the GetConfigurationValue extension method.
…reading Co-authored-by: meziantou <509220+meziantou@users.noreply.github.com>
|
@copilot Can you replace GetMembers with GetAllMembers (extension method in the project) |
…tribute Co-authored-by: meziantou <509220+meziantou@users.noreply.github.com>
Add opt-in configuration for MA0153 to detect logging of types with DataClassification members
Summary of Changes
Analyzer Enhancement:
TypeContainsMembersWithDataClassificationhelper method to check if a type contains properties or fields withDataClassificationAttributeValidateDataClassificationto check parameter types and general operation types for classified membersMA0153.report_types_with_data_classification_attributesto enable/disable type-level detection (default: false)GetConfigurationValueextension methodGetAllMembersto check inherited members for DataClassificationAttributeTest Coverage:
Documentation:
Configuration Option
The new analyzer behavior can be configured via
.editorconfig:When set to
false(default), the analyzer will only detect direct member access (original behavior). When set totrue, it will also detect logging of objects containing classified members, including inherited members.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.