From 2bad1b9f4789b3a58b3c8a3fdcf73bae31ac657a Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Wed, 21 Apr 2021 16:18:55 -0400 Subject: [PATCH] Added .editorconfig to help keep project in compliance with coding guidelines --- Submodules/Oculus | 2 +- Submodules/SDK | 2 +- Submodules/glTF | 2 +- XRTK-Core/.editorconfig | 75 +++++++++++++++++++ .../Extensions/UnityObjectExtensions.cs | 1 + .../DataProviders/BezierLineDataProvider.cs | 8 +- .../Runtime/Utilities/MathUtilities.cs | 4 +- .../Services/ITestExtensionDataProvider1.cs | 6 +- 8 files changed, 90 insertions(+), 10 deletions(-) create mode 100644 XRTK-Core/.editorconfig diff --git a/Submodules/Oculus b/Submodules/Oculus index eb3341eba..81f5bbfed 160000 --- a/Submodules/Oculus +++ b/Submodules/Oculus @@ -1 +1 @@ -Subproject commit eb3341ebaf12871cd6c4cf4504d94ac2bcfb123c +Subproject commit 81f5bbfed0ad366c0a2511be4472db1445f41143 diff --git a/Submodules/SDK b/Submodules/SDK index fbfd50717..aaa20edea 160000 --- a/Submodules/SDK +++ b/Submodules/SDK @@ -1 +1 @@ -Subproject commit fbfd5071751044565238a85b867d532b5952bd69 +Subproject commit aaa20edeacd17e09989142e78b9295f57f3c0de5 diff --git a/Submodules/glTF b/Submodules/glTF index 9e4e73b1f..b3d994251 160000 --- a/Submodules/glTF +++ b/Submodules/glTF @@ -1 +1 @@ -Subproject commit 9e4e73b1ffca7f3cfe2443d95d319655b1ba51f6 +Subproject commit b3d99425120b75d4225906334de3078a84932a41 diff --git a/XRTK-Core/.editorconfig b/XRTK-Core/.editorconfig new file mode 100644 index 000000000..ac4472f0e --- /dev/null +++ b/XRTK-Core/.editorconfig @@ -0,0 +1,75 @@ +# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options + +# Remove the line below if you want to inherit .editorconfig settings from higher directories +root = true + +[*.cs] + +#### Core EditorConfig Options #### + +# Indentation and spacing +indent_size = 4 +indent_style = space +tab_width = 4 + +# New line preferences +end_of_line = crlf +insert_final_newline = true +trim_trailing_whitespace = true +csharp_new_line_before_catch = true +csharp_new_line_before_else = true +csharp_new_line_before_finally = true +csharp_new_line_before_open_brace = all + +# Modifier preferences +dotnet_style_require_accessibility_modifiers = for_non_interface_members:error + +# Code-block preferences +csharp_prefer_braces = true:error + +# Use language keywords for types +dotnet_style_predefined_type_for_member_access = true +dotnet_style_predefined_type_for_locals_parameters_members = true + +# Code Style +csharp_style_var_when_type_is_apparent = true + +#### Resharper/Rider Rules #### +# https://www.jetbrains.com/help/resharper/EditorConfig_Properties.html + +resharper_csharp_force_attribute_style=separate +csharp_place_field_attribute_on_same_line=false +csharp_place_accessorholder_attribute_on_same_line=false +csharp_trailing_comma_in_multiline_lists=false +csharp_trailing_comma_in_singleline_lists=false +csharp_keep_existing_attribute_arrangement=false +csharp_blank_lines_around_region=1 +csharp_blank_lines_inside_region=1 +csharp_keep_blank_lines_in_code=false +csharp_remove_blank_lines_near_braces_in_code=true +csharp_blank_lines_before_control_transfer_statements=1 +csharp_blank_lines_after_control_transfer_statements=1 +csharp_blank_lines_before_block_statements=1 +csharp_blank_lines_after_block_statements=1 +csharp_blank_lines_before_multiline_statements=1 +csharp_blank_lines_after_multiline_statements=1 +csharp_blank_lines_around_block_case_section=0 +csharp_blank_lines_around_multiline_case_section=0 +csharp_blank_lines_before_case=0 +csharp_blank_lines_after_case=0 +resharper_unity_duplicate_event_function_highlighting=error +resharper_unity_duplicate_shortcut_highlighting=error +resharper_unity_expected_component_highlighting=error +resharper_unity_explicit_tag_comparison_highlighting=error +resharper_unity_incorrect_mono_behaviour_instantiation_highlighting=error +resharper_unity_incorrect_scriptable_object_instantiation_highlighting=error +resharper_unity_no_null_coalescing_highlighting=error +resharper_unity_performance_critical_code_camera_main_highlighting=error +resharper_unity_performance_critical_code_invocation_highlighting=warning +resharper_unity_performance_critical_code_null_comparison_highlighting=warning +resharper_unity_possible_misapplication_of_attribute_to_multiple_fields_highlighting=error +resharper_unity_redundant_attribute_on_target_highlighting=error +resharper_unity_redundant_formerly_serialized_as_attribute_highlighting=error +resharper_unity_unresolved_component_or_scriptable_object_highlighting=error +resharper_use_name_of_instead_of_type_of_highlighting=error +resharper_wrong_public_modifier_specification_highlighting=error diff --git a/XRTK-Core/Packages/com.xrtk.core/Runtime/Extensions/UnityObjectExtensions.cs b/XRTK-Core/Packages/com.xrtk.core/Runtime/Extensions/UnityObjectExtensions.cs index 8d410b1f1..b1d509989 100644 --- a/XRTK-Core/Packages/com.xrtk.core/Runtime/Extensions/UnityObjectExtensions.cs +++ b/XRTK-Core/Packages/com.xrtk.core/Runtime/Extensions/UnityObjectExtensions.cs @@ -18,6 +18,7 @@ public static class UnityObjectExtensions public static void DontDestroyOnLoad(this Object @object) { #if UNITY_EDITOR + // ReSharper disable once EnforceIfStatementBraces if (UnityEditor.EditorApplication.isPlaying) #endif Object.DontDestroyOnLoad(@object); diff --git a/XRTK-Core/Packages/com.xrtk.core/Runtime/Utilities/Lines/DataProviders/BezierLineDataProvider.cs b/XRTK-Core/Packages/com.xrtk.core/Runtime/Utilities/Lines/DataProviders/BezierLineDataProvider.cs index 0ed576d2a..4ead7ad9d 100644 --- a/XRTK-Core/Packages/com.xrtk.core/Runtime/Utilities/Lines/DataProviders/BezierLineDataProvider.cs +++ b/XRTK-Core/Packages/com.xrtk.core/Runtime/Utilities/Lines/DataProviders/BezierLineDataProvider.cs @@ -145,10 +145,12 @@ protected override void SetPointInternal(int pointIndex, Vector3 point) localOffset = Vector3.zero; // If we're using local tangent points, apply this change to control point 2 if (useLocalTangentPoints) + { localOffset = point - controlPoints.Point1; + } controlPoints.Point1 = point; - controlPoints.Point2 = controlPoints.Point2 + localOffset; + controlPoints.Point2 += localOffset; break; case 1: controlPoints.Point2 = point; @@ -164,7 +166,7 @@ protected override void SetPointInternal(int pointIndex, Vector3 point) } controlPoints.Point4 = point; - controlPoints.Point3 = controlPoints.Point3 + localOffset; + controlPoints.Point3 += localOffset; break; } } @@ -195,4 +197,4 @@ protected override Vector3 GetUpVectorInternal(float normalizedLength) return transform.up; } } -} \ No newline at end of file +} diff --git a/XRTK-Core/Packages/com.xrtk.core/Runtime/Utilities/MathUtilities.cs b/XRTK-Core/Packages/com.xrtk.core/Runtime/Utilities/MathUtilities.cs index 07bf37f68..ee1dba36a 100644 --- a/XRTK-Core/Packages/com.xrtk.core/Runtime/Utilities/MathUtilities.cs +++ b/XRTK-Core/Packages/com.xrtk.core/Runtime/Utilities/MathUtilities.cs @@ -357,7 +357,9 @@ public static Vector3 NearestPointToLinesRANSAC(List rays, int ransac_itera for (int ind = 0; ind < rays.Count; ++ind) { if (DistanceOfPointToLine(rays[ind], testPoint) < ransac_threshold) + { ++numInliersForIteration; + } } // remember best @@ -454,4 +456,4 @@ public static float GetAngleBetween(Vector2 pointA, Vector2 pointB) return MathUtilities.RadiansToDegrees(Mathf.Atan2(diff.y, diff.x)); } } -} \ No newline at end of file +} diff --git a/XRTK-Core/Packages/com.xrtk.core/Tests/Services/ITestExtensionDataProvider1.cs b/XRTK-Core/Packages/com.xrtk.core/Tests/Services/ITestExtensionDataProvider1.cs index 19ab8814a..d7ee4d2cf 100644 --- a/XRTK-Core/Packages/com.xrtk.core/Tests/Services/ITestExtensionDataProvider1.cs +++ b/XRTK-Core/Packages/com.xrtk.core/Tests/Services/ITestExtensionDataProvider1.cs @@ -5,7 +5,7 @@ namespace XRTK.Tests.Services { - interface ITestExtensionDataProvider1 : IMixedRealityExtensionDataProvider, ITestService { } + internal interface ITestExtensionDataProvider1 : IMixedRealityExtensionDataProvider, ITestService { } - interface ITestExtensionDataProvider2 : IMixedRealityExtensionDataProvider, ITestService { } -} \ No newline at end of file + internal interface ITestExtensionDataProvider2 : IMixedRealityExtensionDataProvider, ITestService { } +}