Skip to content

Commit 2354458

Browse files
committed
Update code style and formatting
1 parent ec050a3 commit 2354458

61 files changed

Lines changed: 365 additions & 123 deletions

Some content is hidden

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

.editorconfig

Lines changed: 239 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,244 @@
1-
# EditorConfig is awesome: http://editorconfig.org
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
24
root = true
35

4-
[*.cs]
5-
end_of_line = lf
6-
insert_final_newline = true
6+
# Don't use tabs for indentation.
7+
[*]
78
indent_style = space
89
indent_size = 4
10+
charset = utf-8
11+
insert_final_newline = true
912
trim_trailing_whitespace = true
13+
14+
# Markdown files
15+
[*.md]
16+
trim_trailing_whitespace = false
17+
18+
# Code files
19+
[*.{cs,csx}]
20+
indent_size = 4
21+
insert_final_newline = true
22+
charset = utf-8
23+
24+
# XML project files
25+
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
26+
indent_size = 2
27+
28+
# XML config files
29+
[*.{props,targets,ruleset,config,nuspec,resx}]
30+
indent_size = 2
31+
32+
# JSON files
33+
[*.json]
34+
indent_size = 2
35+
36+
# YAML files
37+
[*.{yml,yaml}]
38+
indent_size = 2
39+
40+
# Shell script files
41+
[*.sh]
42+
end_of_line = lf
43+
indent_size = 2
44+
45+
# Dotnet code style settings:
46+
[*.cs]
47+
48+
# Sort using and Import directives with System.* appearing first
49+
dotnet_sort_system_directives_first = true
50+
dotnet_separate_import_directive_groups = false
51+
52+
# Avoid "this." if not necessary
53+
dotnet_style_qualification_for_field = false:refactoring
54+
dotnet_style_qualification_for_property = false:refactoring
55+
dotnet_style_qualification_for_method = false:refactoring
56+
dotnet_style_qualification_for_event = false:refactoring
57+
58+
# Use language keywords instead of framework type names for type references
59+
dotnet_style_predefined_type_for_locals_parameters_members = true:warning
60+
dotnet_style_predefined_type_for_member_access = true:warning
61+
62+
# Suggest more modern language features when available
63+
dotnet_style_object_initializer = true:suggestion
64+
dotnet_style_collection_initializer = true:suggestion
65+
dotnet_style_coalesce_expression = true:suggestion
66+
dotnet_style_null_propagation = true:suggestion
67+
dotnet_style_explicit_tuple_names = true:suggestion
68+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
69+
dotnet_style_prefer_inferred_tuple_names = true:suggestion
70+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
71+
dotnet_style_prefer_auto_properties = true:suggestion
72+
73+
# Modifier preferences
74+
dotnet_style_require_accessibility_modifiers = for_non_interface_members:warning
75+
csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async:suggestion
76+
77+
# Whitespace options
78+
dotnet_style_allow_multiple_blank_lines_experimental = false
79+
80+
# Non-private static fields are PascalCase
81+
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = suggestion
82+
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields
83+
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style
84+
85+
dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field
86+
dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected
87+
dotnet_naming_symbols.non_private_static_fields.required_modifiers = static
88+
89+
dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case
90+
91+
# Non-private readonly fields are PascalCase
92+
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.severity = suggestion
93+
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.symbols = non_private_readonly_fields
94+
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.style = non_private_readonly_field_style
95+
96+
dotnet_naming_symbols.non_private_readonly_fields.applicable_kinds = field
97+
dotnet_naming_symbols.non_private_readonly_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected
98+
dotnet_naming_symbols.non_private_readonly_fields.required_modifiers = readonly
99+
100+
dotnet_naming_style.non_private_readonly_field_style.capitalization = pascal_case
101+
102+
# Constants are PascalCase
103+
dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion
104+
dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants
105+
dotnet_naming_rule.constants_should_be_pascal_case.style = constant_style
106+
107+
dotnet_naming_symbols.constants.applicable_kinds = field, local
108+
dotnet_naming_symbols.constants.required_modifiers = const
109+
110+
dotnet_naming_style.constant_style.capitalization = pascal_case
111+
112+
# Instance fields are camelCase and start with _
113+
dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion
114+
dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields
115+
dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style
116+
117+
dotnet_naming_symbols.instance_fields.applicable_kinds = field
118+
119+
dotnet_naming_style.instance_field_style.capitalization = camel_case
120+
dotnet_naming_style.instance_field_style.required_prefix = _
121+
122+
# Locals and parameters are camelCase
123+
dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion
124+
dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters
125+
dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style
126+
127+
dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local
128+
129+
dotnet_naming_style.camel_case_style.capitalization = camel_case
130+
131+
# Local functions are PascalCase
132+
dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion
133+
dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions
134+
dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style
135+
136+
dotnet_naming_symbols.local_functions.applicable_kinds = local_function
137+
138+
dotnet_naming_style.local_function_style.capitalization = pascal_case
139+
140+
# By default, name items with PascalCase
141+
dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion
142+
dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members
143+
dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style
144+
145+
dotnet_naming_symbols.all_members.applicable_kinds = *
146+
147+
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
148+
149+
# CSharp code style settings:
150+
[*.cs]
151+
152+
# Namespace preferences
153+
csharp_style_namespace_declarations = file_scoped:suggestion
154+
155+
# Newline settings
156+
csharp_new_line_before_open_brace = all
157+
csharp_new_line_before_else = true
158+
csharp_new_line_before_catch = true
159+
csharp_new_line_before_finally = true
160+
csharp_new_line_before_members_in_object_initializers = true
161+
csharp_new_line_before_members_in_anonymous_types = true
162+
csharp_new_line_between_query_expression_clauses = true
163+
164+
# Indentation preferences
165+
csharp_indent_block_contents = true
166+
csharp_indent_braces = false
167+
csharp_indent_case_contents = true
168+
csharp_indent_case_contents_when_block = false
169+
csharp_indent_switch_labels = true
170+
csharp_indent_labels = flush_left
171+
172+
# Whitespace options
173+
csharp_style_allow_embedded_statements_on_same_line_experimental = false
174+
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false
175+
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false
176+
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = false
177+
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = false
178+
179+
# Prefer explicit types unless type is apparent
180+
csharp_style_var_for_built_in_types = false:suggestion
181+
csharp_style_var_when_type_is_apparent = false:suggestion
182+
csharp_style_var_elsewhere = false:suggestion
183+
184+
# Prefer method-like constructs to have a block body
185+
csharp_style_expression_bodied_methods = when_on_single_line:suggestion
186+
csharp_style_expression_bodied_constructors = false:suggestion
187+
csharp_style_expression_bodied_operators = when_on_single_line:suggestion
188+
189+
# Prefer property-like constructs to have an expression-body
190+
csharp_style_expression_bodied_properties = true:suggestion
191+
csharp_style_expression_bodied_indexers = true:suggestion
192+
csharp_style_expression_bodied_accessors = true:suggestion
193+
csharp_style_expression_bodied_lambdas = true:suggestion
194+
csharp_style_expression_bodied_local_functions = when_on_single_line:suggestion
195+
196+
# Suggest more modern language features when available
197+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
198+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
199+
csharp_style_inlined_variable_declaration = true:suggestion
200+
csharp_style_prefer_extended_property_pattern = true:suggestion
201+
202+
# Null checking preferences
203+
csharp_style_throw_expression = true:suggestion
204+
csharp_style_conditional_delegate_call = true:suggestion
205+
206+
# Code style defaults
207+
csharp_using_directive_placement = outside_namespace:warning
208+
csharp_prefer_braces = true:warning
209+
csharp_preserve_single_line_blocks = true
210+
csharp_preserve_single_line_statements = false
211+
csharp_prefer_static_local_function = true:suggestion
212+
csharp_prefer_simple_using_statement = true:suggestion
213+
csharp_prefer_simple_default_expression = true:suggestion
214+
csharp_style_prefer_local_over_anonymous_function = true:suggestion
215+
csharp_style_prefer_switch_expression = true:suggestion
216+
csharp_style_prefer_tuple_swap = true:suggestion
217+
csharp_style_prefer_utf8_string_literals = true:suggestion
218+
csharp_style_deconstructed_variable_declaration = true:suggestion
219+
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
220+
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
221+
222+
# Space preferences
223+
csharp_space_after_cast = false
224+
csharp_space_after_colon_in_inheritance_clause = true
225+
csharp_space_after_comma = true
226+
csharp_space_after_dot = false
227+
csharp_space_after_keywords_in_control_flow_statements = true
228+
csharp_space_after_semicolon_in_for_statement = true
229+
csharp_space_around_binary_operators = before_and_after
230+
csharp_space_around_declaration_statements = do_not_ignore
231+
csharp_space_before_colon_in_inheritance_clause = true
232+
csharp_space_before_comma = false
233+
csharp_space_before_dot = false
234+
csharp_space_before_open_square_brackets = false
235+
csharp_space_before_semicolon_in_for_statement = false
236+
csharp_space_between_empty_square_brackets = false
237+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
238+
csharp_space_between_method_call_name_and_opening_parenthesis = false
239+
csharp_space_between_method_call_parameter_list_parentheses = false
240+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
241+
csharp_space_between_method_declaration_name_and_open_parenthesis = false
242+
csharp_space_between_method_declaration_parameter_list_parentheses = false
243+
csharp_space_between_parentheses = false
244+
csharp_space_between_square_brackets = false

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
###############################################################################
22
# Set default behavior to automatically normalize line endings.
33
###############################################################################
4-
* text=auto
4+
* text=auto eol=lf
55

66
###############################################################################
77
# Set default behavior for command prompt diff.

src/Analytics.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
using Oxide.Core.Libraries;
2-
using Oxide.Core.Libraries.Covalence;
3-
using Oxide.Core.Plugins;
41
using System;
52
using System.Collections.Generic;
3+
using Oxide.Core.Libraries;
4+
using Oxide.Core.Libraries.Covalence;
5+
using Oxide.Core.Plugins;
66

77
namespace Oxide.Core
88
{

src/ArrayPool.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using Oxide.Pooling;
33

44
namespace Oxide.Core

src/Cleanup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.IO;
44

src/CommandLine.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Text;

src/Configuration/ConfigFile.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
extern alias References;
2-
3-
using References::Newtonsoft.Json;
1+
extern alias References;
42
using System;
53
using System.Globalization;
64
using System.IO;
5+
using References::Newtonsoft.Json;
76

87
namespace Oxide.Core.Configuration
98
{
@@ -14,7 +13,8 @@ public abstract class ConfigFile
1413
{
1514
private static JsonSerializerSettings SerializerSettings = new JsonSerializerSettings()
1615
{
17-
DefaultValueHandling = DefaultValueHandling.Populate, Culture = CultureInfo.InvariantCulture,
16+
DefaultValueHandling = DefaultValueHandling.Populate,
17+
Culture = CultureInfo.InvariantCulture,
1818
Formatting = Formatting.Indented,
1919
MissingMemberHandling = MissingMemberHandling.Ignore
2020
};

src/Configuration/DynamicConfigFile.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
extern alias References;
2-
3-
using References::Newtonsoft.Json;
1+
extern alias References;
42
using System;
53
using System.Collections;
64
using System.Collections.Generic;
75
using System.IO;
86
using System.Linq;
97
using System.Text.RegularExpressions;
8+
using References::Newtonsoft.Json;
109

1110
namespace Oxide.Core.Configuration
1211
{

src/Configuration/OxideConfig.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
extern alias References;
2-
3-
using References::Newtonsoft.Json;
1+
extern alias References;
42
using System.Collections;
53
using System.Collections.Generic;
64
using System.Linq;
75
using System.Net;
6+
using References::Newtonsoft.Json;
87

98
namespace Oxide.Core.Configuration
109
{

src/DataFileSystem.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
extern alias References;
2-
3-
using Oxide.Core.Configuration;
4-
using References::Newtonsoft.Json;
1+
extern alias References;
52
using System;
63
using System.Collections.Generic;
74
using System.IO;
85
using System.Linq;
6+
using Oxide.Core.Configuration;
7+
using References::Newtonsoft.Json;
98

109
namespace Oxide.Core
1110
{
@@ -101,7 +100,9 @@ public T ReadObject<T>(string name)
101100
T instance = default;
102101

103102
if (ExistsDatafile(name))
103+
{
104104
instance = GetFile(name).ReadObject<T>();
105+
}
105106

106107
if (instance == null)
107108
{

0 commit comments

Comments
 (0)