Skip to content

Commit e8da95f

Browse files
committed
Refactored to a single IMetadataService instead of separate interfaces
Added Steamworks SDK binaries for Linux and MacOS Updated all dependencies to their latest .NET 8 supported version Fixed a lot of code errors, warnings and suggestions.
1 parent 83b4396 commit e8da95f

File tree

92 files changed

+1300
-2289
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+1300
-2289
lines changed

.editorconfig

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
root = true
2+
13
[*.*]
24
dotnet_analyzer_diagnostic.severity = default
35

@@ -186,7 +188,7 @@ dotnet_style_null_propagation = true:suggestion
186188
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
187189
dotnet_style_prefer_auto_properties = true:silent
188190
dotnet_style_object_initializer = true:suggestion
189-
dotnet_style_collection_initializer = true:suggestion
191+
dotnet_style_collection_initializer = true:silent
190192
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
191193
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
192194
dotnet_style_prefer_conditional_expression_over_return = true:silent
@@ -211,7 +213,7 @@ dotnet_style_qualification_for_property = false:silent
211213
dotnet_style_qualification_for_field = false:silent
212214
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
213215
dotnet_style_qualification_for_event = false:silent
214-
dotnet_style_prefer_collection_expression = true:suggestion
216+
dotnet_style_prefer_collection_expression = when_types_exactly_match:silent
215217
tab_width = 4
216218
indent_size = 4
217219
end_of_line = crlf
@@ -282,6 +284,7 @@ dotnet_diagnostic.IDE0039.severity = suggestion #local method
282284
dotnet_diagnostic.IDE0042.severity = suggestion #desconstruct tuple
283285
dotnet_diagnostic.IDE0045.severity = suggestion #simplified if
284286
dotnet_diagnostic.IDE0046.severity = none #simplified if return
287+
dotnet_diagnostic.IDE0051.severity = error #unused private field
285288
dotnet_diagnostic.IDE0057.severity = suggestion #substring range operator
286289
dotnet_diagnostic.IDE0058.severity = none #discard return value
287290
dotnet_diagnostic.IDE0063.severity = suggestion #using statement
@@ -294,6 +297,12 @@ dotnet_diagnostic.IDE0220.severity = suggestion #foreach explicit cast
294297
dotnet_diagnostic.IDE0240.severity = silent #nullable directive
295298
dotnet_diagnostic.IDE0270.severity = suggestion #simplified null-check
296299
dotnet_diagnostic.IDE0290.severity = none #primary constructor
300+
dotnet_diagnostic.IDE0300.severity = none #simplified collection initialization
301+
dotnet_diagnostic.IDE0301.severity = none #simplified collection initialization
302+
dotnet_diagnostic.IDE0302.severity = none #simplified collection initialization
303+
dotnet_diagnostic.IDE0303.severity = none #simplified collection initialization
304+
dotnet_diagnostic.IDE0304.severity = none #simplified collection initialization
305+
dotnet_diagnostic.IDE0305.severity = none #simplified collection initialization
297306
dotnet_diagnostic.IDE1006.severity = error #naming rules
298307
dotnet_diagnostic.IDE2006.severity = none #blank line arrow expression
299308

@@ -305,4 +314,11 @@ dotnet_diagnostic.CA1052.severity = error #static class
305314
dotnet_diagnostic.CA1725.severity = error #base implementation names
306315
dotnet_diagnostic.CA1849.severity = error #always async
307316
dotnet_diagnostic.CA1851.severity = warning #multiple enumerations
308-
dotnet_diagnostic.CA2000.severity = warning #always dispose
317+
dotnet_diagnostic.CA2000.severity = warning #always dispose
318+
319+
# Resharper
320+
resharper_unused_auto_property_accessor_global_highlighting = hint
321+
resharper_unused_auto_property_accessor_local_highlighting = hint
322+
resharper_property_can_be_made_init_only_global_highlighting = hint
323+
resharper_property_can_be_made_init_only_local_highlighting = hint
324+
csharp_place_attribute_on_same_line = never

Cobra.sln.DotSettings

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
<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">
2+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertConstructorToMemberInitializers/@EntryIndexedValue">DO_NOT_SHOW</s:String>
3+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UseCollectionExpression/@EntryIndexedValue">DO_NOT_SHOW</s:String>
24
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=DLC/@EntryIndexedValue">DLC</s:String>
35
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IOI/@EntryIndexedValue">IOI</s:String>
46
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IP/@EntryIndexedValue">IP</s:String>
57
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=OS/@EntryIndexedValue">OS</s:String>
8+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=OSUID/@EntryIndexedValue">OSUID</s:String>
69
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=UTC/@EntryIndexedValue">UTC</s:String>
710
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=VAC/@EntryIndexedValue">VAC</s:String>
811

Src/Cobra.Analyzer/CO0001SingleLineCommentMustNotBeginWithSpace.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace Cobra.Analyzer
1111
[DiagnosticAnalyzer(LanguageNames.CSharp)]
1212
internal class CO0001SingleLineCommentMustNotBeginWithSpace : DiagnosticAnalyzer
1313
{
14-
public const string DiagnosticId = "CO0001";
14+
private const string DiagnosticId = "CO0001";
1515

1616
private static readonly LocalizableString _title = new LocalizableResourceString(
1717
nameof(Resources.CO0001Title), Resources.ResourceManager, typeof(Resources)

Src/Cobra.Analyzer/CO0002BlankLineAtEndOfFile.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ namespace Cobra.Analyzer
1111
[DiagnosticAnalyzer(LanguageNames.CSharp)]
1212
internal class CO0002BlankLineAtEndOfFile : DiagnosticAnalyzer
1313
{
14-
public const string DiagnosticId = "CO0002";
14+
private const string DiagnosticId = "CO0002";
1515

1616
private static readonly LocalizableString _title = new LocalizableResourceString(
1717
nameof(Resources.CO0002Title), Resources.ResourceManager, typeof(Resources)
1818
);
1919

20-
internal static readonly DiagnosticDescriptor Descriptor = new DiagnosticDescriptor(
20+
private static readonly DiagnosticDescriptor _descriptor = new DiagnosticDescriptor(
2121
DiagnosticId,
2222
_title,
2323
_title,
@@ -28,7 +28,7 @@ internal class CO0002BlankLineAtEndOfFile : DiagnosticAnalyzer
2828

2929
private static readonly Action<SyntaxTreeAnalysisContext> _syntaxTreeAction = HandleSyntaxTree;
3030

31-
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = ImmutableArray.Create(Descriptor);
31+
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = ImmutableArray.Create(_descriptor);
3232

3333
public override void Initialize(AnalysisContext context)
3434
{
@@ -60,7 +60,7 @@ private static void HandleSyntaxTree(SyntaxTreeAnalysisContext context)
6060
return;
6161
}
6262

63-
context.ReportDiagnostic(Diagnostic.Create(Descriptor, endOfFileToken.GetLocation()));
63+
context.ReportDiagnostic(Diagnostic.Create(_descriptor, endOfFileToken.GetLocation()));
6464
}
6565
}
6666
}

Src/Cobra.Analyzer/CO0003BlankLineAfterClosingBrace.cs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ namespace Cobra.Analyzer
1515
[DiagnosticAnalyzer(LanguageNames.CSharp)]
1616
internal class CO0003BlankLineAfterClosingBrace : DiagnosticAnalyzer
1717
{
18-
public const string DiagnosticId = "CO0003";
18+
private const string DiagnosticId = "CO0003";
1919

2020
private const SyntaxKind InitKeyword = (SyntaxKind)8443;
2121

2222
private static readonly LocalizableString _title = new LocalizableResourceString(
2323
nameof(Resources.CO0003Title), Resources.ResourceManager, typeof(Resources)
2424
);
2525

26-
internal static readonly DiagnosticDescriptor Descriptor = new DiagnosticDescriptor(
26+
private static readonly DiagnosticDescriptor _descriptor = new DiagnosticDescriptor(
2727
DiagnosticId,
2828
_title,
2929
_title,
@@ -34,7 +34,7 @@ internal class CO0003BlankLineAfterClosingBrace : DiagnosticAnalyzer
3434

3535
private static readonly Action<SyntaxTreeAnalysisContext> _syntaxTreeAction = HandleSyntaxTree;
3636

37-
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = ImmutableArray.Create(Descriptor);
37+
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = ImmutableArray.Create(_descriptor);
3838

3939
public override void Initialize(AnalysisContext context)
4040
{
@@ -236,7 +236,7 @@ private void AnalyzeCloseBrace(SyntaxToken token)
236236
if (nextToken.IsKind(SyntaxKind.CommaToken) || nextToken.IsKind(SyntaxKind.CloseParenToken))
237237
{
238238
// The close brace is the end of an object initializer, anonymous function, lambda expression, etc.
239-
// Comma and close parenthesis never requires a preceeding blank line.
239+
// Comma and close parenthesis never requires a preceding blank line.
240240
return;
241241
}
242242

@@ -248,7 +248,7 @@ private void AnalyzeCloseBrace(SyntaxToken token)
248248

249249
if (nextToken.IsKind(SyntaxKind.AddKeyword)
250250
|| nextToken.IsKind(SyntaxKind.RemoveKeyword)
251-
|| nextToken.IsKind(SyntaxKind.GetKeyword)
251+
|| nextToken.IsKind(SyntaxKind.GetKeyword)
252252
|| nextToken.IsKind(SyntaxKind.SetKeyword)
253253
|| nextToken.IsKind(InitKeyword))
254254
{
@@ -257,8 +257,8 @@ private void AnalyzeCloseBrace(SyntaxToken token)
257257
}
258258

259259
if ((nextToken.IsKind(SyntaxKind.PrivateKeyword)
260-
|| nextToken.IsKind(SyntaxKind.ProtectedKeyword)
261-
|| nextToken.IsKind(SyntaxKind.InternalKeyword))
260+
|| nextToken.IsKind(SyntaxKind.ProtectedKeyword)
261+
|| nextToken.IsKind(SyntaxKind.InternalKeyword))
262262
&& (nextToken.Parent is AccessorDeclarationSyntax))
263263
{
264264
// the close brace is followed by an accessor with an accessibility restriction.
@@ -280,13 +280,15 @@ private void AnalyzeCloseBrace(SyntaxToken token)
280280

281281
var location = Location.Create(_context.Tree, TextSpan.FromBounds(token.Span.End, nextToken.FullSpan.Start));
282282

283-
_context.ReportDiagnostic(Diagnostic.Create(Descriptor, location));
283+
_context.ReportDiagnostic(Diagnostic.Create(_descriptor, location));
284284
}
285285

286286
private bool IsOnSameLineAsOpeningBrace(SyntaxToken closeBrace)
287287
{
288288
var matchingOpenBrace = _bracesStack.Peek();
289-
return matchingOpenBrace.SyntaxTree.GetLineSpan(matchingOpenBrace.Span).EndLinePosition.Line == closeBrace.SyntaxTree.GetLineSpan(closeBrace.Span).StartLinePosition.Line;
289+
290+
return matchingOpenBrace.SyntaxTree != null && closeBrace.SyntaxTree != null &&
291+
matchingOpenBrace.SyntaxTree.GetLineSpan(matchingOpenBrace.Span).EndLinePosition.Line == closeBrace.SyntaxTree.GetLineSpan(closeBrace.Span).StartLinePosition.Line;
290292
}
291293
}
292294
}

Src/Cobra.Analyzer/Cobra.Analyzer.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4">
11+
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0">
1212
<PrivateAssets>all</PrivateAssets>
1313
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1414
</PackageReference>
15-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.7.0" />
16-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.7.0" />
15+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.11.0" />
1716
</ItemGroup>
1817

1918
<ItemGroup>

Src/Cobra.Analyzer/Resources.Designer.cs

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Src/Cobra.Analyzer/Resources.resx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- ReSharper disable once DuplicateResource -->
23
<root>
34
<!--
45
Microsoft ResX Schema

0 commit comments

Comments
 (0)