summaryrefslogtreecommitdiffstats
path: root/modules/mono/.editorconfig
diff options
context:
space:
mode:
authorPaul Joannon <hello@pauljoannon.com>2024-02-19 22:15:37 +0100
committerPaul Joannon <hello@pauljoannon.com>2024-02-27 20:11:24 +0100
commit139a5df821bba81cb0ca27542afb47400dfad6ec (patch)
treeb387e38ad5d99ddb8f254b1565d48f2c34497670 /modules/mono/.editorconfig
parentbb6b06c81343073f10cbbd2af515cf0dac1e6549 (diff)
downloadredot-engine-139a5df821bba81cb0ca27542afb47400dfad6ec.tar.gz
Cleanup C# projects, code quality & style
New rules: - Do not silence CA1805 any more - Limit where we silence CA1707, CA1711, CA1720 - Enforce severity=warning for IDE0040 - Enforce Allman style braces - Enforce naming conventions (IDE1006 is still severity=suggestion) Fixes: - Fix REFL045, CS1572, CS1573 - Suppress CS0618 when generating `InvokeGodotClassMethod` - Fix indent when generating GD_constants.cs - Temporarily silence CS1734 in generated code - Fix a lot of naming rule violations Misc.: - Remove ReSharper comments for RedundantNameQualifier - Remove suppression attributes for RedundantNameQualifier - Remove severity=warnings for CA1716, CA1304 (already included in the level of analysis we run)
Diffstat (limited to 'modules/mono/.editorconfig')
-rw-r--r--modules/mono/.editorconfig71
1 files changed, 54 insertions, 17 deletions
diff --git a/modules/mono/.editorconfig b/modules/mono/.editorconfig
index db8fb2921c..1e5ae28396 100644
--- a/modules/mono/.editorconfig
+++ b/modules/mono/.editorconfig
@@ -13,22 +13,59 @@ trim_trailing_whitespace = true
max_line_length = 120
csharp_indent_case_contents_when_block = false
-[*.cs]
-# CA1707: Identifiers should not contain underscores
-# TODO:
-# Maybe we could disable this selectively only
-# where it's not desired and for generated code.
-dotnet_diagnostic.CA1707.severity = none
-# CA1711: Identifiers should not have incorrect suffix
-# Disable warning for suffixes like EventHandler, Flags, Enum, etc.
-dotnet_diagnostic.CA1711.severity = none
-# CA1716: Identifiers should not match keywords
-# TODO: We should look into this.
-dotnet_diagnostic.CA1716.severity = warning
-# CA1720: Identifiers should not contain type names
-dotnet_diagnostic.CA1720.severity = none
-# CA1805: Do not initialize unnecessarily
-# Don't tell me what to do.
-dotnet_diagnostic.CA1805.severity = none
+csharp_new_line_before_open_brace = all
+csharp_new_line_before_else = true
+csharp_new_line_before_catch = true
+csharp_new_line_before_finally = true
+csharp_new_line_before_members_in_object_initializers = true
+csharp_new_line_before_members_in_anonymous_types = true
+
+dotnet_style_require_accessibility_modifiers = always
+
# Diagnostics to prevent defensive copies of `in` struct parameters
resharper_possibly_impure_method_call_on_readonly_variable_highlighting = error
+
+# IDE0040: Add accessibility modifiers
+dotnet_diagnostic.IDE0040.severity = warning
+
+# IDE1006: Naming rule violation
+dotnet_diagnostic.IDE1006.severity = suggestion
+
+# Severity levels for dotnet_naming_rule only affect IDE environments.
+# To have them extra visible to people, we can set them as 'warning' here without affecting compilation.
+
+# Everything should be PascalCase by default
+dotnet_naming_rule.all_should_be_camel_case.severity = warning
+dotnet_naming_rule.all_should_be_camel_case.symbols = all
+dotnet_naming_rule.all_should_be_camel_case.style = pascal_case_style
+# Non-public fields should be _camelCase
+dotnet_naming_rule.non_public_fields_should_be_underscore_camel_case.severity = warning
+dotnet_naming_rule.non_public_fields_should_be_underscore_camel_case.symbols = non_public_fields
+dotnet_naming_rule.non_public_fields_should_be_underscore_camel_case.style = underscore_camel_case_style
+# Constant fields (and local vars) should be PascalCase
+dotnet_naming_rule.constants_should_be_pascal_case.severity = warning
+dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants
+dotnet_naming_rule.constants_should_be_pascal_case.style = pascal_case_style
+# Locals variables should be camelCase
+dotnet_naming_rule.local_vars_should_be_camel_case.severity = warning
+dotnet_naming_rule.local_vars_should_be_camel_case.symbols = local_vars
+dotnet_naming_rule.local_vars_should_be_camel_case.style = camel_case_style
+# Parameters should be camelCase
+dotnet_naming_rule.parameters_should_be_camel_case.severity = warning
+dotnet_naming_rule.parameters_should_be_camel_case.symbols = parameters
+dotnet_naming_rule.parameters_should_be_camel_case.style = camel_case_style
+
+dotnet_naming_symbols.all.applicable_kinds = *
+dotnet_naming_symbols.local_vars.applicable_kinds = local
+dotnet_naming_symbols.parameters.applicable_kinds = parameter
+dotnet_naming_symbols.constants.applicable_kinds = field, local
+dotnet_naming_symbols.constants.required_modifiers = const
+dotnet_naming_symbols.non_public_fields.applicable_kinds = field
+dotnet_naming_symbols.non_public_fields.applicable_accessibilities = private, protected, private_protected
+
+dotnet_naming_style.camel_case_style.capitalization = camel_case
+dotnet_naming_style.camel_case_style.required_prefix =
+dotnet_naming_style.underscore_camel_case_style.capitalization = camel_case
+dotnet_naming_style.underscore_camel_case_style.required_prefix = _
+dotnet_naming_style.pascal_case_style.capitalization = pascal_case
+dotnet_naming_style.pascal_case_style.required_prefix =