Skip to content
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
6 changes: 3 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion

# Types: use keywords instead of BCL types, and permit var only when the type is clear
csharp_style_var_for_built_in_types = false:suggestion
csharp_style_var_when_type_is_apparent = false:none
csharp_style_var_elsewhere = false:suggestion
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:none
csharp_style_var_elsewhere = true:suggestion
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ private static IEnumerable<Diagnostic> GetNewDiagnostics(IEnumerable<Diagnostic>
var oldArray = diagnostics.OrderBy(d => d.Location.SourceSpan.Start).ToArray();
var newArray = newDiagnostics.OrderBy(d => d.Location.SourceSpan.Start).ToArray();

int oldIndex = 0;
int newIndex = 0;
var oldIndex = 0;
var newIndex = 0;

while (newIndex < newArray.Length)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public bool Equals(DiagnosticResult other) =>
/// <inheritdoc/>
public override int GetHashCode()
{
int hashCode = 1054991603;
var hashCode = 1054991603;
hashCode = (hashCode * -1521134295) + EqualityComparer<IList<DiagnosticResultLocation>>.Default.GetHashCode(_locations);
hashCode = (hashCode * -1521134295) + EqualityComparer<IList<DiagnosticResultLocation>>.Default.GetHashCode(Locations);
hashCode = (hashCode * -1521134295) + Severity.GetHashCode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ private static Document[] GetDocuments(string[] sources, string language)
/// <returns>A Project created out of the Documents created from the source strings.</returns>
private static Project? CreateProject(string[] sources, string language = LanguageNames.CSharp)
{
string fileNamePrefix = DefaultFilePathPrefix;
string fileExt = language == LanguageNames.CSharp ? CSharpDefaultFileExt : VisualBasicDefaultExt;
var fileNamePrefix = DefaultFilePathPrefix;
var fileExt = language == LanguageNames.CSharp ? CSharpDefaultFileExt : VisualBasicDefaultExt;

var projectId = ProjectId.CreateNewId(debugName: TestProjectName);

Expand All @@ -163,7 +163,7 @@ private static Document[] GetDocuments(string[] sources, string language)
.AddMetadataReference(projectId, ReactiveUi)
.AddMetadataReference(projectId, ReactiveUiHelper);

int count = 0;
var count = 0;
foreach (var source in sources)
{
var newFileName = fileNamePrefix + count + "." + fileExt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,20 @@ public abstract partial class DiagnosticVerifier
/// <param name="expectedResults">Diagnostic Results that should have appeared in the code.</param>
private static void VerifyDiagnosticResults(IEnumerable<Diagnostic> actualResults, DiagnosticAnalyzer analyzer, params DiagnosticResult[] expectedResults)
{
int expectedCount = expectedResults.Length;
var expectedCount = expectedResults.Length;
var actualCountList = actualResults.ToList();
int actualCount = actualCountList.Count;
var actualCount = actualCountList.Count;

if (expectedCount != actualCount)
{
string diagnosticsOutput = actualCountList.Any() ? FormatDiagnostics(analyzer, actualCountList.ToArray()) : " NONE.";
var diagnosticsOutput = actualCountList.Any() ? FormatDiagnostics(analyzer, actualCountList.ToArray()) : " NONE.";

Assert.True(
false,
$"Mismatch between number of diagnostics returned, expected \"{expectedCount}\" actual \"{actualCount}\"\r\n\r\nDiagnostics:\r\n{diagnosticsOutput}\r\n");
}

for (int i = 0; i < expectedResults.Length; i++)
for (var i = 0; i < expectedResults.Length; i++)
{
var actual = actualCountList[i];
var expected = expectedResults[i];
Expand All @@ -113,7 +113,7 @@ private static void VerifyDiagnosticResults(IEnumerable<Diagnostic> actualResult
$"Expected {expected.Locations.Count - 1} additional locations but got {additionalLocations.Length} for Diagnostic:\r\n {FormatDiagnostics(analyzer, actual)}\r\n");
}

for (int j = 0; j < additionalLocations.Length; ++j)
for (var j = 0; j < additionalLocations.Length; ++j)
{
VerifyDiagnosticLocation(analyzer, actual, additionalLocations[j], expected.Locations[j + 1]);
}
Expand Down Expand Up @@ -192,7 +192,7 @@ private static void VerifyDiagnosticLocation(DiagnosticAnalyzer analyzer, Diagno
private static string FormatDiagnostics(DiagnosticAnalyzer analyzer, params Diagnostic[] diagnostics)
{
var builder = new StringBuilder();
for (int i = 0; i < diagnostics.Length; ++i)
for (var i = 0; i < diagnostics.Length; ++i)
{
builder.AppendLine("// " + diagnostics[i].ToString());

Expand All @@ -214,7 +214,7 @@ private static string FormatDiagnostics(DiagnosticAnalyzer analyzer, params Diag
location.IsInSource,
$"Test base does not currently handle diagnostics in metadata locations. Diagnostic in metadata: {diagnostics[i]}\r\n");

string resultMethodName = diagnostics[i].Location.SourceTree!.FilePath.EndsWith(".cs", StringComparison.Ordinal) ? "GetCSharpResultAt" : "GetBasicResultAt";
var resultMethodName = diagnostics[i].Location.SourceTree!.FilePath.EndsWith(".cs", StringComparison.Ordinal) ? "GetCSharpResultAt" : "GetBasicResultAt";
var linePosition = diagnostics[i].Location.GetLineSpan().StartLinePosition;

builder.Append($"{resultMethodName}({linePosition.Line + 1}, {linePosition.Character + 1}, {analyzerType.Name}.{rule.Id})");
Expand Down
4 changes: 2 additions & 2 deletions src/ReactiveUI.Fody.Analyzer/ReactiveObjectAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ private static bool HasBackingField(PropertyDeclarationSyntax property)
return setter?.ExpressionBody is not null && getter?.ExpressionBody is not null;
}

bool setterHasBodyStatements = setter.Body.Statements.Any();
bool getterHasBodyStatements = getter.Body.Statements.Any();
var setterHasBodyStatements = setter.Body.Statements.Any();
var getterHasBodyStatements = getter.Body.Statements.Any();

return setterHasBodyStatements && getterHasBodyStatements;
}
Expand Down
2 changes: 1 addition & 1 deletion src/ReactiveUI.Fody.Tests/ApiApprovalBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected static void CheckApproval(Assembly assembly, [CallerMemberName]string?
var approvedFileName = Path.Combine(sourceDirectory, $"ApiApprovalTests.{memberName}.{targetFrameworkName}.approved.txt");
var receivedFileName = Path.Combine(sourceDirectory, $"ApiApprovalTests.{memberName}.{targetFrameworkName}.received.txt");

string approvedPublicApi = string.Empty;
var approvedPublicApi = string.Empty;

if (File.Exists(approvedFileName))
{
Expand Down
Loading