Skip to content

Commit 4615d7f

Browse files
chore: init
1 parent 4361613 commit 4615d7f

103 files changed

Lines changed: 8721 additions & 24 deletions

File tree

Some content is hidden

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

.config/dotnet-tools.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"csharpier": {
6+
"version": "0.29.2",
7+
"commands": [
8+
"dotnet-csharpier"
9+
]
10+
}
11+
}
12+
}

.csharpierrc.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
printWidth: 150
2+
useTabs: false
3+
tabWidth: 4
4+
preprocessorSymbolSets:
5+
- ""
6+
- "DEBUG"
7+
- "DEBUG,CODE_STYLE"

.editorconfig

Lines changed: 269 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,269 @@
1+
# Remove the line below if you want to inherit .editorconfig settings from higher directories
2+
root = true
3+
4+
# C# files
5+
[*.cs]
6+
7+
# Here we set all microsoft's IDExxxx rule violations as compile errors
8+
# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/
9+
dotnet_analyzer_diagnostic.category-Style.severity = error
10+
11+
# Here we ignore some rule violdations that they are not really important for us
12+
dotnet_diagnostic.IDE0008.severity = silent # Explicit type, not var
13+
dotnet_diagnostic.IDE0010.severity = silent # missing cases to "case" switch expression
14+
dotnet_diagnostic.IDE0039.severity = silent # lambda vs local function
15+
dotnet_diagnostic.IDE0045.severity = silent # Use ternary for assignment, not ifs
16+
dotnet_diagnostic.IDE0046.severity = silent # Use ternary for returns, not ifs
17+
dotnet_diagnostic.IDE0055.severity = silent # Generic formatting errors: should be handled by csharpier
18+
dotnet_diagnostic.IDE0058.severity = silent # Expression value is never used
19+
dotnet_diagnostic.IDE0072.severity = silent # missing cases to "=>" switch expression
20+
dotnet_diagnostic.IDE0090.severity = silent # Use implicit new
21+
dotnet_diagnostic.IDE0002.severity = silent # Simplify member access
22+
dotnet_diagnostic.IDE0290.severity = silent # Use primary constructor
23+
dotnet_diagnostic.IDE0028.severity = silent # Use collection initializers or expressions
24+
dotnet_diagnostic.IDE0057.severity = silent # Use range operator
25+
dotnet_diagnostic.IDE0270.severity = silent # Simplify null check
26+
dotnet_diagnostic.IDE0029.severity = silent # Simplify null check
27+
dotnet_diagnostic.IDE0030.severity = silent # Simplify null check
28+
dotnet_diagnostic.IDE0305.severity = silent # Use collection expression for fluent
29+
dotnet_diagnostic.CA2254.severity = silent # Template should be a static expression
30+
dotnet_diagnostic.CS1591.severity = silent # Compiler Warning. Missing XML comment
31+
32+
# https://github.com/dotnet/aspnetcore/issues/47912
33+
dotnet_diagnostic.IDE0005.severity = none # Remove unnecessary using directives (using CS8019 instead)
34+
dotnet_diagnostic.CS8019.severity = error # Remove unnecessary using directives
35+
36+
37+
# Here we set some rules for unused codes (classes, methods, parameters, etc.)
38+
dotnet_diagnostic.CA1801.severity = error # Review unused parameters
39+
dotnet_diagnostic.CA1804.severity = error # Remove unused locals
40+
dotnet_diagnostic.CA1811.severity = error # Avoid uncalled private code
41+
dotnet_diagnostic.CA1823.severity = error # Avoid unused private fields
42+
43+
44+
#### Core EditorConfig Options ####
45+
46+
# Indentation and spacing
47+
indent_size = 4
48+
indent_style = space
49+
tab_width = 4
50+
51+
#### .NET Coding Conventions ####
52+
53+
# Organize usings
54+
dotnet_separate_import_directive_groups = false
55+
dotnet_sort_system_directives_first = true
56+
file_header_template = unset
57+
58+
# this. and Me. preferences
59+
dotnet_style_qualification_for_event = false
60+
dotnet_style_qualification_for_field = false:error
61+
dotnet_style_qualification_for_method = false:error
62+
dotnet_style_qualification_for_property = false:error
63+
64+
# Language keywords vs BCL types preferences
65+
dotnet_style_predefined_type_for_locals_parameters_members = true
66+
dotnet_style_predefined_type_for_member_access = true
67+
68+
# Parentheses preferences
69+
dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary
70+
dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary
71+
dotnet_style_parentheses_in_other_operators = never_if_unnecessary
72+
dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary
73+
74+
# Modifier preferences
75+
dotnet_style_require_accessibility_modifiers = for_non_interface_members
76+
77+
# Expression-level preferences
78+
dotnet_style_coalesce_expression = true
79+
dotnet_style_collection_initializer = true
80+
dotnet_style_explicit_tuple_names = true
81+
dotnet_style_namespace_match_folder = true
82+
dotnet_style_null_propagation = true
83+
dotnet_style_object_initializer = true
84+
dotnet_style_operator_placement_when_wrapping = beginning_of_line
85+
dotnet_style_prefer_auto_properties = true
86+
dotnet_style_prefer_compound_assignment = true
87+
dotnet_style_prefer_conditional_expression_over_assignment = true
88+
dotnet_style_prefer_conditional_expression_over_return = true
89+
dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed
90+
dotnet_style_prefer_inferred_anonymous_type_member_names = true
91+
dotnet_style_prefer_inferred_tuple_names = true
92+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true
93+
dotnet_style_prefer_simplified_boolean_expressions = true
94+
dotnet_style_prefer_simplified_interpolation = true
95+
96+
# Field preferences
97+
dotnet_style_readonly_field = true
98+
99+
# Parameter preferences
100+
dotnet_code_quality_unused_parameters = all
101+
102+
# Suppression preferences
103+
dotnet_remove_unnecessary_suppression_exclusions = none
104+
105+
# New line preferences
106+
dotnet_style_allow_multiple_blank_lines_experimental = true
107+
dotnet_style_allow_statement_immediately_after_block_experimental = true
108+
109+
#### C# Coding Conventions ####
110+
111+
# var preferences
112+
csharp_style_var_elsewhere = false:silent
113+
csharp_style_var_for_built_in_types = false:silent
114+
csharp_style_var_when_type_is_apparent = false:silent
115+
116+
# Expression-bodied members
117+
csharp_style_expression_bodied_accessors = true:silent
118+
csharp_style_expression_bodied_constructors = false:silent
119+
csharp_style_expression_bodied_indexers = true:silent
120+
csharp_style_expression_bodied_lambdas = true:silent
121+
csharp_style_expression_bodied_local_functions = false:silent
122+
csharp_style_expression_bodied_methods = when_on_single_line:none
123+
csharp_style_expression_bodied_operators = false:silent
124+
csharp_style_expression_bodied_properties = true:silent
125+
126+
# Pattern matching preferences
127+
csharp_style_pattern_matching_over_as_with_null_check = false
128+
csharp_style_pattern_matching_over_is_with_cast_check = false
129+
csharp_style_prefer_extended_property_pattern = false
130+
csharp_style_prefer_not_pattern = false
131+
csharp_style_prefer_pattern_matching = false
132+
csharp_style_prefer_switch_expression = false
133+
134+
# Null-checking preferences
135+
csharp_style_conditional_delegate_call = true
136+
137+
# Modifier preferences
138+
csharp_prefer_static_local_function = true
139+
csharp_preferred_modifier_order = public, private, protected, internal, file, static, extern, new, virtual, abstract, sealed, override, readonly, unsafe, required, volatile, async
140+
csharp_style_prefer_readonly_struct = true
141+
142+
# Code-block preferences
143+
csharp_prefer_braces = when_multiline:error
144+
csharp_prefer_simple_using_statement = false:silent
145+
csharp_style_namespace_declarations = file_scoped:error
146+
csharp_style_prefer_method_group_conversion = true:silent
147+
csharp_style_prefer_top_level_statements = false:silent
148+
149+
# Expression-level preferences
150+
csharp_prefer_simple_default_expression = true
151+
csharp_style_deconstructed_variable_declaration = true
152+
csharp_style_implicit_object_creation_when_type_is_apparent = false
153+
csharp_style_inlined_variable_declaration = true
154+
csharp_style_prefer_index_operator = true
155+
csharp_style_prefer_local_over_anonymous_function = true
156+
csharp_style_prefer_null_check_over_type_check = true
157+
csharp_style_prefer_range_operator = true
158+
csharp_style_prefer_tuple_swap = true
159+
csharp_style_prefer_utf8_string_literals = true
160+
csharp_style_throw_expression = true
161+
csharp_style_unused_value_assignment_preference = discard_variable
162+
csharp_style_unused_value_expression_statement_preference = discard_variable
163+
164+
# 'using' directive preferences
165+
csharp_using_directive_placement = outside_namespace:silent
166+
167+
# New line preferences
168+
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true
169+
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true
170+
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true
171+
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true
172+
csharp_style_allow_embedded_statements_on_same_line_experimental = true
173+
174+
#### C# Formatting Rules ####
175+
# All handled by csharpier
176+
177+
#### Naming styles ####
178+
179+
# Naming rules
180+
181+
dotnet_naming_rule.interface_should_be_begins_with_i.severity = error
182+
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
183+
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
184+
185+
dotnet_naming_rule.types_should_be_pascal_case.severity = error
186+
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
187+
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
188+
189+
dotnet_naming_rule.constant_should_be_capitalized_snake_case.severity = error
190+
dotnet_naming_rule.constant_should_be_capitalized_snake_case.symbols = constant
191+
dotnet_naming_rule.constant_should_be_capitalized_snake_case.style = capitalized_snake_case
192+
193+
dotnet_naming_rule.readonly_should_be_begins_with__.severity = error
194+
dotnet_naming_rule.readonly_should_be_begins_with__.symbols = readonly
195+
dotnet_naming_rule.readonly_should_be_begins_with__.style = begins_with__
196+
197+
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = error
198+
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
199+
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
200+
201+
dotnet_naming_rule.private_or_internal_field_should_be_camel_case.severity = error
202+
dotnet_naming_rule.private_or_internal_field_should_be_camel_case.symbols = private_or_internal_field
203+
dotnet_naming_rule.private_or_internal_field_should_be_camel_case.style = camel_case
204+
205+
# Symbol specifications
206+
207+
dotnet_naming_symbols.interface.applicable_kinds = interface
208+
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
209+
dotnet_naming_symbols.interface.required_modifiers =
210+
211+
dotnet_naming_symbols.private_or_internal_field.applicable_kinds = field
212+
dotnet_naming_symbols.private_or_internal_field.applicable_accessibilities = internal, private, private_protected
213+
dotnet_naming_symbols.private_or_internal_field.required_modifiers =
214+
215+
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
216+
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
217+
dotnet_naming_symbols.types.required_modifiers =
218+
219+
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
220+
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
221+
dotnet_naming_symbols.non_field_members.required_modifiers =
222+
223+
dotnet_naming_symbols.constant.applicable_kinds = field
224+
dotnet_naming_symbols.constant.applicable_accessibilities = public, internal, private
225+
dotnet_naming_symbols.constant.required_modifiers = const
226+
227+
dotnet_naming_symbols.readonly.applicable_kinds = field
228+
dotnet_naming_symbols.readonly.applicable_accessibilities = public, private
229+
dotnet_naming_symbols.readonly.required_modifiers = readonly
230+
231+
# Naming styles
232+
233+
dotnet_naming_style.pascal_case.required_prefix =
234+
dotnet_naming_style.pascal_case.required_suffix =
235+
dotnet_naming_style.pascal_case.word_separator =
236+
dotnet_naming_style.pascal_case.capitalization = pascal_case
237+
238+
dotnet_naming_style.begins_with_i.required_prefix = I
239+
dotnet_naming_style.begins_with_i.required_suffix =
240+
dotnet_naming_style.begins_with_i.word_separator =
241+
dotnet_naming_style.begins_with_i.capitalization = pascal_case
242+
243+
dotnet_naming_style.camel_case.required_prefix =
244+
dotnet_naming_style.camel_case.required_suffix =
245+
dotnet_naming_style.camel_case.word_separator =
246+
dotnet_naming_style.camel_case.capitalization = camel_case
247+
248+
dotnet_naming_style.capitalized_snake_case.required_prefix =
249+
dotnet_naming_style.capitalized_snake_case.required_suffix =
250+
dotnet_naming_style.capitalized_snake_case.word_separator = _
251+
dotnet_naming_style.capitalized_snake_case.capitalization = all_upper
252+
253+
dotnet_naming_style.begins_with__.required_prefix = _
254+
dotnet_naming_style.begins_with__.required_suffix =
255+
dotnet_naming_style.begins_with__.word_separator =
256+
dotnet_naming_style.begins_with__.capitalization = camel_case
257+
258+
[*.{cs,vb}]
259+
dotnet_style_operator_placement_when_wrapping = beginning_of_line
260+
tab_width = 4
261+
indent_size = 4
262+
dotnet_style_coalesce_expression = true:suggestion
263+
dotnet_style_null_propagation = true:suggestion
264+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
265+
dotnet_style_prefer_auto_properties = true:silent
266+
dotnet_style_object_initializer = true:suggestion
267+
dotnet_style_collection_initializer = true:suggestion
268+
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
269+
dotnet_style_prefer_conditional_expression_over_assignment = true:silent

.github/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# CodeBlock.Dev
2+
Let's see what happens!

0 commit comments

Comments
 (0)