Skip to content

Commit

Permalink
Add editorconfig & fix file copyright headers
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-weiland committed May 29, 2022
1 parent c425f0a commit 5cbe767
Show file tree
Hide file tree
Showing 14 changed files with 244 additions and 71 deletions.
205 changes: 205 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
# You can learn more about editorconfig here: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference

###############################
# Core EditorConfig Options #
###############################

# Top-most EditorConfig file
root = true

# All files
[*]
indent_style = space

# XML project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2

# XML config files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_size = 2

# JSON files
[*.json]
indent_size = 4

# C# code files
[*.{cs,csx,vb,vbx}]
indent_size = 4
insert_final_newline = true
charset = utf-8-bom

###############################
# .NET Coding Conventions #
###############################
[*.{cs,vb}]

# Organize usings
dotnet_sort_system_directives_first = false
dotnet_separate_import_directive_groups = false

# this. preferences
dotnet_style_qualification_for_event = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_method = false:suggestion

# Prefer the language keyword instead of the type name for types that have a keyword to represent them
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion

# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
dotnet_style_readonly_field = true:suggestion

# Expression-level preferences
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_auto_properties = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent

###############################
# Naming Conventions #
###############################

# Style definitions
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
dotnet_naming_style.camel_case_style.capitalization = camel_case

# Constant fields should be PascalCase
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
dotnet_naming_symbols.constant_fields.applicable_kinds = field
dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
dotnet_naming_symbols.constant_fields.required_modifiers = const

# Non-private static fields should be PascalCase
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = pascal_case_style
dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field
dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, internal, protected_internal
dotnet_naming_symbols.non_private_static_fields.required_modifiers = static

# Non-private fields should be PascalCase
dotnet_naming_rule.non_private_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_private_fields_should_be_pascal_case.symbols = non_private_fields
dotnet_naming_rule.non_private_fields_should_be_pascal_case.style = pascal_case_style
dotnet_naming_symbols.non_private_fields.applicable_kinds = field
dotnet_naming_symbols.non_private_fields.applicable_accessibilities = public, internal, protected_internal

# Static fields should be camelCase
dotnet_naming_rule.static_fields_should_be_camel_case.severity = suggestion
dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields
dotnet_naming_rule.static_fields_should_be_camel_case.style = camel_case_style
dotnet_naming_symbols.static_fields.applicable_kinds = field
dotnet_naming_symbols.static_fields.required_modifiers = static

# Instance fields should be camelCase
dotnet_naming_rule.instance_fields_should_be_camel_case.severity = none
dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields
dotnet_naming_rule.instance_fields_should_be_camel_case.style = camel_case_style
dotnet_naming_symbols.instance_fields.applicable_kinds = field

# Locals and parameters should be camelCase
dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion
dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters
dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style
dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local

# Use PascalCase for everything else
dotnet_naming_rule.default_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.default_should_be_pascal_case.symbols = default_for_everything_else
dotnet_naming_rule.default_should_be_pascal_case.style = pascal_case_style
dotnet_naming_symbols.default_for_everything_else.applicable_kinds = *

###############################
# C# Coding Conventions #
###############################
[*.cs]

# var preferences
csharp_style_var_for_built_in_types = false:silent
csharp_style_var_when_type_is_apparent = false:silent
csharp_style_var_elsewhere = false:silent

# Expression-bodied members
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_properties = true:suggestion
csharp_style_expression_bodied_indexers = true:suggestion
csharp_style_expression_bodied_accessors = true:suggestion

# Pattern matching preferences
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion

# Null-checking preferences
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion

# Modifier preferences
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion

# Expression-level preferences
csharp_prefer_braces = false:suggestion
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_pattern_local_over_anonymous_function = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion

###############################
# C# Formatting Rules #
###############################

# New line preferences
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 = false
csharp_new_line_before_members_in_anonymous_types = false
csharp_new_line_between_query_expression_clauses = true

# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = true
csharp_indent_switch_labels = true
csharp_indent_labels = flush_left

# Spacing preferences
csharp_space_after_cast = false
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = do_not_ignore
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false

# Wrapping preferences
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = false
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@

// This file is provided under The MIT License as part of RiptideSteamTransport.
// Copyright (c) 2021 Tom Weiland
// For additional information please see the included LICENSE.md file or view it on GitHub: https://github.com/tom-weiland/RiptideSteamTransport/blob/main/LICENSE.md

using Steamworks;
using Steamworks;
using UnityEngine;

namespace RiptideDemos.SteamTransport.PlayerHosted
Expand Down Expand Up @@ -101,4 +96,4 @@ internal void LeaveLobby()
SteamMatchmaking.LeaveLobby(lobbyId);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@

// This file is provided under The MIT License as part of RiptideSteamTransport.
// Copyright (c) 2021 Tom Weiland
// For additional information please see the included LICENSE.md file or view it on GitHub: https://github.com/tom-weiland/RiptideSteamTransport/blob/main/LICENSE.md

using RiptideNetworking;
using RiptideNetworking;
using RiptideNetworking.Transports.SteamTransport;
using RiptideNetworking.Utils;
using System;
Expand Down Expand Up @@ -160,4 +155,4 @@ private void DidDisconnect(object sender, EventArgs e)
UIManager.Singleton.BackToMain();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@

// This file is provided under The MIT License as part of RiptideSteamTransport.
// Copyright (c) 2021 Tom Weiland
// For additional information please see the included LICENSE.md file or view it on GitHub: https://github.com/tom-weiland/RiptideSteamTransport/blob/main/LICENSE.md

using UnityEngine;
using UnityEngine;

namespace RiptideDemos.SteamTransport.PlayerHosted
{
Expand Down Expand Up @@ -59,4 +54,4 @@ private void ToggleCursorMode()
UIManager.Singleton.UpdateUIVisibility();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@

// This file is provided under The MIT License as part of RiptideSteamTransport.
// Copyright (c) 2021 Tom Weiland
// For additional information please see the included LICENSE.md file or view it on GitHub: https://github.com/tom-weiland/RiptideSteamTransport/blob/main/LICENSE.md

using RiptideNetworking;
using RiptideNetworking;
using System.Collections.Generic;
using UnityEngine;

Expand Down Expand Up @@ -62,4 +57,4 @@ private static void PlayerMovement(Message message)
}
#endregion
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@

// This file is provided under The MIT License as part of RiptideSteamTransport.
// Copyright (c) 2021 Tom Weiland
// For additional information please see the included LICENSE.md file or view it on GitHub: https://github.com/tom-weiland/RiptideSteamTransport/blob/main/LICENSE.md

using RiptideNetworking;
using RiptideNetworking;
using UnityEngine;

namespace RiptideDemos.SteamTransport.PlayerHosted
Expand Down Expand Up @@ -56,4 +51,4 @@ private void SendInput()
}
#endregion
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@

// This file is provided under The MIT License as part of RiptideSteamTransport.
// Copyright (c) 2021 Tom Weiland
// For additional information please see the included LICENSE.md file or view it on GitHub: https://github.com/tom-weiland/RiptideSteamTransport/blob/main/LICENSE.md

using RiptideNetworking;
using RiptideNetworking;
using UnityEngine;

namespace RiptideDemos.SteamTransport.PlayerHosted
Expand Down Expand Up @@ -86,4 +81,4 @@ private void SendMovement()
}
#endregion
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@

// This file is provided under The MIT License as part of RiptideSteamTransport.
// Copyright (c) 2021 Tom Weiland
// For additional information please see the included LICENSE.md file or view it on GitHub: https://github.com/tom-weiland/RiptideSteamTransport/blob/main/LICENSE.md

using RiptideNetworking;
using RiptideNetworking;
using System.Collections.Generic;
using UnityEngine;

Expand Down Expand Up @@ -83,4 +78,4 @@ private static void PlayerInput(ushort fromClientId, Message message)
}
#endregion
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@

// This file is provided under The MIT License as part of RiptideSteamTransport.
// Copyright (c) 2021 Tom Weiland
// For additional information please see the included LICENSE.md file or view it on GitHub: https://github.com/tom-weiland/RiptideSteamTransport/blob/main/LICENSE.md

using UnityEngine;
using UnityEngine;
using UnityEngine.UI;

namespace RiptideDemos.SteamTransport.PlayerHosted
Expand Down Expand Up @@ -96,4 +91,4 @@ internal void UpdateUIVisibility()
lobbyMenu.SetActive(false);
}
}
}
}
12 changes: 12 additions & 0 deletions Assets/RiptideSteamTransport/Transport/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# You can learn more about editorconfig here: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference

# Top-most EditorConfig file
root = false

[*.{cs,vb}]

# Enforce file headers
file_header_template = This file is provided under The MIT License as part of RiptideSteamTransport.\nCopyright (c) Tom Weiland\nFor additional information please see the included LICENSE.md file or view it on GitHub: https://github.com/tom-weiland/RiptideSteamTransport/blob/main/LICENSE.md

# IDE0073: Incorrect/missing header
dotnet_diagnostic.IDE0073.severity = warning
7 changes: 3 additions & 4 deletions Assets/RiptideSteamTransport/Transport/SteamClient.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

// This file is provided under The MIT License as part of RiptideSteamTransport.
// Copyright (c) 2021 Tom Weiland
// This file is provided under The MIT License as part of RiptideSteamTransport.
// Copyright (c) Tom Weiland
// For additional information please see the included LICENSE.md file or view it on GitHub: https://github.com/tom-weiland/RiptideSteamTransport/blob/main/LICENSE.md

using RiptideNetworking.Utils;
Expand Down Expand Up @@ -357,4 +356,4 @@ private void OnClientDisconnected(ClientDisconnectedEventArgs e)
}
#endregion
}
}
}
7 changes: 3 additions & 4 deletions Assets/RiptideSteamTransport/Transport/SteamCommon.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

// This file is provided under The MIT License as part of RiptideSteamTransport.
// Copyright (c) 2021 Tom Weiland
// This file is provided under The MIT License as part of RiptideSteamTransport.
// Copyright (c) Tom Weiland
// For additional information please see the included LICENSE.md file or view it on GitHub: https://github.com/tom-weiland/RiptideSteamTransport/blob/main/LICENSE.md

using RiptideNetworking.Utils;
Expand Down Expand Up @@ -63,4 +62,4 @@ protected Message SteamProcessMessage(IntPtr ptrs, out HeaderType messageHeader)
return message;
}
}
}
}
Loading

0 comments on commit 5cbe767

Please sign in to comment.