Skip to content

Commit

Permalink
refs
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Feb 12, 2025
1 parent 07faa11 commit 0cbbc69
Show file tree
Hide file tree
Showing 3 changed files with 208 additions and 20 deletions.
213 changes: 199 additions & 14 deletions src/.editorconfig
Original file line number Diff line number Diff line change
@@ -1,23 +1,189 @@
root = true
# EditorConfig: http://EditorConfig.org

# top-most EditorConfig file

[*]
indent_style = space


[*.cs]
indent_size = 4
charset = utf-8

# Redundant accessor body
resharper_redundant_accessor_body_highlighting = error

# Replace with field keyword
resharper_replace_with_field_keyword_highlighting = error

# Replace with single call to Single(..)
resharper_replace_with_single_call_to_single_highlighting = error

# Replace with single call to SingleOrDefault(..)
resharper_replace_with_single_call_to_single_or_default_highlighting = error

# Replace with single call to LastOrDefault(..)
resharper_replace_with_single_call_to_last_or_default_highlighting = error

# Replace with single call to Last(..)
resharper_replace_with_single_call_to_last_highlighting = error

# Replace with single call to First(..)
resharper_replace_with_single_call_to_first_highlighting = error

# Replace with single call to FirstOrDefault(..)
resharper_replace_with_single_call_to_first_or_default_highlighting = error

# Replace with single call to Any(..)
resharper_replace_with_single_call_to_any_highlighting = error

# Replace with single call to Count(..)
resharper_replace_with_single_call_to_count_highlighting = error

# Declare types in namespaces
dotnet_diagnostic.CA1050.severity = none

# Use Literals Where Appropriate
dotnet_diagnostic.CA1802.severity = error

# Potentially misleading parameter name in lambda or local function
resharper_all_underscore_local_parameter_name_highlighting = none

# Redundant explicit collection creation in argument of 'params' parameter
resharper_redundant_explicit_params_array_creation_highlighting = error

# Do not initialize unnecessarily
dotnet_diagnostic.CA1805.severity = error

# Avoid unsealed attributes
dotnet_diagnostic.CA1813.severity = error

# Test for empty strings using string length
dotnet_diagnostic.CA1820.severity = none

# Remove empty finalizers
dotnet_diagnostic.CA1821.severity = error

# Mark members as static
dotnet_diagnostic.CA1822.severity = error

# Avoid unused private fields
dotnet_diagnostic.CA1823.severity = error

# Avoid zero-length array allocations
dotnet_diagnostic.CA1825.severity = error

# Use property instead of Linq Enumerable method
dotnet_diagnostic.CA1826.severity = error

# Do not use Count()/LongCount() when Any() can be used
dotnet_diagnostic.CA1827.severity = error
dotnet_diagnostic.CA1828.severity = error

# Use Length/Count property instead of Enumerable.Count method
dotnet_diagnostic.CA1829.severity = error

# Prefer strongly-typed Append and Insert method overloads on StringBuilder
dotnet_diagnostic.CA1830.severity = error

# Use AsSpan instead of Range-based indexers for string when appropriate
dotnet_diagnostic.CA1831.severity = error

# Use AsSpan instead of Range-based indexers for string when appropriate
dotnet_diagnostic.CA1831.severity = error
dotnet_diagnostic.CA1832.severity = error
dotnet_diagnostic.CA1833.severity = error

# Use StringBuilder.Append(char) for single character strings
dotnet_diagnostic.CA1834.severity = error

# Prefer IsEmpty over Count when available
dotnet_diagnostic.CA1836.severity = error

# Prefer IsEmpty over Count when available
dotnet_diagnostic.CA1836.severity = error

# Use Environment.ProcessId instead of Process.GetCurrentProcess().Id
dotnet_diagnostic.CA1837.severity = error

# Use Environment.ProcessPath instead of Process.GetCurrentProcess().MainModule.FileName
dotnet_diagnostic.CA1839.severity = error

# Use Environment.CurrentManagedThreadId instead of Thread.CurrentThread.ManagedThreadId
dotnet_diagnostic.CA1840.severity = error

# Prefer Dictionary Contains methods
dotnet_diagnostic.CA1841.severity = error

# Do not use WhenAll with a single task
dotnet_diagnostic.CA1842.severity = error

# Do not use WhenAll/WaitAll with a single task
dotnet_diagnostic.CA1842.severity = error
dotnet_diagnostic.CA1843.severity = error

# Use span-based 'string.Concat'
dotnet_diagnostic.CA1845.severity = error

# Prefer AsSpan over Substring
dotnet_diagnostic.CA1846.severity = error

# Use string.Contains(char) instead of string.Contains(string) with single characters
dotnet_diagnostic.CA1847.severity = error

# Prefer static HashData method over ComputeHash
dotnet_diagnostic.CA1850.severity = error

# Possible multiple enumerations of IEnumerable collection
dotnet_diagnostic.CA1851.severity = error

# Unnecessary call to Dictionary.ContainsKey(key)
dotnet_diagnostic.CA1853.severity = error

# Prefer the IDictionary.TryGetValue(TKey, out TValue) method
dotnet_diagnostic.CA1854.severity = error

# Use Span<T>.Clear() instead of Span<T>.Fill()
dotnet_diagnostic.CA1855.severity = error

# Incorrect usage of ConstantExpected attribute
dotnet_diagnostic.CA1856.severity = error

# The parameter expects a constant for optimal performance
dotnet_diagnostic.CA1857.severity = error

# Use StartsWith instead of IndexOf
dotnet_diagnostic.CA1858.severity = error

# Avoid using Enumerable.Any() extension method
dotnet_diagnostic.CA1860.severity = error

# Avoid constant arrays as arguments
dotnet_diagnostic.CA1861.severity = error

# Use the StringComparison method overloads to perform case-insensitive string comparisons
dotnet_diagnostic.CA1862.severity = error

# Prefer the IDictionary.TryAdd(TKey, TValue) method
dotnet_diagnostic.CA1864.severity = error

# Use string.Method(char) instead of string.Method(string) for string with single char
dotnet_diagnostic.CA1865.severity = error
dotnet_diagnostic.CA1866.severity = error
dotnet_diagnostic.CA1867.severity = error

# Unnecessary call to 'Contains' for sets
dotnet_diagnostic.CA1868.severity = error

# Cache and reuse 'JsonSerializerOptions' instances
dotnet_diagnostic.CA1869.severity = error

# Use a cached 'SearchValues' instance
dotnet_diagnostic.CA1870.severity = error

# Microsoft .NET properties
trim_trailing_whitespace = true
csharp_preferred_modifier_order = public, private, protected, internal, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async:suggestion
resharper_namespace_body = file_scoped
dotnet_naming_rule.private_constants_rule.severity = warning
dotnet_naming_rule.private_constants_rule.style = upper_camel_case_style
dotnet_naming_rule.private_constants_rule.style = lower_camel_case_style
dotnet_naming_rule.private_constants_rule.symbols = private_constants_symbols
dotnet_naming_rule.private_instance_fields_rule.severity = warning
dotnet_naming_rule.private_instance_fields_rule.style = lower_camel_case_style
Expand All @@ -26,7 +192,7 @@ dotnet_naming_rule.private_static_fields_rule.severity = warning
dotnet_naming_rule.private_static_fields_rule.style = lower_camel_case_style
dotnet_naming_rule.private_static_fields_rule.symbols = private_static_fields_symbols
dotnet_naming_rule.private_static_readonly_rule.severity = warning
dotnet_naming_rule.private_static_readonly_rule.style = upper_camel_case_style
dotnet_naming_rule.private_static_readonly_rule.style = lower_camel_case_style
dotnet_naming_rule.private_static_readonly_rule.symbols = private_static_readonly_symbols
dotnet_naming_style.lower_camel_case_style.capitalization = camel_case
dotnet_naming_style.upper_camel_case_style.capitalization = pascal_case
Expand All @@ -53,7 +219,7 @@ resharper_arrange_object_creation_when_type_evident_highlighting = error
resharper_arrange_object_creation_when_type_not_evident_highlighting = error
resharper_arrange_redundant_parentheses_highlighting = error
resharper_arrange_static_member_qualifier_highlighting = error
resharper_arrange_this_qualifier_highlighting = hint
resharper_arrange_this_qualifier_highlighting = error
resharper_arrange_type_member_modifiers_highlighting = none
resharper_built_in_type_reference_style_for_member_access_highlighting = hint
resharper_built_in_type_reference_style_highlighting = hint
Expand All @@ -64,7 +230,8 @@ resharper_field_can_be_made_read_only_local_highlighting = none
resharper_merge_into_logical_pattern_highlighting = warning
resharper_merge_into_pattern_highlighting = error
resharper_method_has_async_overload_highlighting = warning
resharper_partial_type_with_single_part_highlighting = error
# because stop rider giving errors before source generators have run
resharper_partial_type_with_single_part_highlighting = warning
resharper_redundant_base_qualifier_highlighting = warning
resharper_redundant_cast_highlighting = error
resharper_redundant_empty_object_creation_argument_list_highlighting = error
Expand All @@ -73,6 +240,7 @@ resharper_redundant_name_qualifier_highlighting = error
resharper_redundant_suppress_nullable_warning_expression_highlighting = error
resharper_redundant_using_directive_highlighting = error
resharper_redundant_verbatim_string_prefix_highlighting = error
resharper_redundant_lambda_signature_parentheses_highlighting = error
resharper_replace_substring_with_range_indexer_highlighting = warning
resharper_suggest_var_or_type_built_in_types_highlighting = error
resharper_suggest_var_or_type_elsewhere_highlighting = error
Expand All @@ -95,11 +263,11 @@ dotnet_style_predefined_type_for_locals_parameters_members = true:error
dotnet_style_predefined_type_for_member_access = true:error

# Suggest more modern language features when available
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_coalesce_expression = false:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_object_initializer = true:error
dotnet_style_collection_initializer = true:error
dotnet_style_coalesce_expression = false:error
dotnet_style_null_propagation = true:error
dotnet_style_explicit_tuple_names = true:error

# Prefer "var" everywhere
csharp_style_var_for_built_in_types = true:error
Expand Down Expand Up @@ -140,6 +308,9 @@ resharper_wrap_before_binary_pattern_op = false
resharper_wrap_object_and_collection_initializer_style = chop_always
resharper_place_simple_initializer_on_single_line = false

# space
resharper_space_around_lambda_arrow = true

dotnet_style_require_accessibility_modifiers = never:error
resharper_place_type_constraints_on_same_line = false
resharper_blank_lines_inside_namespace = 0
Expand All @@ -160,6 +331,10 @@ resharper_braces_for_lock = required
resharper_braces_for_fixed = required
resharper_braces_for_for = required

resharper_return_value_of_pure_method_is_not_used_highlighting = error

resharper_all_underscore_local_parameter_name_highlighting = none

# Xml files
[*.{xml,config,nuspec,resx,vsixmanifest,csproj,targets,props,fsproj}]
indent_size = 2
Expand All @@ -169,4 +344,14 @@ resharper_space_before_self_closing = true
ij_xml_space_inside_empty_tag = true

[*.json]
indent_size = 2
indent_size = 2

# Verify settings
[*.{received,verified}.{txt,xml,json,md,sql,csv,html,md}]
charset = "utf-8-bom"
end_of_line = lf
indent_size = unset
indent_style = unset
insert_final_newline = false
tab_width = unset
trim_trailing_whitespace = false
9 changes: 6 additions & 3 deletions src/Shared.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/Environment/Hierarchy/Build/SolutionBuilderNext/LogToFile/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/Environment/Hierarchy/Build/SolutionBuilderNext/OutputVerbosityLevel/@EntryValue">Quiet</s:String>
<s:Boolean x:Key="/Default/CodeEditing/ContextActionTable/DisabledContextActions/=JetBrains_002EReSharper_002EIntentions_002ECSharp_002EContextActions_002EUseConfigureAwaitFalseAction/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/ExcludedFiles/FileMasksToSkip/=_002AMigrations_002A/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/ExcludedFiles/FileMasksToSkip/=_002A_002EDesigner_002Ecs/@EntryIndexedValue">True</s:Boolean>
Expand Down Expand Up @@ -28,6 +30,7 @@
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MergeSequentialChecks/@EntryIndexedValue">ERROR</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=NotAccessedField_002ELocal/@EntryIndexedValue">ERROR</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=NotAccessedPositionalProperty_002ELocal/@EntryIndexedValue">ERROR</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantPatternParentheses/@EntryIndexedValue">ERROR</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=TailRecursiveCall/@EntryIndexedValue">ERROR</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=PatternIsAlwaysTrueOrFalse/@EntryIndexedValue">ERROR</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantAssignment/@EntryIndexedValue">ERROR</s:String>
Expand Down Expand Up @@ -123,8 +126,6 @@
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UseObjectOrCollectionInitializer/@EntryIndexedValue">ERROR</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=VariableHidesOuterVariable/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/JsInspections/LanguageLevel/@EntryValue">ECMAScript 2016</s:String>
<s:Boolean x:Key="/Default/CodeInspection/Roslyn/RoslynEnabled/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/Roslyn/UseRoslynInSwea/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=c_0023_0020Cleanup/@EntryIndexedValue">&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;Profile name="c# Cleanup"&gt;&lt;AspOptimizeRegisterDirectives&gt;True&lt;/AspOptimizeRegisterDirectives&gt;&lt;CSCodeStyleAttributes ArrangeVarStyle="True" ArrangeTypeAccessModifier="True" ArrangeTypeMemberAccessModifier="True" SortModifiers="True" RemoveRedundantParentheses="True" AddMissingParentheses="True" ArrangeBraces="True" ArrangeAttributes="True" ArrangeCodeBodyStyle="True" ArrangeTrailingCommas="True" ArrangeObjectCreation="True" ArrangeDefaultValue="True" ArrangeNamespaces="True" /&gt;&lt;CssAlphabetizeProperties&gt;True&lt;/CssAlphabetizeProperties&gt;&lt;JSStringLiteralQuotesDescriptor&gt;True&lt;/JSStringLiteralQuotesDescriptor&gt;&lt;CorrectVariableKindsDescriptor&gt;True&lt;/CorrectVariableKindsDescriptor&gt;&lt;VariablesToInnerScopesDescriptor&gt;True&lt;/VariablesToInnerScopesDescriptor&gt;&lt;StringToTemplatesDescriptor&gt;True&lt;/StringToTemplatesDescriptor&gt;&lt;JsInsertSemicolon&gt;True&lt;/JsInsertSemicolon&gt;&lt;RemoveRedundantQualifiersTs&gt;True&lt;/RemoveRedundantQualifiersTs&gt;&lt;OptimizeImportsTs&gt;True&lt;/OptimizeImportsTs&gt;&lt;OptimizeReferenceCommentsTs&gt;True&lt;/OptimizeReferenceCommentsTs&gt;&lt;PublicModifierStyleTs&gt;True&lt;/PublicModifierStyleTs&gt;&lt;ExplicitAnyTs&gt;True&lt;/ExplicitAnyTs&gt;&lt;TypeAnnotationStyleTs&gt;True&lt;/TypeAnnotationStyleTs&gt;&lt;RelativePathStyleTs&gt;True&lt;/RelativePathStyleTs&gt;&lt;AsInsteadOfCastTs&gt;True&lt;/AsInsteadOfCastTs&gt;&lt;RemoveCodeRedundancies&gt;True&lt;/RemoveCodeRedundancies&gt;&lt;CSUseAutoProperty&gt;True&lt;/CSUseAutoProperty&gt;&lt;CSMakeFieldReadonly&gt;True&lt;/CSMakeFieldReadonly&gt;&lt;CSMakeAutoPropertyGetOnly&gt;True&lt;/CSMakeAutoPropertyGetOnly&gt;&lt;CSArrangeQualifiers&gt;True&lt;/CSArrangeQualifiers&gt;&lt;CSFixBuiltinTypeReferences&gt;True&lt;/CSFixBuiltinTypeReferences&gt;&lt;CssReformatCode&gt;True&lt;/CssReformatCode&gt;&lt;JsReformatCode&gt;True&lt;/JsReformatCode&gt;&lt;JsFormatDocComments&gt;True&lt;/JsFormatDocComments&gt;&lt;CSOptimizeUsings&gt;&lt;OptimizeUsings&gt;True&lt;/OptimizeUsings&gt;&lt;/CSOptimizeUsings&gt;&lt;CSShortenReferences&gt;True&lt;/CSShortenReferences&gt;&lt;CSReformatCode&gt;True&lt;/CSReformatCode&gt;&lt;CSharpFormatDocComments&gt;True&lt;/CSharpFormatDocComments&gt;&lt;FormatAttributeQuoteDescriptor&gt;True&lt;/FormatAttributeQuoteDescriptor&gt;&lt;HtmlReformatCode&gt;True&lt;/HtmlReformatCode&gt;&lt;XAMLCollapseEmptyTags&gt;False&lt;/XAMLCollapseEmptyTags&gt;&lt;IDEA_SETTINGS&gt;&amp;lt;profile version="1.0"&amp;gt;&#xD;
&amp;lt;option name="myName" value="c# Cleanup" /&amp;gt;&#xD;
&amp;lt;/profile&amp;gt;&lt;/IDEA_SETTINGS&gt;&lt;RIDER_SETTINGS&gt;&amp;lt;profile&amp;gt;&#xD;
Expand Down Expand Up @@ -155,8 +156,9 @@
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_ACCESSORHOLDER_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ANONYMOUSMETHOD_ON_SINGLE_LINE/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_BEFORE_BINARY_OPSIGN/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_BEFORE_BINARY_PATTERN_OP/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_BEFORE_FIRST_METHOD_CALL/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_CHAINED_METHOD_CALLS/@EntryValue">CHOP_ALWAYS</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_LINES/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_MULTIPLE_TYPE_PARAMEER_CONSTRAINTS_STYLE/@EntryValue">CHOP_ALWAYS</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/JavaScriptCodeFormatting/WRAP_LINES/@EntryValue">False</s:Boolean>
Expand All @@ -170,4 +172,5 @@
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SimplifyLinqExpressionUseMinByAndMaxBy/@EntryIndexedValue">ERROR</s:String>
<s:String x:Key="/Default/Housekeeping/UnitTestingMru/UnitTestRunner/SpawnedProcessesResponse/@EntryValue">DoNothing</s:String>
</wpf:ResourceDictionary>
6 changes: 3 additions & 3 deletions src/Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageReference Include="Xunit" Version="2.9.3" />
<PackageReference Include="XunitContext" Version="3.3.2" />
<PackageReference Include="MarkdownSnippets.MsBuild" Version="27.0.2" />
<PackageReference Include="Verify.Xunit" Version="28.8.1" />
<PackageReference Include="Verify.Xunit" Version="28.10.1" />
<ProjectReference Include="..\HandlerOrdering\NServiceBus.HandlerOrdering.csproj" />
<PackageReference Include="ProjectDefaults" Version="1.0.147" PrivateAssets="all" />
</ItemGroup>
Expand Down

0 comments on commit 0cbbc69

Please sign in to comment.