Skip to content

Commit e5cd612

Browse files
authored
VS-168: Update analyzer rules (#92)
1 parent 56acd53 commit e5cd612

File tree

5 files changed

+15
-9
lines changed

5 files changed

+15
-9
lines changed

src/MongoDB.Analyzer/AnalyzerReleases.Shipped.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@ MABuilders1001 | MongoDB.Analyzer.Builders | Info | Builders expression to MQL [
88
MABuilders2001 | MongoDB.Analyzer.Builders | Warning | Unsupported builders expression [Documentation](https://www.mongodb.com/docs/mongodb-analyzer/current/rules/#mabuilders2001)
99
MALinq1001 | MongoDB.Analyzer.LINQ | Info | LINQ expression to MQL [Documentation](https://www.mongodb.com/docs/mongodb-analyzer/current/rules/#malinq1001)
1010
MALinq2001 | MongoDB.Analyzer.LINQ | Warning | Unsupported LINQ expression [Documentation](https://www.mongodb.com/docs/mongodb-analyzer/current/rules/#malinq2001)
11-
MALinq2002 | MongoDB.Analyzer.LINQ | Warning | Supported only in LINQ3 expression [Documentation](https://www.mongodb.com/docs/mongodb-analyzer/current/rules/#malinq2002)
1211

1312
## Release 1.3.0
1413

1514
### New Rules
1615

1716
Rule ID | Category | Severity | Notes
1817
--------|----------|----------|--------------------
19-
MAPoco1001 | MongoDB.Analyzer.Poco | Info | Poco to Json [Documentation](https://www.mongodb.com/docs/mongodb-analyzer/current/rules/#mapoco1001)
18+
MAPoco1001 | MongoDB.Analyzer.Poco | Info | POCO to JSON [Documentation](https://www.mongodb.com/docs/mongodb-analyzer/current/rules/#mapoco1001)
2019
MAPoco2001 | MongoDB.Analyzer.Poco | Warning | Unsupported POCO [Documentation](https://www.mongodb.com/docs/mongodb-analyzer/current/rules/#mapoco2001)
2120

2221
## Release 1.5.0
@@ -27,3 +26,11 @@ Rule ID | Category | Severity | Notes
2726
--------|----------|----------|--------------------
2827
MAEF1001 | MongoDB.Analyzer.EF | Info | EF to MQL [Documentation](https://www.mongodb.com/docs/mongodb-analyzer/current/rules/#maef1001)
2928
MAEF2001 | MongoDB.Analyzer.EF | Warning | Unsupported EF [Documentation](https://www.mongodb.com/docs/mongodb-analyzer/current/rules/#maef2001)
29+
30+
## Release 2.0.0
31+
32+
### Removed Rules
33+
34+
Rule ID | Category | Severity | Notes
35+
--------|----------|----------|--------------------
36+
MALinq2002 | MongoDB.Analyzer.LINQ | Warning | Supported only in LINQ3 expression [Documentation](https://www.mongodb.com/docs/mongodb-analyzer/current/rules/#malinq2002)
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
; Unshipped analyzer release
2-
; https://github.com/dotnet/roslyn-analyzers/blob/master/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md

src/MongoDB.Analyzer/Core/Builders/BuildersMqlGeneratorExecutor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public MQLResult GenerateMql(string methodName)
4040
{
4141
var mqlMethod = _testClassType.GetMethod(methodName);
4242

43-
var executeResult = mqlMethod.Invoke(null, new object[] { });
43+
var executeResult = mqlMethod.Invoke(null, []);
4444

4545
if (executeResult is string executeResultString)
4646
{
@@ -59,7 +59,7 @@ private string GetDriverVersion()
5959
{
6060
try
6161
{
62-
return (string)_testClassType.GetMethod(MqlGeneratorSyntaxElements.Builders.GetDriverVersion).Invoke(null, new object[] { });
62+
return (string)_testClassType.GetMethod(MqlGeneratorSyntaxElements.Builders.GetDriverVersion).Invoke(null, []);
6363
}
6464
catch { }
6565

src/MongoDB.Analyzer/Core/Logger.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public Logger(string fileName, string correlationId)
3131
{
3232
_correlationId = correlationId;
3333
_fileName = fileName;
34-
_logs = new List<string>();
34+
_logs = [];
3535
}
3636

3737
public void Dispose()

src/MongoDB.Analyzer/Core/Telemetry/AnalysisTelemetry.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ internal record AnalysisTelemetry(
2828
public static AnalysisTelemetry Invalid = new(-1, -1, null, null, -1, -1, -1, -1, -1);
2929
public static AnalysisTelemetry Empty = new(0, 0, null, null, -1, -1, -1, -1, -1);
3030

31-
public (string, object)[] ToKeyValues() => new (string, object)[]
32-
{
31+
public (string, object)[] ToKeyValues() =>
32+
[
3333
("expressions_found_count", ExpressionsFound),
3434
("data_types_count", DataTypesCount),
3535
("driver_version", DriverVersion),
@@ -38,5 +38,5 @@ internal record AnalysisTelemetry(
3838
("driver_exception_count", DriverExceptionCount),
3939
("internal_exception_count", InternalExceptionCount),
4040
("duration_ms", DurationMS)
41-
};
41+
];
4242
}

0 commit comments

Comments
 (0)