Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Added .editorconfig to help keep project in compliance with coding guidelines #818

Merged
merged 1 commit into from
Apr 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Submodules/Oculus
2 changes: 1 addition & 1 deletion Submodules/SDK
Submodule SDK updated from fbfd50 to aaa20e
2 changes: 1 addition & 1 deletion Submodules/glTF
Submodule glTF updated from 9e4e73 to b3d994
75 changes: 75 additions & 0 deletions XRTK-Core/.editorconfig
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -164,7 +166,7 @@ protected override void SetPointInternal(int pointIndex, Vector3 point)
}

controlPoints.Point4 = point;
controlPoints.Point3 = controlPoints.Point3 + localOffset;
controlPoints.Point3 += localOffset;
break;
}
}
Expand Down Expand Up @@ -195,4 +197,4 @@ protected override Vector3 GetUpVectorInternal(float normalizedLength)
return transform.up;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,9 @@ public static Vector3 NearestPointToLinesRANSAC(List<Ray> rays, int ransac_itera
for (int ind = 0; ind < rays.Count; ++ind)
{
if (DistanceOfPointToLine(rays[ind], testPoint) < ransac_threshold)
{
++numInliersForIteration;
}
}

// remember best
Expand Down Expand Up @@ -454,4 +456,4 @@ public static float GetAngleBetween(Vector2 pointA, Vector2 pointB)
return MathUtilities.RadiansToDegrees(Mathf.Atan2(diff.y, diff.x));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace XRTK.Tests.Services
{
interface ITestExtensionDataProvider1 : IMixedRealityExtensionDataProvider, ITestService { }
internal interface ITestExtensionDataProvider1 : IMixedRealityExtensionDataProvider, ITestService { }

interface ITestExtensionDataProvider2 : IMixedRealityExtensionDataProvider, ITestService { }
}
internal interface ITestExtensionDataProvider2 : IMixedRealityExtensionDataProvider, ITestService { }
}