Skip to content

Commit 9757260

Browse files
committed
Add new standalone command-line tool: InferNull.
This commit separates NullabilityInference from the ICSharpCode.CodeConverter repository, which I originally used to get started with Roslyn. I used `git filter-repo` to remove the CodeConverter history from this repository. The code in the `InferNull` command line tool (git check + roslyn workspace initialization) is mostly a copy of code originally written by @GrahamTheCoder for ICSharpCode.CodeConverter.
1 parent e89ff57 commit 9757260

34 files changed

+1439
-44
lines changed

.editorconfig

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
; Top-most EditorConfig file
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 4
7+
8+
9+
[*.csproj]
10+
indent_style = space
11+
indent_size = 2
12+
[*.config]
13+
indent_style = space
14+
indent_size = 2
15+
16+
[*.vsixmanifest]
17+
indent_style = space
18+
indent_size = 2
19+
20+
[*.vsct]
21+
indent_style = space
22+
indent_size = 2
23+
24+
[*.cs]
25+
# New line preferences
26+
csharp_new_line_before_open_brace = methods, types
27+
csharp_new_line_before_else = false
28+
csharp_new_line_before_catch = false
29+
csharp_new_line_before_finally = false
30+
csharp_new_line_before_members_in_object_initializers = false
31+
csharp_new_line_before_members_in_anonymous_types = false
32+
csharp_new_line_within_query_expression_clauses = false
33+
34+
# Indentation preferences
35+
csharp_indent_block_contents = true
36+
csharp_indent_braces = false
37+
csharp_indent_case_contents = true
38+
csharp_indent_switch_labels = true
39+
csharp_indent_labels = one_less
40+
41+
# Avoid 'this.' in generated code unless absolutely necessary, but allow developers to use it
42+
dotnet_style_qualification_for_field = false:silent
43+
dotnet_style_qualification_for_property = false:silent
44+
dotnet_style_qualification_for_method = false:silent
45+
dotnet_style_qualification_for_event = false:silent
46+
47+
# Do not use 'var' when generating code, but allow developers to use it
48+
csharp_style_var_for_built_in_types = false:silent
49+
csharp_style_var_when_type_is_apparent = true:silent
50+
csharp_style_var_elsewhere = true:silent
51+
52+
# Use language keywords instead of BCL types when generating code, but allow developers to use either
53+
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
54+
dotnet_style_predefined_type_for_member_access = true:silent
55+
56+
# Using directives
57+
dotnet_sort_system_directives_first = true
58+
59+
# Wrapping
60+
csharp_preserve_single_line_blocks = true
61+
csharp_preserve_single_line_statements = true
62+
63+
# Code style
64+
csharp_prefer_braces = true:silent
65+
66+
# Expression-level preferences
67+
dotnet_style_object_initializer = true:suggestion
68+
dotnet_style_collection_initializer = true:suggestion
69+
dotnet_style_explicit_tuple_names = true:suggestion
70+
dotnet_style_coalesce_expression = true:suggestion
71+
dotnet_style_null_propagation = true:suggestion
72+
73+
# Expression-bodied members
74+
csharp_style_expression_bodied_methods = false:silent
75+
csharp_style_expression_bodied_constructors = false:silent
76+
csharp_style_expression_bodied_operators = false:silent
77+
csharp_style_expression_bodied_properties = true:silent
78+
csharp_style_expression_bodied_indexers = true:silent
79+
csharp_style_expression_bodied_accessors = true:silent
80+
81+
# Pattern matching
82+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
83+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
84+
csharp_style_inlined_variable_declaration = true:suggestion
85+
86+
# Null checking preferences
87+
csharp_style_throw_expression = true:suggestion
88+
csharp_style_conditional_delegate_call = true:suggestion
89+
90+
# Space preferences
91+
csharp_space_after_cast = false
92+
csharp_space_after_colon_in_inheritance_clause = true
93+
csharp_space_after_comma = true
94+
csharp_space_after_dot = false
95+
csharp_space_after_keywords_in_control_flow_statements = true
96+
csharp_space_after_semicolon_in_for_statement = true
97+
csharp_space_around_binary_operators = before_and_after
98+
csharp_space_around_declaration_statements = do_not_ignore
99+
csharp_space_before_colon_in_inheritance_clause = true
100+
csharp_space_before_comma = false
101+
csharp_space_before_dot = false
102+
csharp_space_before_open_square_brackets = false
103+
csharp_space_before_semicolon_in_for_statement = false
104+
csharp_space_between_empty_square_brackets = false
105+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
106+
csharp_space_between_method_call_name_and_opening_parenthesis = false
107+
csharp_space_between_method_call_parameter_list_parentheses = false
108+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
109+
csharp_space_between_method_declaration_name_and_open_parenthesis = false
110+
csharp_space_between_method_declaration_parameter_list_parentheses = false
111+
csharp_space_between_parentheses = false
112+
csharp_space_between_square_brackets = false
113+
114+
# RCS1141: Add 'param' element to documentation comment.
115+
dotnet_diagnostic.RCS1141.severity = none
116+
117+
# RCS1139: Add summary element to documentation comment.
118+
dotnet_diagnostic.RCS1139.severity = none
119+
120+
# RCS1090: Call 'ConfigureAwait(false)'.
121+
dotnet_diagnostic.RCS1090.severity = none
122+
123+
# RCS1080: Use 'Count/Length' property instead of 'Any' method.
124+
dotnet_diagnostic.RCS1080.severity = none
125+
126+
# RCS1124: Inline local variable.
127+
dotnet_diagnostic.RCS1124.severity = none
128+
129+
# RCS1077: Optimize LINQ method call.
130+
dotnet_diagnostic.RCS1077.severity = none
131+
132+
# IDE0040: Add accessibility modifiers
133+
dotnet_style_require_accessibility_modifiers = always:warning
134+
135+
# IDE0048: Add parentheses for clarity
136+
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:none
137+
138+
# IDE0048: Add parentheses for clarity
139+
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:none
140+
141+
# IDE0048: Add parentheses for clarity
142+
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:none
143+
144+
# IDE0048: Add parentheses for clarity
145+
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:none
146+
147+
# RCS1123: Add parentheses according to operator precedence.
148+
dotnet_diagnostic.RCS1123.severity = none
149+
150+
# Default severity for analyzer diagnostics with category 'Performance' - turn this up to warn when looking for performance issues
151+
dotnet_analyzer_diagnostic.category-Performance.severity = suggestion

.gitattributes

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
* text eol=crlf
2+
*.dll binary
3+
*.png binary
4+
*.jpeg binary
5+
*.jpg binary
6+
*.gif binary
7+
*.ttf binary
8+
*.exe binary
9+
*.eot binary
10+
*.woff binary
11+
*.woff2 binary
12+
13+
CHANGELOG.md text merge=union

0 commit comments

Comments
 (0)