Skip to content

Commit 99b62d4

Browse files
Update .editorconfig and run code analyze (#866)
1 parent e9e7a07 commit 99b62d4

File tree

174 files changed

+1726
-1028
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

174 files changed

+1726
-1028
lines changed

.editorconfig

+287-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,297 @@
66
# dotnet tool update -g dotnet-format
77
# remember to have: git config --global core.autocrlf false #(which is usually default)
88

9+
# top-most EditorConfig file
910
root = true
1011

11-
# Every file
12-
12+
# Don't use tabs for indentation.
1313
[*]
14+
indent_style = space
1415
insert_final_newline = true
1516
trim_trailing_whitespace = true
1617
charset = utf-8
1718
end_of_line = lf
19+
20+
# (Please don't specify an indent_size here; that has too many unintended consequences.)
21+
spelling_exclusion_path = SpellingExclusions.dic
22+
23+
# Code files
24+
[*.{cs,csx,vb,vbx}]
25+
indent_size = 4
26+
insert_final_newline = true
27+
trim_trailing_whitespace = true
28+
charset = utf-8
29+
30+
# XML project files
31+
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
32+
indent_size = 2
33+
34+
# XML config files
35+
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
36+
indent_size = 2
37+
38+
# JSON files
39+
[*.json]
40+
indent_size = 2
41+
42+
# Powershell files
43+
[*.ps1]
44+
indent_size = 2
45+
46+
# Shell script files
47+
[*.sh]
48+
end_of_line = lf
49+
indent_size = 2
50+
51+
# Dotnet code style settings:
52+
[*.{cs,vb}]
53+
# Member can be made 'readonly'
54+
csharp_style_prefer_readonly_struct_member = true
55+
dotnet_diagnostic.IDE0251.severity = warning
56+
dotnet_diagnostic.IDE0044.severity = warning
57+
58+
dotnet_diagnostic.CS1591.severity = silent
59+
60+
# Sort using and Import directives with System.* appearing first
61+
dotnet_sort_system_directives_first = false
62+
dotnet_separate_import_directive_groups = false
63+
# Avoid "this." and "Me." if not necessary
64+
dotnet_style_qualification_for_field = false:refactoring
65+
dotnet_style_qualification_for_property = false:refactoring
66+
dotnet_style_qualification_for_method = false:refactoring
67+
dotnet_style_qualification_for_event = false:refactoring
68+
69+
# Use language keywords instead of framework type names for type references
70+
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
71+
dotnet_style_predefined_type_for_member_access = true:suggestion
72+
73+
# Suggest more modern language features when available
74+
dotnet_style_object_initializer = true:suggestion
75+
dotnet_style_collection_initializer = true:suggestion
76+
dotnet_style_coalesce_expression = true:suggestion
77+
dotnet_style_null_propagation = true:suggestion
78+
dotnet_style_explicit_tuple_names = true:suggestion
79+
80+
# Whitespace options
81+
dotnet_style_allow_multiple_blank_lines_experimental = false
82+
83+
# Non-private static fields are PascalCase
84+
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = suggestion
85+
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields
86+
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style
87+
88+
dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field
89+
dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected
90+
dotnet_naming_symbols.non_private_static_fields.required_modifiers = static
91+
92+
dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case
93+
94+
# Non-private readonly fields are PascalCase
95+
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.severity = suggestion
96+
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.symbols = non_private_readonly_fields
97+
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.style = non_private_readonly_field_style
98+
99+
dotnet_naming_symbols.non_private_readonly_fields.applicable_kinds = field
100+
dotnet_naming_symbols.non_private_readonly_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected
101+
dotnet_naming_symbols.non_private_readonly_fields.required_modifiers = readonly
102+
103+
dotnet_naming_style.non_private_readonly_field_style.capitalization = pascal_case
104+
105+
# Constants are PascalCase
106+
dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion
107+
dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants
108+
dotnet_naming_rule.constants_should_be_pascal_case.style = constant_style
109+
110+
dotnet_naming_symbols.constants.applicable_kinds = field, local
111+
dotnet_naming_symbols.constants.required_modifiers = const
112+
113+
dotnet_naming_style.constant_style.capitalization = pascal_case
114+
115+
# Static fields are camelCase and start with s_
116+
dotnet_naming_rule.static_fields_should_be_camel_case.severity = suggestion
117+
dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields
118+
dotnet_naming_rule.static_fields_should_be_camel_case.style = static_field_style
119+
120+
dotnet_naming_symbols.static_fields.applicable_kinds = field
121+
dotnet_naming_symbols.static_fields.required_modifiers = static
122+
123+
dotnet_naming_style.static_field_style.capitalization = camel_case
124+
dotnet_naming_style.static_field_style.required_prefix = s_
125+
126+
# Instance fields are camelCase and start with _
127+
dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion
128+
dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields
129+
dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style
130+
131+
dotnet_naming_symbols.instance_fields.applicable_kinds = field
132+
133+
dotnet_naming_style.instance_field_style.capitalization = camel_case
134+
dotnet_naming_style.instance_field_style.required_prefix = _
135+
136+
# Locals and parameters are camelCase
137+
dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion
138+
dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters
139+
dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style
140+
141+
dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local
142+
143+
dotnet_naming_style.camel_case_style.capitalization = camel_case
144+
145+
# Local functions are PascalCase
146+
dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion
147+
dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions
148+
dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style
149+
150+
dotnet_naming_symbols.local_functions.applicable_kinds = local_function
151+
152+
dotnet_naming_style.local_function_style.capitalization = pascal_case
153+
154+
# By default, name items with PascalCase
155+
dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion
156+
dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members
157+
dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style
158+
159+
dotnet_naming_symbols.all_members.applicable_kinds = *
160+
161+
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
162+
163+
file_header_template = Copyright (C) 2015-2024 The Neo Project.\n\n{fileName} file belongs to the neo project and is free\nsoftware distributed under the MIT software license, see the\naccompanying file LICENSE in the main directory of the\nrepository or http://www.opensource.org/licenses/mit-license.php\nfor more details.\n\nRedistribution and use in source and binary forms with or without\nmodifications are permitted.
164+
165+
# Require file header
166+
dotnet_diagnostic.IDE0073.severity = error
167+
168+
# RS0016: Only enable if API files are present
169+
dotnet_public_api_analyzer.require_api_files = true
170+
171+
# IDE0055: Fix formatting
172+
# Workaround for https://github.com/dotnet/roslyn/issues/70570
173+
dotnet_diagnostic.IDE0055.severity = warning
174+
175+
# CSharp code style settings:
176+
[*.cs]
177+
# Newline settings
178+
csharp_new_line_before_open_brace = all
179+
csharp_new_line_before_else = true
180+
csharp_new_line_before_catch = true
181+
csharp_new_line_before_finally = true
182+
csharp_new_line_before_members_in_object_initializers = true
183+
csharp_new_line_before_members_in_anonymous_types = true
184+
csharp_new_line_between_query_expression_clauses = true
185+
186+
# Indentation preferences
187+
csharp_indent_block_contents = true
188+
csharp_indent_braces = false
189+
csharp_indent_case_contents = true
190+
csharp_indent_case_contents_when_block = true
191+
csharp_indent_switch_labels = true
192+
csharp_indent_labels = flush_left
193+
194+
# Whitespace options
195+
csharp_style_allow_embedded_statements_on_same_line_experimental = false
196+
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false
197+
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false
198+
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = false
199+
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = false
200+
201+
# Prefer "var" everywhere
202+
csharp_style_var_for_built_in_types = true:suggestion
203+
csharp_style_var_when_type_is_apparent = true:suggestion
204+
csharp_style_var_elsewhere = true:suggestion
205+
206+
# Prefer method-like constructs to have a block body
207+
csharp_style_expression_bodied_methods = false:none
208+
csharp_style_expression_bodied_constructors = false:none
209+
csharp_style_expression_bodied_operators = false:none
210+
211+
# Prefer property-like constructs to have an expression-body
212+
csharp_style_expression_bodied_properties = true:none
213+
csharp_style_expression_bodied_indexers = true:none
214+
csharp_style_expression_bodied_accessors = true:none
215+
216+
# Suggest more modern language features when available
217+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
218+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
219+
csharp_style_inlined_variable_declaration = true:suggestion
220+
csharp_style_throw_expression = true:suggestion
221+
csharp_style_conditional_delegate_call = true:suggestion
222+
csharp_style_prefer_extended_property_pattern = true:suggestion
223+
224+
# Space preferences
225+
csharp_space_after_cast = false
226+
csharp_space_after_colon_in_inheritance_clause = true
227+
csharp_space_after_comma = true
228+
csharp_space_after_dot = false
229+
csharp_space_after_keywords_in_control_flow_statements = true
230+
csharp_space_after_semicolon_in_for_statement = true
231+
csharp_space_around_binary_operators = before_and_after
232+
csharp_space_around_declaration_statements = do_not_ignore
233+
csharp_space_before_colon_in_inheritance_clause = true
234+
csharp_space_before_comma = false
235+
csharp_space_before_dot = false
236+
csharp_space_before_open_square_brackets = false
237+
csharp_space_before_semicolon_in_for_statement = false
238+
csharp_space_between_empty_square_brackets = false
239+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
240+
csharp_space_between_method_call_name_and_opening_parenthesis = false
241+
csharp_space_between_method_call_parameter_list_parentheses = false
242+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
243+
csharp_space_between_method_declaration_name_and_open_parenthesis = false
244+
csharp_space_between_method_declaration_parameter_list_parentheses = false
245+
csharp_space_between_parentheses = false
246+
csharp_space_between_square_brackets = false
247+
248+
# Blocks are allowed
249+
csharp_prefer_braces = true:silent
250+
csharp_preserve_single_line_blocks = true
251+
csharp_preserve_single_line_statements = true
252+
253+
# IDE0060: Remove unused parameter
254+
dotnet_diagnostic.IDE0060.severity = none
255+
256+
[src/{Analyzers,CodeStyle,Features,Workspaces,EditorFeatures,VisualStudio}/**/*.{cs,vb}]
257+
258+
# IDE0011: Add braces
259+
csharp_prefer_braces = when_multiline:warning
260+
# NOTE: We need the below severity entry for Add Braces due to https://github.com/dotnet/roslyn/issues/44201
261+
dotnet_diagnostic.IDE0011.severity = warning
262+
263+
# IDE0040: Add accessibility modifiers
264+
dotnet_diagnostic.IDE0040.severity = warning
265+
266+
# IDE0052: Remove unread private member
267+
dotnet_diagnostic.IDE0052.severity = warning
268+
269+
# IDE0059: Unnecessary assignment to a value
270+
dotnet_diagnostic.IDE0059.severity = warning
271+
272+
# CA1012: Abstract types should not have public constructors
273+
dotnet_diagnostic.CA1012.severity = warning
274+
275+
# CA1822: Make member static
276+
dotnet_diagnostic.CA1822.severity = warning
277+
278+
# Prefer "var" everywhere
279+
dotnet_diagnostic.IDE0007.severity = warning
280+
csharp_style_var_for_built_in_types = true:warning
281+
csharp_style_var_when_type_is_apparent = true:warning
282+
csharp_style_var_elsewhere = true:warning
283+
284+
# csharp_style_allow_embedded_statements_on_same_line_experimental
285+
dotnet_diagnostic.IDE2001.severity = warning
286+
287+
# csharp_style_allow_blank_lines_between_consecutive_braces_experimental
288+
dotnet_diagnostic.IDE2002.severity = warning
289+
290+
# csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental
291+
dotnet_diagnostic.IDE2004.severity = warning
292+
293+
# csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental
294+
dotnet_diagnostic.IDE2005.severity = warning
295+
296+
# csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental
297+
dotnet_diagnostic.IDE2006.severity = warning
298+
299+
[src/{VisualStudio}/**/*.{cs,vb}]
300+
# CA1822: Make member static
301+
# There is a risk of accidentally breaking an internal API that partners rely on though IVT.
302+
dotnet_code_quality.CA1822.api_surface = private

.gitattributes

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
###############################################################################
2+
# Set default behavior to automatically normalize line endings.
3+
###############################################################################
4+
* text eol=lf
5+
6+
###############################################################################
7+
# Set default behavior for command prompt diff.
8+
#
9+
# This is need for earlier builds of msysgit that does not have it on by
10+
# default for csharp files.
11+
# Note: This is only used by command line
12+
###############################################################################
13+
*.cs diff=csharp
14+
15+
###############################################################################
16+
# Set the merge driver for project and solution files
17+
#
18+
# Merging from the command prompt will add diff markers to the files if there
19+
# are conflicts (Merging from VS is not affected by the settings below, in VS
20+
# the diff markers are never inserted). Diff markers may cause the following
21+
# file extensions to fail to load in VS. An alternative would be to treat
22+
# these files as binary and thus will always conflict and require user
23+
# intervention with every merge. To do so, just uncomment the entries below
24+
###############################################################################
25+
*.sln text eol=crlf
26+
#*.csproj text eol=crlf
27+
#*.vbproj merge=binary
28+
#*.vcxproj merge=binary
29+
#*.vcproj merge=binary
30+
#*.dbproj merge=binary
31+
#*.fsproj merge=binary
32+
#*.lsproj merge=binary
33+
#*.wixproj merge=binary
34+
#*.modelproj merge=binary
35+
#*.sqlproj merge=binary
36+
#*.wwaproj merge=binary
37+
38+
###############################################################################
39+
# behavior for image files
40+
#
41+
# image files are treated as binary by default.
42+
###############################################################################
43+
*.jpg binary
44+
*.png binary
45+
*.gif binary
46+
*.ico binary
47+
48+
###############################################################################
49+
# diff behavior for common document formats
50+
#
51+
# Convert binary document formats to text before diffing them. This feature
52+
# is only available from the command line. Turn it on by uncommenting the
53+
# entries below.
54+
###############################################################################
55+
#*.doc diff=astextplain
56+
#*.DOC diff=astextplain
57+
#*.docx diff=astextplain
58+
#*.DOCX diff=astextplain
59+
#*.dot diff=astextplain
60+
#*.DOT diff=astextplain
61+
#*.pdf diff=astextplain
62+
#*.PDF diff=astextplain
63+
#*.rtf diff=astextplain
64+
#*.RTF diff=astextplain

0 commit comments

Comments
 (0)