Skip to content

Commit 5663618

Browse files
committed
format and add .editorconfig(dotnet/sdk)
1 parent b311bd7 commit 5663618

File tree

7 files changed

+393
-66
lines changed

7 files changed

+393
-66
lines changed

.editorconfig

Lines changed: 328 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,328 @@
1+
# editorconfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Default settings:
7+
# A newline ending every file
8+
# Use 4 spaces as indentation
9+
[*]
10+
insert_final_newline = true
11+
indent_style = space
12+
indent_size = 4
13+
trim_trailing_whitespace = true
14+
spelling_exclusion_path = ./exclusion.dic
15+
16+
[*.json]
17+
indent_size = 2
18+
19+
# Generated code
20+
[*{_AssemblyInfo.cs,.notsupported.cs,*/obj/*/External/**/*,*/obj/dotnet-new.IntegrationTests/*/TemplatePackagesPaths.cs}]
21+
generated_code = true
22+
23+
# C# files
24+
[*.cs]
25+
# New line preferences
26+
csharp_new_line_before_open_brace = all
27+
csharp_new_line_before_else = true
28+
csharp_new_line_before_catch = true
29+
csharp_new_line_before_finally = true
30+
csharp_new_line_before_members_in_object_initializers = true
31+
csharp_new_line_before_members_in_anonymous_types = true
32+
csharp_new_line_between_query_expression_clauses = true
33+
34+
# Indentation preferences
35+
csharp_indent_block_contents = true
36+
csharp_indent_braces = false
37+
csharp_indent_case_contents = true
38+
csharp_indent_case_contents_when_block = false
39+
csharp_indent_switch_labels = true
40+
csharp_indent_labels = one_less_than_current
41+
42+
# Modifier preferences
43+
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
44+
45+
# avoid this. unless absolutely necessary
46+
dotnet_style_qualification_for_field = false:suggestion
47+
dotnet_style_qualification_for_property = false:suggestion
48+
dotnet_style_qualification_for_method = false:suggestion
49+
dotnet_style_qualification_for_event = false:suggestion
50+
51+
# Types: use keywords instead of BCL types, and permit var only when the type is clear
52+
csharp_style_var_for_built_in_types = false:none
53+
csharp_style_var_when_type_is_apparent = false:none
54+
csharp_style_var_elsewhere = false:none
55+
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
56+
dotnet_style_predefined_type_for_member_access = true:suggestion
57+
58+
# name all constant fields using PascalCase
59+
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
60+
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
61+
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
62+
dotnet_naming_symbols.constant_fields.applicable_kinds = field
63+
dotnet_naming_symbols.constant_fields.required_modifiers = const
64+
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
65+
66+
# static fields should have s_ prefix
67+
dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion
68+
dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields
69+
dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style
70+
dotnet_naming_symbols.static_fields.applicable_kinds = field
71+
dotnet_naming_symbols.static_fields.required_modifiers = static
72+
dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected
73+
dotnet_naming_style.static_prefix_style.required_prefix = s_
74+
dotnet_naming_style.static_prefix_style.capitalization = camel_case
75+
76+
# internal and private fields should be _camelCase
77+
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
78+
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
79+
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
80+
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
81+
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
82+
dotnet_naming_style.camel_case_underscore_style.required_prefix = _
83+
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
84+
85+
# Code style defaults
86+
csharp_using_directive_placement = outside_namespace:suggestion
87+
dotnet_sort_system_directives_first = true
88+
csharp_prefer_braces = true:silent
89+
csharp_preserve_single_line_blocks = true:none
90+
csharp_preserve_single_line_statements = false:none
91+
csharp_prefer_static_local_function = true:suggestion
92+
csharp_prefer_simple_using_statement = false:none
93+
csharp_style_prefer_switch_expression = true:suggestion
94+
95+
# Code quality
96+
dotnet_style_readonly_field = true:suggestion
97+
dotnet_code_quality_unused_parameters = non_public:suggestion
98+
99+
# Expression-level preferences
100+
dotnet_style_object_initializer = true:suggestion
101+
dotnet_style_collection_initializer = true:suggestion
102+
dotnet_style_explicit_tuple_names = true:suggestion
103+
dotnet_style_coalesce_expression = true:suggestion
104+
dotnet_style_null_propagation = true:suggestion
105+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
106+
dotnet_style_prefer_inferred_tuple_names = true:suggestion
107+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
108+
dotnet_style_prefer_auto_properties = true:suggestion
109+
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
110+
dotnet_style_prefer_conditional_expression_over_return = true:silent
111+
csharp_prefer_simple_default_expression = true:suggestion
112+
113+
# Expression-bodied members
114+
csharp_style_expression_bodied_methods = true:silent
115+
csharp_style_expression_bodied_constructors = true:silent
116+
csharp_style_expression_bodied_operators = true:silent
117+
csharp_style_expression_bodied_properties = true:silent
118+
csharp_style_expression_bodied_indexers = true:silent
119+
csharp_style_expression_bodied_accessors = true:silent
120+
csharp_style_expression_bodied_lambdas = true:silent
121+
csharp_style_expression_bodied_local_functions = true:silent
122+
123+
# Pattern matching
124+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
125+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
126+
csharp_style_inlined_variable_declaration = true:suggestion
127+
128+
# Null checking preferences
129+
csharp_style_throw_expression = true:suggestion
130+
csharp_style_conditional_delegate_call = true:suggestion
131+
132+
# Other features
133+
csharp_style_prefer_index_operator = false:none
134+
csharp_style_prefer_range_operator = false:none
135+
csharp_style_pattern_local_over_anonymous_function = false:none
136+
137+
# Space preferences
138+
csharp_space_after_cast = false
139+
csharp_space_after_colon_in_inheritance_clause = true
140+
csharp_space_after_comma = true
141+
csharp_space_after_dot = false
142+
csharp_space_after_keywords_in_control_flow_statements = true
143+
csharp_space_after_semicolon_in_for_statement = true
144+
csharp_space_around_binary_operators = before_and_after
145+
csharp_space_around_declaration_statements = do_not_ignore
146+
csharp_space_before_colon_in_inheritance_clause = true
147+
csharp_space_before_comma = false
148+
csharp_space_before_dot = false
149+
csharp_space_before_open_square_brackets = false
150+
csharp_space_before_semicolon_in_for_statement = false
151+
csharp_space_between_empty_square_brackets = false
152+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
153+
csharp_space_between_method_call_name_and_opening_parenthesis = false
154+
csharp_space_between_method_call_parameter_list_parentheses = false
155+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
156+
csharp_space_between_method_declaration_name_and_open_parenthesis = false
157+
csharp_space_between_method_declaration_parameter_list_parentheses = false
158+
csharp_space_between_parentheses = false
159+
csharp_space_between_square_brackets = false
160+
161+
# Default analyzed API surface = 'all' (public APIs + non-public APIs)
162+
dotnet_code_quality.api_surface = all
163+
164+
# License header
165+
file_header_template = /*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * "License"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */
166+
167+
# Code files
168+
[*.{cs,vb}]
169+
# Analyzers
170+
dotnet_code_quality.ca1802.api_surface = private, internal
171+
dotnet_code_quality.ca1822.api_surface = private, internal
172+
dotnet_code_quality.ca2208.api_surface = public
173+
# Mark attributes with AttributeUsageAttribute
174+
dotnet_diagnostic.CA1018.severity = warning
175+
# Properties should not be write only
176+
dotnet_diagnostic.CA1044.severity = warning
177+
# Do not declare protected member in sealed type
178+
dotnet_diagnostic.CA1047.severity = warning
179+
# Avoid using cref tags with a prefix
180+
dotnet_diagnostic.CA1200.severity = suggestion
181+
# P/Invokes should not be visible
182+
dotnet_diagnostic.CA1401.severity = warning
183+
# Parameter names should match base declaration
184+
dotnet_diagnostic.CA1725.severity = suggestion
185+
# Remove empty Finalizers
186+
dotnet_diagnostic.CA1821.severity = warning
187+
# Mark assemblies with NeutralResourcesLanguageAttribute
188+
dotnet_diagnostic.CA1824.severity = warning
189+
# Do not use CountAsync() or LongCountAsync() when AnyAsync() can be used
190+
dotnet_diagnostic.CA1828.severity = warning
191+
# Prefer strongly-typed Append and Insert method overloads on StringBuilder.
192+
dotnet_diagnostic.CA1830.severity = warning
193+
# Use AsSpan or AsMemory instead of Range-based indexers when appropriate
194+
dotnet_diagnostic.CA1832.severity = warning
195+
# Use AsSpan or AsMemory instead of Range-based indexers when appropriate
196+
dotnet_diagnostic.CA1833.severity = warning
197+
# Prefer IsEmpty over Count
198+
dotnet_diagnostic.CA1836.severity = warning
199+
# Use 'Environment.ProcessPath'
200+
dotnet_diagnostic.CA1839.severity = warning
201+
# Do not call ToImmutableCollection on an ImmutableCollection value
202+
# Temporarily disable to avoid regression in preview 1, revert back to warning when start using preview 2
203+
dotnet_diagnostic.CA2009.severity = none
204+
# Avoid infinite recursion
205+
dotnet_diagnostic.CA2011.severity = warning
206+
# Initialize value type static fields inline
207+
dotnet_diagnostic.CA2207.severity = warning
208+
# Implement serialization constructors
209+
dotnet_diagnostic.CA2229.severity = warning
210+
# Provide correct arguments to formatting methods
211+
dotnet_diagnostic.CA2241.severity = warning
212+
# Test for NaN correctly
213+
dotnet_diagnostic.CA2242.severity = warning
214+
# Do not assign a property to itself.
215+
dotnet_diagnostic.CA2245.severity = warning
216+
# Provide correct 'enum' argument to 'Enum.HasFlag'
217+
dotnet_diagnostic.CA2248.severity = warning
218+
# Do Not Add Schema By URL
219+
dotnet_diagnostic.CA3061.severity = warning
220+
# Insecure DTD processing in XML
221+
dotnet_diagnostic.CA3075.severity = warning
222+
# Insecure XSLT script processing.
223+
dotnet_diagnostic.CA3076.severity = warning
224+
# Insecure Processing in API Design, XmlDocument and XmlTextReader
225+
dotnet_diagnostic.CA3077.severity = warning
226+
# Mark Verb Handlers With Validate Antiforgery Token
227+
dotnet_diagnostic.CA3147.severity = warning
228+
# Do Not Use Broken Cryptographic Algorithms
229+
dotnet_diagnostic.CA5351.severity = warning
230+
# Do Not Disable Certificate Validation
231+
dotnet_diagnostic.CA5359.severity = warning
232+
# Do Not Call Dangerous Methods In Deserialization
233+
dotnet_diagnostic.CA5360.severity = warning
234+
# Do Not Disable SChannel Use of Strong Crypto
235+
dotnet_diagnostic.CA5361.severity = warning
236+
# Do Not Disable Request Validation
237+
dotnet_diagnostic.CA5363.severity = warning
238+
# Do Not Use Deprecated Security Protocols
239+
dotnet_diagnostic.CA5364.severity = warning
240+
# Do Not Disable HTTP Header Checking
241+
dotnet_diagnostic.CA5365.severity = warning
242+
# Set ViewStateUserKey For Classes Derived From Page
243+
dotnet_diagnostic.CA5368.severity = warning
244+
# Use XmlReader For Validating Reader
245+
dotnet_diagnostic.CA5370.severity = warning
246+
# Do not use obsolete key derivation function
247+
dotnet_diagnostic.CA5373.severity = warning
248+
# Do Not Use XslTransform
249+
dotnet_diagnostic.CA5374.severity = warning
250+
# Use SharedAccessProtocol HttpsOnly
251+
dotnet_diagnostic.CA5376.severity = warning
252+
# Use Container Level Access Policy
253+
dotnet_diagnostic.CA5377.severity = warning
254+
# Do not disable ServicePointManagerSecurityProtocols
255+
dotnet_diagnostic.CA5378.severity = warning
256+
# Do Not Use Weak Key Derivation Function Algorithm
257+
dotnet_diagnostic.CA5379.severity = warning
258+
# Do Not Add Certificates To Root Store
259+
dotnet_diagnostic.CA5380.severity = warning
260+
# Ensure Certificates Are Not Added To Root Store
261+
dotnet_diagnostic.CA5381.severity = warning
262+
# Do Not Use Digital Signature Algorithm (DSA)
263+
dotnet_diagnostic.CA5384.severity = warning
264+
# Use Rivest–Shamir–Adleman (RSA) Algorithm With Sufficient Key Size
265+
dotnet_diagnostic.CA5385.severity = warning
266+
dotnet_diagnostic.CS1591.severity = suggestion
267+
# UseIsNullCheck
268+
dotnet_diagnostic.IDE0041.severity = warning
269+
# ValidateFormatString
270+
dotnet_diagnostic.IDE0043.severity = warning
271+
# MakeLocalFunctionStatic
272+
dotnet_diagnostic.IDE0062.severity = warning
273+
# ConvertTypeOfToNameOf
274+
dotnet_diagnostic.IDE0082.severity = warning
275+
# Remove unnecessary lambda expression
276+
dotnet_diagnostic.IDE0200.severity = none
277+
# Remove redundant nullable directive
278+
dotnet_diagnostic.IDE0240.severity = warning
279+
280+
# C++ Files
281+
[*.{cpp,h,in}]
282+
curly_bracket_next_line = true
283+
indent_brace_style = Allman
284+
285+
# Xml project files
286+
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
287+
indent_size = 2
288+
289+
[*.{csproj,vbproj,proj,nativeproj,locproj}]
290+
charset = utf-8-bom
291+
292+
# Xml build files
293+
[*.builds]
294+
indent_size = 2
295+
296+
# Xml files
297+
[*.{xml,stylecop,resx,ruleset}]
298+
indent_size = 2
299+
300+
# Xml config files
301+
[*.{props,targets,config,nuspec}]
302+
indent_size = 2
303+
304+
# YAML config files
305+
[*.{yml,yaml}]
306+
indent_size = 2
307+
308+
# Shell scripts
309+
[*.sh]
310+
end_of_line = lf
311+
[*.{cmd, bat}]
312+
end_of_line = crlf
313+
314+
# IDE0040: Add accessibility modifiers
315+
dotnet_diagnostic.IDE0040.severity = warning
316+
317+
[*.txt]
318+
insert_final_newline = false
319+
320+
# Verify settings
321+
[*.{received,verified}.{txt,xml,json}]
322+
charset = "utf-8-bom"
323+
end_of_line = lf
324+
indent_size = unset
325+
indent_style = unset
326+
insert_final_newline = false
327+
tab_width = unset
328+
trim_trailing_whitespace = false

samples/Apache.IoTDB.Samples/Program.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
* under the License.
1818
*/
1919

20+
using System;
21+
using System.Collections.Generic;
22+
using System.CommandLine;
23+
using System.Threading.Tasks;
2024
using Microsoft.Extensions.Logging;
2125
using NLog.Extensions.Logging;
22-
using System.Threading.Tasks;
23-
using System.CommandLine;
24-
using System.Collections.Generic;
25-
using System;
2626

2727
namespace Apache.IoTDB.Samples
2828
{

samples/Apache.IoTDB.Samples/SessionPoolTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919

2020
using System;
2121
using System.Collections.Generic;
22+
using System.Diagnostics;
23+
using System.Net.Sockets;
2224
using System.Threading;
2325
using System.Threading.Tasks;
2426
using Apache.IoTDB.Data;
2527
using Apache.IoTDB.DataStructure;
2628
using ConsoleTableExt;
27-
using System.Net.Sockets;
28-
using System.Diagnostics;
2929

3030
namespace Apache.IoTDB.Samples
3131
{

src/Apache.IoTDB.Data/IoTDBCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
* under the License.
1818
*/
1919

20-
using Apache.IoTDB.DataStructure;
2120
using System;
2221
using System.Collections.Generic;
2322
using System.ComponentModel;
@@ -30,6 +29,7 @@
3029
using System.Runtime.InteropServices;
3130
using System.Threading;
3231
using System.Threading.Tasks;
32+
using Apache.IoTDB.DataStructure;
3333

3434

3535
namespace Apache.IoTDB.Data

src/Apache.IoTDB.Data/IoTDBConnection.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,13 @@
2323
using System.Data.Common;
2424
using System.Diagnostics;
2525
using System.IO;
26+
using System.Linq;
2627
using System.Reflection;
2728
using System.Runtime.CompilerServices;
2829
using System.Runtime.InteropServices;
2930
using System.Text;
30-
31-
using System.Linq;
32-
using System.Threading.Tasks;
3331
using System.Threading;
32+
using System.Threading.Tasks;
3433

3534
namespace Apache.IoTDB.Data
3635
{

0 commit comments

Comments
 (0)