Skip to content

Commit 0f6932a

Browse files
committed
Added a .editorconfig file to define some of the coding styles used for the Open Hardware Monitor project.
1 parent 0751abb commit 0f6932a

2 files changed

Lines changed: 145 additions & 4 deletions

File tree

.editorconfig

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# top-most editorconfig file
2+
root = true
3+
4+
[*]
5+
insert_final_newline = true
6+
indent_style = space
7+
indent_size = 2
8+
tab_width = 2
9+
trim_trailing_whitespace = true
10+
11+
[*.cs]
12+
# Recommended max_line_length = 100
13+
14+
# New line preferences
15+
csharp_new_line_before_open_brace = none
16+
csharp_new_line_before_else = false
17+
csharp_new_line_before_catch = false
18+
csharp_new_line_before_finally = false
19+
csharp_new_line_before_members_in_object_initializers = false
20+
csharp_new_line_before_members_in_anonymous_types = false
21+
csharp_new_line_between_query_expression_clauses = false
22+
23+
# Indentation preferences
24+
csharp_indent_block_contents = true
25+
csharp_indent_braces = false
26+
csharp_indent_case_contents = true
27+
csharp_indent_case_contents_when_block = true
28+
csharp_indent_switch_labels = true
29+
csharp_indent_labels = one_less_than_current
30+
31+
# Modifier preferences
32+
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
33+
34+
# Use of this., avoid except for fields
35+
dotnet_style_qualification_for_field = false:none
36+
dotnet_style_qualification_for_property = false:suggestion
37+
dotnet_style_qualification_for_method = false:suggestion
38+
dotnet_style_qualification_for_event = false:suggestion
39+
40+
# Types: use keywords instead of BCL types, and permit var only when the type is clear
41+
csharp_style_var_for_built_in_types = false:suggestion
42+
csharp_style_var_when_type_is_apparent = false:none
43+
csharp_style_var_elsewhere = false:suggestion
44+
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
45+
dotnet_style_predefined_type_for_member_access = true:suggestion
46+
47+
# Name all constant fields using PascalCase
48+
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
49+
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
50+
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
51+
dotnet_naming_symbols.constant_fields.applicable_kinds = field
52+
dotnet_naming_symbols.constant_fields.required_modifiers = const
53+
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
54+
55+
# Code style defaults
56+
csharp_using_directive_placement = outside_namespace:suggestion
57+
dotnet_sort_system_directives_first = true
58+
csharp_prefer_braces = true:refactoring
59+
csharp_preserve_single_line_blocks = true:none
60+
csharp_preserve_single_line_statements = false:none
61+
csharp_prefer_static_local_function = true:suggestion
62+
csharp_prefer_simple_using_statement = false:none
63+
csharp_style_prefer_switch_expression = true:suggestion
64+
65+
# Code quality
66+
dotnet_style_readonly_field = true:suggestion
67+
dotnet_code_quality_unused_parameters = non_public:suggestion
68+
69+
# Expression-level preferences
70+
dotnet_style_object_initializer = true:suggestion
71+
dotnet_style_collection_initializer = true:suggestion
72+
dotnet_style_explicit_tuple_names = true:suggestion
73+
dotnet_style_coalesce_expression = true:suggestion
74+
dotnet_style_null_propagation = true:suggestion
75+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
76+
dotnet_style_prefer_inferred_tuple_names = true:suggestion
77+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
78+
dotnet_style_prefer_auto_properties = true:suggestion
79+
dotnet_style_prefer_conditional_expression_over_assignment = true:refactoring
80+
dotnet_style_prefer_conditional_expression_over_return = true:refactoring
81+
csharp_prefer_simple_default_expression = true:suggestion
82+
83+
# Expression-bodied members
84+
csharp_style_expression_bodied_methods = true:refactoring
85+
csharp_style_expression_bodied_constructors = true:refactoring
86+
csharp_style_expression_bodied_operators = true:refactoring
87+
csharp_style_expression_bodied_properties = true:refactoring
88+
csharp_style_expression_bodied_indexers = true:refactoring
89+
csharp_style_expression_bodied_accessors = true:refactoring
90+
csharp_style_expression_bodied_lambdas = true:refactoring
91+
csharp_style_expression_bodied_local_functions = true:refactoring
92+
93+
# Pattern matching
94+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
95+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
96+
csharp_style_inlined_variable_declaration = true:suggestion
97+
98+
# Null checking preferences
99+
csharp_style_throw_expression = true:suggestion
100+
csharp_style_conditional_delegate_call = true:suggestion
101+
102+
# Other features
103+
csharp_style_prefer_index_operator = false:none
104+
csharp_style_prefer_range_operator = false:none
105+
csharp_style_pattern_local_over_anonymous_function = false:none
106+
107+
# Space preferences
108+
csharp_space_after_cast = false
109+
csharp_space_after_colon_in_inheritance_clause = true
110+
csharp_space_after_comma = true
111+
csharp_space_after_dot = false
112+
csharp_space_after_keywords_in_control_flow_statements = true
113+
csharp_space_after_semicolon_in_for_statement = true
114+
csharp_space_around_binary_operators = before_and_after
115+
csharp_space_around_declaration_statements = do_not_ignore
116+
csharp_space_before_colon_in_inheritance_clause = true
117+
csharp_space_before_comma = false
118+
csharp_space_before_dot = false
119+
csharp_space_before_open_square_brackets = false
120+
csharp_space_before_semicolon_in_for_statement = false
121+
csharp_space_between_empty_square_brackets = false
122+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
123+
csharp_space_between_method_call_name_and_opening_parenthesis = false
124+
csharp_space_between_method_call_parameter_list_parentheses = false
125+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
126+
csharp_space_between_method_declaration_name_and_open_parenthesis = false
127+
csharp_space_between_method_declaration_parameter_list_parentheses = false
128+
csharp_space_between_parentheses = false
129+
csharp_space_between_square_brackets = false
130+
131+
# Analyzers
132+
dotnet_code_quality.ca1802.api_surface = private, internal

OpenHardwareMonitor.sln

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11

2-
Microsoft Visual Studio Solution File, Format Version 11.00
3-
# Visual Studio 2010
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.29806.167
5+
MinimumVisualStudioVersion = 10.0.40219.1
46
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenHardwareMonitorLib", "OpenHardwareMonitorLib.csproj", "{B0397530-545A-471D-BB74-027AE456DF1A}"
57
EndProject
68
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenHardwareMonitor", "OpenHardwareMonitor.csproj", "{F5E0C1F7-9E9B-46F2-AC88-8C9C1C923880}"
79
ProjectSection(ProjectDependencies) = postProject
810
{B0397530-545A-471D-BB74-027AE456DF1A} = {B0397530-545A-471D-BB74-027AE456DF1A}
911
EndProjectSection
1012
EndProject
13+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F8FB5D14-2337-4E78-9333-90BE9A8E8F47}"
14+
ProjectSection(SolutionItems) = preProject
15+
.editorconfig = .editorconfig
16+
EndProjectSection
17+
EndProject
1118
Global
1219
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1320
Debug|Any CPU = Debug|Any CPU
@@ -26,20 +33,22 @@ Global
2633
GlobalSection(SolutionProperties) = preSolution
2734
HideSolutionNode = FALSE
2835
EndGlobalSection
36+
GlobalSection(ExtensibilityGlobals) = postSolution
37+
SolutionGuid = {0DCCC854-BBF2-40AC-81A2-10387E4E2868}
38+
EndGlobalSection
2939
GlobalSection(MonoDevelopProperties) = preSolution
3040
StartupItem = OpenHardwareMonitor.csproj
3141
Policies = $0
3242
$0.DotNetNamingPolicy = $1
3343
$1.DirectoryNamespaceAssociation = None
3444
$1.ResourceNamePolicy = FileFormatDefault
35-
$0.TextStylePolicy = $2
45+
$0.TextStylePolicy = $3
3646
$2.FileWidth = 120
3747
$2.TabWidth = 2
3848
$2.NoTabsAfterNonTabs = True
3949
$2.inheritsSet = VisualStudio
4050
$2.inheritsScope = text/plain
4151
$2.scope = text/plain
42-
$0.TextStylePolicy = $3
4352
$3.inheritsSet = null
4453
$3.scope = text/x-csharp
4554
$0.CSharpFormattingPolicy = $4

0 commit comments

Comments
 (0)