Skip to content

Commit 6779d71

Browse files
committed
Build without warnings
1 parent c7877ac commit 6779d71

File tree

11 files changed

+291
-147
lines changed

11 files changed

+291
-147
lines changed

.editorconfig

Lines changed: 128 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,131 @@
11
[*.cs]
22

33
# IDE0065: Misplaced using directive
4-
csharp_using_directive_placement = outside_namespace
4+
csharp_using_directive_placement = outside_namespace:silent
5+
6+
[*.cs]
7+
#### Naming styles ####
8+
9+
# Naming rules
10+
11+
dotnet_naming_rule.interface_should_be_begins_with_i.severity = error
12+
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
13+
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
14+
15+
dotnet_naming_rule.types_should_be_pascal_case.severity = error
16+
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
17+
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
18+
19+
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = error
20+
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
21+
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
22+
23+
# Symbol specifications
24+
25+
dotnet_naming_symbols.interface.applicable_kinds = interface
26+
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
27+
dotnet_naming_symbols.interface.required_modifiers =
28+
29+
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
30+
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
31+
dotnet_naming_symbols.types.required_modifiers =
32+
33+
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
34+
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
35+
dotnet_naming_symbols.non_field_members.required_modifiers =
36+
37+
# Naming styles
38+
39+
dotnet_naming_style.begins_with_i.required_prefix = I
40+
dotnet_naming_style.begins_with_i.required_suffix =
41+
dotnet_naming_style.begins_with_i.word_separator =
42+
dotnet_naming_style.begins_with_i.capitalization = pascal_case
43+
44+
dotnet_naming_style.pascal_case.required_prefix =
45+
dotnet_naming_style.pascal_case.required_suffix =
46+
dotnet_naming_style.pascal_case.word_separator =
47+
dotnet_naming_style.pascal_case.capitalization = pascal_case
48+
49+
dotnet_naming_style.pascal_case.required_prefix =
50+
dotnet_naming_style.pascal_case.required_suffix =
51+
dotnet_naming_style.pascal_case.word_separator =
52+
dotnet_naming_style.pascal_case.capitalization = pascal_case
53+
csharp_indent_labels = one_less_than_current
54+
csharp_prefer_simple_using_statement = true:suggestion
55+
csharp_prefer_braces = true:silent
56+
csharp_style_namespace_declarations = file_scoped:suggestion
57+
csharp_style_prefer_method_group_conversion = true:silent
58+
csharp_style_prefer_top_level_statements = true:silent
59+
csharp_style_prefer_primary_constructors = true:suggestion
60+
csharp_prefer_system_threading_lock = true:suggestion
61+
csharp_style_expression_bodied_methods = false:silent
62+
csharp_style_expression_bodied_constructors = false:silent
63+
csharp_style_expression_bodied_operators = false:silent
64+
csharp_style_expression_bodied_properties = true:silent
65+
csharp_style_expression_bodied_indexers = true:silent
66+
csharp_style_expression_bodied_accessors = true:silent
67+
csharp_style_expression_bodied_lambdas = true:silent
68+
csharp_style_expression_bodied_local_functions = false:silent
69+
70+
[*.vb]
71+
#### Naming styles ####
72+
73+
# Naming rules
74+
75+
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
76+
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
77+
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
78+
79+
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
80+
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
81+
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
82+
83+
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
84+
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
85+
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
86+
87+
# Symbol specifications
88+
89+
dotnet_naming_symbols.interface.applicable_kinds = interface
90+
dotnet_naming_symbols.interface.applicable_accessibilities = public, friend, private, protected, protected_friend, private_protected
91+
dotnet_naming_symbols.interface.required_modifiers =
92+
93+
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
94+
dotnet_naming_symbols.types.applicable_accessibilities = public, friend, private, protected, protected_friend, private_protected
95+
dotnet_naming_symbols.types.required_modifiers =
96+
97+
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
98+
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, friend, private, protected, protected_friend, private_protected
99+
dotnet_naming_symbols.non_field_members.required_modifiers =
100+
101+
# Naming styles
102+
103+
dotnet_naming_style.begins_with_i.required_prefix = I
104+
dotnet_naming_style.begins_with_i.required_suffix =
105+
dotnet_naming_style.begins_with_i.word_separator =
106+
dotnet_naming_style.begins_with_i.capitalization = pascal_case
107+
108+
dotnet_naming_style.pascal_case.required_prefix =
109+
dotnet_naming_style.pascal_case.required_suffix =
110+
dotnet_naming_style.pascal_case.word_separator =
111+
dotnet_naming_style.pascal_case.capitalization = pascal_case
112+
113+
dotnet_naming_style.pascal_case.required_prefix =
114+
dotnet_naming_style.pascal_case.required_suffix =
115+
dotnet_naming_style.pascal_case.word_separator =
116+
dotnet_naming_style.pascal_case.capitalization = pascal_case
117+
118+
[*.{cs,vb}]
119+
dotnet_style_operator_placement_when_wrapping = beginning_of_line
120+
tab_width = 4
121+
indent_size = 4
122+
end_of_line = crlf
123+
dotnet_style_coalesce_expression = true:suggestion
124+
dotnet_style_null_propagation = true:suggestion
125+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
126+
dotnet_style_prefer_auto_properties = true:silent
127+
dotnet_style_object_initializer = true:suggestion
128+
dotnet_style_collection_initializer = true:suggestion
129+
130+
# IDE0130: Namespace does not match folder structure
131+
dotnet_style_namespace_match_folder = false
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
namespace Sample;
2+
3+
/// <summary>
4+
/// PII entities Presidio Text Analyzer is capable of detecting. Only some of them are defined here for demonstration purposes.
5+
/// Full list can be found here: https://microsoft.github.io/presidio/api-docs/api-docs.html#tag/Analyzer/paths/~1supportedentities/get.
6+
/// </summary>
7+
internal readonly struct AnalyzerEntityType(string name)
8+
{
9+
public string Name { get; } = name;
10+
11+
public static AnalyzerEntityType Person = new("PERSON");
12+
public static AnalyzerEntityType PhoneNumber = new("PHONE_NUMBER");
13+
public static AnalyzerEntityType EmailAddress = new("EMAIL_ADDRESS");
14+
public static AnalyzerEntityType CreditCard = new("CREDIT_CARD");
15+
16+
public static implicit operator string(AnalyzerEntityType type) => type.Name;
17+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
namespace Sample;
2+
3+
/// <summary>
4+
/// Anonymizer action type that can be performed to update the prompt.
5+
/// More information here: https://microsoft.github.io/presidio/api-docs/api-docs.html#tag/Anonymizer/paths/~1anonymizers/get
6+
/// </summary>
7+
internal readonly struct AnonymizerType(string name)
8+
{
9+
public string Name { get; } = name;
10+
11+
public static AnonymizerType Hash = new("hash");
12+
public static AnonymizerType Mask = new("mask");
13+
public static AnonymizerType Redact = new("redact");
14+
public static AnonymizerType Replace = new("replace");
15+
public static AnonymizerType Encrypt = new("encrypt");
16+
17+
public static implicit operator string(AnonymizerType type) => type.Name;
18+
}

Applying-Responsible-Secure-AI/Samples/PromptFilteringPresidio/Core/Models/Models.cs

Lines changed: 0 additions & 145 deletions
This file was deleted.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace Sample;
4+
5+
/// <summary>
6+
/// Request model for Text Analyzer. Only required properties are defined here for demonstration purposes.
7+
/// Full schema can be found here: https://microsoft.github.io/presidio/api-docs/api-docs.html#tag/Analyzer/paths/~1analyze/post.
8+
/// </summary>
9+
internal sealed class PresidioTextAnalyzerRequest
10+
{
11+
/// <summary>The text to analyze.</summary>
12+
[JsonPropertyName("text")]
13+
public string? Text { get; set; }
14+
15+
/// <summary>Two characters for the desired language in ISO_639-1 format.</summary>
16+
[JsonPropertyName("language")]
17+
public string? Language { get; set; } = "en";
18+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace Sample;
4+
5+
/// <summary>
6+
/// Response model from Text Analyzer. Only required properties are defined here for demonstration purposes.
7+
/// Full schema can be found here: https://microsoft.github.io/presidio/api-docs/api-docs.html#tag/Analyzer/paths/~1analyze/post.
8+
/// </summary>
9+
internal sealed class PresidioTextAnalyzerResponse
10+
{
11+
/// <summary>Where the PII starts.</summary>
12+
[JsonPropertyName("start")]
13+
public int? Start { get; set; }
14+
15+
/// <summary>Where the PII ends.</summary>
16+
[JsonPropertyName("end")]
17+
public int? End { get; set; }
18+
19+
/// <summary>The PII detection confidence score from 0 to 1.</summary>
20+
[JsonPropertyName("score")]
21+
public double? Score { get; set; }
22+
23+
/// <summary>The supported PII entity types.</summary>
24+
[JsonPropertyName("entity_type")]
25+
public string? EntityType { get; set; }
26+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace Sample;
4+
5+
/// <summary>
6+
/// Anonymizer model that describes how to update the prompt.
7+
/// </summary>
8+
internal sealed class PresidioTextAnonymizer
9+
{
10+
/// <summary>Anonymizer action type that can be performed to update the prompt.</summary>
11+
[JsonPropertyName("type")]
12+
public string? Type { get; set; }
13+
14+
/// <summary>New value for "replace" anonymizer type.</summary>
15+
[JsonPropertyName("new_value")]
16+
public string? NewValue { get; set; }
17+
}

0 commit comments

Comments
 (0)