Skip to content

Commit f762179

Browse files
committed
Analyzers and config
1 parent ca2bc46 commit f762179

7 files changed

+438
-92
lines changed

Diff for: .editorconfig

+172
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
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+
charset = utf-8
15+
16+
[*.json]
17+
indent_size = 2
18+
19+
# C# files
20+
[*.cs]
21+
# New line preferences
22+
csharp_new_line_before_open_brace = all
23+
csharp_new_line_before_else = true
24+
csharp_new_line_before_catch = true
25+
csharp_new_line_before_finally = true
26+
csharp_new_line_before_members_in_object_initializers = true
27+
csharp_new_line_before_members_in_anonymous_types = true
28+
csharp_new_line_between_query_expression_clauses = true
29+
30+
# Indentation preferences
31+
csharp_indent_block_contents = true
32+
csharp_indent_braces = false
33+
csharp_indent_case_contents = true
34+
csharp_indent_case_contents_when_block = true
35+
csharp_indent_switch_labels = true
36+
csharp_indent_labels = one_less_than_current
37+
38+
# Modifier preferences
39+
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
40+
41+
# avoid this. unless absolutely necessary
42+
dotnet_style_qualification_for_field = false:suggestion
43+
dotnet_style_qualification_for_property = false:suggestion
44+
dotnet_style_qualification_for_method = false:suggestion
45+
dotnet_style_qualification_for_event = false:suggestion
46+
47+
# Types: use keywords instead of BCL types, and permit var only when the type is clear
48+
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
49+
dotnet_style_predefined_type_for_member_access = true:suggestion
50+
51+
# name all constant fields using PascalCase
52+
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
53+
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
54+
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
55+
dotnet_naming_symbols.constant_fields.applicable_kinds = field
56+
dotnet_naming_symbols.constant_fields.required_modifiers = const
57+
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
58+
59+
# internal and private fields should be _camelCase
60+
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
61+
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
62+
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
63+
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
64+
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
65+
dotnet_naming_style.camel_case_underscore_style.required_prefix = _
66+
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
67+
68+
# Code style defaults
69+
csharp_using_directive_placement = outside_namespace:suggestion
70+
dotnet_sort_system_directives_first = true
71+
csharp_prefer_braces = true:refactoring
72+
csharp_preserve_single_line_blocks = true:none
73+
csharp_preserve_single_line_statements = false:none
74+
csharp_prefer_static_local_function = true:suggestion
75+
csharp_prefer_simple_using_statement = false:none
76+
csharp_style_prefer_switch_expression = true:suggestion
77+
78+
# Code quality
79+
dotnet_style_readonly_field = true:error
80+
dotnet_code_quality_unused_parameters = non_public:suggestion
81+
82+
# Expression-level preferences
83+
dotnet_style_object_initializer = true:suggestion
84+
dotnet_style_collection_initializer = true:suggestion
85+
dotnet_style_explicit_tuple_names = true:suggestion
86+
dotnet_style_coalesce_expression = true:suggestion
87+
dotnet_style_null_propagation = true:suggestion
88+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
89+
dotnet_style_prefer_inferred_tuple_names = true:suggestion
90+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
91+
dotnet_style_prefer_auto_properties = true:suggestion
92+
dotnet_style_prefer_conditional_expression_over_assignment = true:refactoring
93+
dotnet_style_prefer_conditional_expression_over_return = true:refactoring
94+
csharp_prefer_simple_default_expression = true:suggestion
95+
96+
# Expression-bodied members
97+
csharp_style_expression_bodied_methods = true:refactoring
98+
csharp_style_expression_bodied_constructors = true:refactoring
99+
csharp_style_expression_bodied_operators = true:refactoring
100+
csharp_style_expression_bodied_properties = true:refactoring
101+
csharp_style_expression_bodied_indexers = true:refactoring
102+
csharp_style_expression_bodied_accessors = true:refactoring
103+
csharp_style_expression_bodied_lambdas = true:refactoring
104+
csharp_style_expression_bodied_local_functions = true:refactoring
105+
106+
# Pattern matching
107+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
108+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
109+
csharp_style_inlined_variable_declaration = true:suggestion
110+
111+
# Null checking preferences
112+
csharp_style_throw_expression = true:suggestion
113+
csharp_style_conditional_delegate_call = true:suggestion
114+
115+
# Other features
116+
csharp_style_prefer_index_operator = false:none
117+
csharp_style_prefer_range_operator = false:none
118+
csharp_style_pattern_local_over_anonymous_function = false:none
119+
120+
# Space preferences
121+
csharp_space_after_cast = false
122+
csharp_space_after_colon_in_inheritance_clause = true
123+
csharp_space_after_comma = true
124+
csharp_space_after_dot = false
125+
csharp_space_after_keywords_in_control_flow_statements = true
126+
csharp_space_after_semicolon_in_for_statement = true
127+
csharp_space_around_binary_operators = before_and_after
128+
csharp_space_around_declaration_statements = do_not_ignore
129+
csharp_space_before_colon_in_inheritance_clause = true
130+
csharp_space_before_comma = false
131+
csharp_space_before_dot = false
132+
csharp_space_before_open_square_brackets = false
133+
csharp_space_before_semicolon_in_for_statement = false
134+
csharp_space_between_empty_square_brackets = false
135+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
136+
csharp_space_between_method_call_name_and_opening_parenthesis = false
137+
csharp_space_between_method_call_parameter_list_parentheses = false
138+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
139+
csharp_space_between_method_declaration_name_and_open_parenthesis = false
140+
csharp_space_between_method_declaration_parameter_list_parentheses = false
141+
csharp_space_between_parentheses = false
142+
csharp_space_between_square_brackets = false
143+
144+
# Analyzers
145+
dotnet_code_quality.ca1802.api_surface = private, internal
146+
147+
# C++ Files
148+
[*.{cpp,h,in}]
149+
curly_bracket_next_line = true
150+
indent_brace_style = Allman
151+
152+
# Xml project files
153+
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
154+
indent_size = 2
155+
156+
# Xml build files
157+
[*.builds]
158+
indent_size = 2
159+
160+
# Xml files
161+
[*.{xml,stylecop,resx,ruleset}]
162+
indent_size = 2
163+
164+
# Xml config files
165+
[*.{props,targets,config,nuspec}]
166+
indent_size = 2
167+
168+
# Shell scripts
169+
[*.sh]
170+
end_of_line = lf
171+
[*.{cmd, bat}]
172+
end_of_line = crlf

Diff for: .gitattributes

+19-60
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,22 @@
1-
###############################################################################
2-
# Set default behavior to automatically normalize line endings.
3-
###############################################################################
1+
# Auto detect text files and perform LF normalization
42
* text=auto
53

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
4+
# Custom for Visual Studio
5+
*.cs diff=csharp
6+
*.sln merge=union
7+
*.csproj merge=union
8+
*.vbproj merge=union
9+
*.fsproj merge=union
10+
*.dbproj merge=union
1411

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 merge=binary
26-
#*.csproj merge=binary
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-
47-
###############################################################################
48-
# diff behavior for common document formats
49-
#
50-
# Convert binary document formats to text before diffing them. This feature
51-
# is only available from the command line. Turn it on by uncommenting the
52-
# entries below.
53-
###############################################################################
54-
#*.doc diff=astextplain
55-
#*.DOC diff=astextplain
56-
#*.docx diff=astextplain
57-
#*.DOCX diff=astextplain
58-
#*.dot diff=astextplain
59-
#*.DOT diff=astextplain
60-
#*.pdf diff=astextplain
61-
#*.PDF diff=astextplain
62-
#*.rtf diff=astextplain
63-
#*.RTF diff=astextplain
12+
# Standard to msysgit
13+
*.doc diff=astextplain
14+
*.DOC diff=astextplain
15+
*.docx diff=astextplain
16+
*.DOCX diff=astextplain
17+
*.dot diff=astextplain
18+
*.DOT diff=astextplain
19+
*.pdf diff=astextplain
20+
*.PDF diff=astextplain
21+
*.rtf diff=astextplain
22+
*.RTF diff=astextplain

0 commit comments

Comments
 (0)