Skip to content

Commit 934357d

Browse files
committed
Merge branch 'main' of https://github.com/IntelliTect/CodingGuidelines into joeriddles/fix-datetime-linter
2 parents 1382ea5 + 8b3eb47 commit 934357d

28 files changed

Lines changed: 245 additions & 161 deletions

.github/dependabot.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,8 @@ updates:
99
directory: "/" # Location of package manifests
1010
schedule:
1111
interval: "weekly"
12+
13+
- package-ecosystem: "bundler"
14+
directory: "/docs"
15+
schedule:
16+
interval: "weekly"

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<PropertyGroup>
33
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
4-
<LangVersion>11.0</LangVersion>
4+
<LangVersion>12.0</LangVersion>
55
</PropertyGroup>
66
</Project>

Directory.Packages.props

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<Project>
2+
<PropertyGroup>
3+
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
4+
<CentralPackageTransitivePinningEnabled>false</CentralPackageTransitivePinningEnabled>
5+
</PropertyGroup>
6+
<ItemGroup>
7+
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
8+
<PackageVersion Include="IntelliTect.Analyzers" Version="0.1.8" />
9+
<PackageVersion Include="Microsoft.Build.Locator" Version="1.6.10" />
10+
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" />
11+
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
12+
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.8.0" />
13+
<PackageVersion Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0" />
14+
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.8.0" />
15+
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.8.0" />
16+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
17+
<PackageVersion Include="MSTest.TestAdapter" Version="3.1.1" />
18+
<PackageVersion Include="MSTest.TestFramework" Version="3.1.1" />
19+
<PackageVersion Include="System.CommandLine.DragonFruit" Version="0.4.0-alpha.23407.1" />
20+
</ItemGroup>
21+
</Project>

IntelliTect.Analyzer.sln

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.29020.237
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.9.34407.89
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntelliTect.Analyzer", "IntelliTect.Analyzer\IntelliTect.Analyzer\IntelliTect.Analyzer.csproj", "{B21556AE-ABCF-41F9-8585-3C32DE919638}"
77
EndProject
@@ -12,6 +12,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1212
.editorconfig = .editorconfig
1313
azure-pipelines.yml = azure-pipelines.yml
1414
Directory.Build.props = Directory.Build.props
15+
NuGet.config = NuGet.config
1516
README.md = README.md
1617
EndProjectSection
1718
EndProject

IntelliTect.Analyzer/IntelliTect.Analyzer.Integration.Tests/AnalyzerTests.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ await ProcessProject(new FileInfo(Path.Combine("..", "..", "..", "..", "IntelliT
2929

3030
public static async Task ProcessProject(FileInfo projectFile)
3131
{
32-
if (projectFile is null)
33-
{
34-
throw new ArgumentNullException(nameof(projectFile));
35-
}
32+
ArgumentNullException.ThrowIfNull(projectFile);
3633

3734
using var workspace = MSBuildWorkspace.Create();
3835
Project project = await workspace.OpenProjectAsync(projectFile.FullName).ConfigureAwait(false);

IntelliTect.Analyzer/IntelliTect.Analyzer.Integration.Tests/IntelliTect.Analyzer.Integration.Tests.csproj

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
55
<IsPackable>false</IsPackable>
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
10-
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
11-
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
12-
<PackageReference Include="coverlet.collector" Version="6.0.0">
9+
<PackageReference Include="Microsoft.NET.Test.Sdk" />
10+
<PackageReference Include="MSTest.TestAdapter" />
11+
<PackageReference Include="MSTest.TestFramework" />
12+
<PackageReference Include="coverlet.collector">
1313
<PrivateAssets>all</PrivateAssets>
1414
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1515
</PackageReference>
1616

17-
<PackageReference Include="Microsoft.Build.Locator" Version="1.6.10" />
18-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
19-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.8.0" />
20-
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.8.0" />
21-
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.8.0" />
22-
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4">
17+
<PackageReference Include="Microsoft.Build.Locator" />
18+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" />
19+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" />
20+
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" />
21+
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" />
22+
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers">
2323
<PrivateAssets>all</PrivateAssets>
2424
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2525
</PackageReference>

IntelliTect.Analyzer/IntelliTect.Analyzer.Test/AsyncVoidTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ public async void Sample() { }
5656
Message = "Async methods should not return void",
5757
Severity = DiagnosticSeverity.Warning,
5858
Locations =
59-
new[] {
59+
[
6060
new DiagnosticResultLocation("Test0.cs", 13, 31)
61-
}
61+
]
6262
};
6363

6464
VerifyCSharpDiagnostic(test, expected);

IntelliTect.Analyzer/IntelliTect.Analyzer.Test/AttributesOnSeparateLinesTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,9 +398,9 @@ private static DiagnosticResult GetExpectedDiagnosticResult(int line, int col)
398398
Message = "Attributes should be on separate lines",
399399
Severity = DiagnosticSeverity.Warning,
400400
Locations =
401-
new[] {
401+
[
402402
new DiagnosticResultLocation("Test0.cs", line, col)
403-
}
403+
]
404404
};
405405
}
406406

IntelliTect.Analyzer/IntelliTect.Analyzer.Test/DateTimeConversionTests.cs

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ static void Main(string[] args)
3333
Id = "INTL0202",
3434
Severity = DiagnosticSeverity.Warning,
3535
Message = "Using the symbol 'DateTimeOffset.implicit operator DateTimeOffset(DateTime)' can result in unpredictable behavior",
36-
Locations =
37-
new[] {
38-
new DiagnosticResultLocation("Test0.cs", 10, 38)
39-
}
36+
Locations = [new DiagnosticResultLocation("Test0.cs", 10, 38)]
4037
});
4138

4239
}
@@ -67,10 +64,7 @@ static void Main(string[] args)
6764
Id = "INTL0202",
6865
Severity = DiagnosticSeverity.Warning,
6966
Message = "Using the symbol 'DateTimeOffset.implicit operator DateTimeOffset(DateTime)' can result in unpredictable behavior",
70-
Locations =
71-
new[] {
72-
new DiagnosticResultLocation("Test0.cs", 13, 17)
73-
}
67+
Locations = [new DiagnosticResultLocation("Test0.cs", 17, 17)]
7468
});
7569

7670
}
@@ -101,10 +95,7 @@ static void Main(string[] args)
10195
Id = "INTL0202",
10296
Severity = DiagnosticSeverity.Warning,
10397
Message = "Using the symbol 'DateTimeOffset.implicit operator DateTimeOffset(DateTime)' can result in unpredictable behavior",
104-
Locations =
105-
new[] {
106-
new DiagnosticResultLocation("Test0.cs", 13, 25)
107-
}
98+
Locations = [new DiagnosticResultLocation("Test0.cs", 13, 25)]
10899
});
109100

110101
}
@@ -136,9 +127,7 @@ static void Main(string[] args)
136127
Id = "INTL0202",
137128
Severity = DiagnosticSeverity.Warning,
138129
Message = "Using the symbol 'DateTimeOffset.implicit operator DateTimeOffset(DateTime)' can result in unpredictable behavior",
139-
Locations = new[] {
140-
new DiagnosticResultLocation("Test0.cs", 13, 25)
141-
}
130+
Locations = [new DiagnosticResultLocation("Test0.cs", 13, 25)]
142131
}
143132
);
144133

@@ -158,10 +147,7 @@ public void UsageOfImplicitConversion_InLinq_ProducesWarningMessage()
158147
Id = "INTL0202",
159148
Severity = DiagnosticSeverity.Warning,
160149
Message = "Using the symbol 'DateTimeOffset.implicit operator DateTimeOffset(DateTime)' can result in unpredictable behavior",
161-
Locations =
162-
new[] {
163-
new DiagnosticResultLocation("Test0.cs", 17, 25)
164-
}
150+
Locations = [new DiagnosticResultLocation("Test0.cs", 17, 25)]
165151
}
166152
);
167153
}

IntelliTect.Analyzer/IntelliTect.Analyzer.Test/FavorEnumeratorDirectoryCallsTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ static void Main(string[] args)
3737
Severity = DiagnosticSeverity.Info,
3838
Message = "Favor using the method `EnumerateFiles` over the `GetFiles` method",
3939
Locations =
40-
new[] {
40+
[
4141
new DiagnosticResultLocation("Test0.cs", 11, 30)
42-
}
42+
]
4343
});
4444
}
4545

@@ -105,9 +105,9 @@ static void Main(string[] args)
105105
Severity = DiagnosticSeverity.Info,
106106
Message = "Favor using the method `EnumerateDirectories` over the `GetDirectories` method",
107107
Locations =
108-
new[] {
108+
[
109109
new DiagnosticResultLocation("Test0.cs", 11, 30)
110-
}
110+
]
111111
});
112112
}
113113

0 commit comments

Comments
 (0)