Skip to content

Commit 59f91b2

Browse files
committed
update dogfood
1 parent afb3a2f commit 59f91b2

24 files changed

+71
-50
lines changed

codecracker.test.ruleset

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RuleSet Name="CodeCracker Rules for tests" Description="Our own rules applied to our own code. :)" ToolsVersion="14.0">
3+
<Rules AnalyzerId="CodeCracker.CSharp" RuleNamespace="CodeCracker.CSharp">
4+
<Rule Id="CC0061" Action="None" />
5+
</Rules>
6+
</RuleSet>

codecrackerandall.test.ruleset

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RuleSet Name="CodeCrackerTestAndAllRules" ToolsVersion="14.0">
3+
<Include Path="codecrackerandall.ruleset" Action="Default" />
4+
<Include Path="codecracker.test.ruleset" Action="Default" />
5+
</RuleSet>

src/CSharp/CodeCracker/CodeCracker.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@
194194
<Folder Include="Security\" />
195195
</ItemGroup>
196196
<ItemGroup>
197-
<Analyzer Include="..\..\..\packages\codecracker.CSharp.1.0.0-alpha3-0311\tools\analyzers\CodeCracker.CSharp.dll" />
197+
<Analyzer Include="..\..\..\packages\codecracker.CSharp.1.0.0-alpha3-0339\tools\analyzers\CodeCracker.CSharp.dll" />
198198
</ItemGroup>
199199
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
200200
<PropertyGroup>

src/CSharp/CodeCracker/Design/CopyEventToVariableBeforeFireCodeFixProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ public sealed override async Task ComputeFixesAsync(CodeFixContext context)
3030
var invocation = root.FindToken(sourceSpan.Start).Parent.AncestorsAndSelf().OfType<InvocationExpressionSyntax>().First();
3131

3232
context.RegisterFix(
33-
CodeAction.Create("Copy event reference to a variable", ct => CreateVariable(context.Document, invocation, ct)), diagnostic);
33+
CodeAction.Create("Copy event reference to a variable", ct => CreateVariableAsync(context.Document, invocation, ct)), diagnostic);
3434
}
3535

36-
private async Task<Document> CreateVariable(Document document, InvocationExpressionSyntax invocation, CancellationToken ct)
36+
private async Task<Document> CreateVariableAsync(Document document, InvocationExpressionSyntax invocation, CancellationToken ct)
3737
{
3838
const string handlerName = "handler";
3939

src/CSharp/CodeCracker/Design/EmptyCatchBlockCodeFixProvider.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public sealed override async Task ComputeFixesAsync(CodeFixContext context)
3131
context.RegisterFix(CodeAction.Create("Insert Exception class to Catch", c => InsertExceptionClassCommentAsync(context.Document, declaration, c)), diagnostic);
3232
}
3333

34-
private async Task<Document> RemoveTry(Document document, CatchClauseSyntax catchStatement, CancellationToken cancellationToken, bool insertComment = false)
34+
private async Task<Document> RemoveTryAsync(Document document, CatchClauseSyntax catchStatement, CancellationToken cancellationToken, bool insertComment = false)
3535
{
3636
var tryStatement = (TryStatementSyntax)catchStatement.Parent;
3737
var tryBlock = tryStatement.Block;
@@ -51,12 +51,12 @@ private async Task<Document> RemoveTry(Document document, CatchClauseSyntax catc
5151

5252
private async Task<Document> RemoveEmptyCatchBlockAsync(Document document, CatchClauseSyntax catchStatement, CancellationToken cancellationToken)
5353
{
54-
return await RemoveTry(document, catchStatement, cancellationToken);
54+
return await RemoveTryAsync(document, catchStatement, cancellationToken);
5555
}
5656

5757
private async Task<Document> RemoveEmptyCatchBlockPutCommentAsync(Document document, CatchClauseSyntax catchStatement, CancellationToken cancellationToken)
5858
{
59-
return await RemoveTry(document, catchStatement, cancellationToken, true);
59+
return await RemoveTryAsync(document, catchStatement, cancellationToken, true);
6060
}
6161

6262
private async Task<Document> InsertExceptionClassCommentAsync(Document document, CatchClauseSyntax catchStatement, CancellationToken cancellationToken)

src/CSharp/CodeCracker/Design/StaticConstructorExceptionCodeFixProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ public sealed override async Task ComputeFixesAsync(CodeFixContext context)
2727
var @throw = root.FindToken(sourceSpan.Start).Parent.AncestorsAndSelf().OfType<ThrowStatementSyntax>().First();
2828

2929
context.RegisterFix(
30-
CodeAction.Create("Remove this exception", ct => RemoveThrow(context.Document, @throw, ct)), diagnostic);
30+
CodeAction.Create("Remove this exception", ct => RemoveThrowAsync(context.Document, @throw, ct)), diagnostic);
3131
}
3232

33-
private async Task<Document> RemoveThrow(Document document, ThrowStatementSyntax @throw, CancellationToken ct)
33+
private async Task<Document> RemoveThrowAsync(Document document, ThrowStatementSyntax @throw, CancellationToken ct)
3434
{
3535
return document.WithSyntaxRoot((await document.GetSyntaxRootAsync(ct)).RemoveNode(@throw, SyntaxRemoveOptions.KeepNoTrivia));
3636
}

src/CSharp/CodeCracker/Design/UseInvokeMethodToFireEventCodeFixProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ public sealed override async Task ComputeFixesAsync(CodeFixContext context)
3333
var invocation = root.FindToken(sourceSpan.Start).Parent.AncestorsAndSelf().OfType<InvocationExpressionSyntax>().First();
3434

3535
context.RegisterFix(
36-
CodeAction.Create("Use ?.Invoke operator and method to fire an event.", ct => UseInvoke(context.Document, invocation, ct)), diagnostic);
36+
CodeAction.Create("Use ?.Invoke operator and method to fire an event.", ct => UseInvokeAsync(context.Document, invocation, ct)), diagnostic);
3737
}
3838

39-
private async Task<Document> UseInvoke(Document document, InvocationExpressionSyntax invocation, CancellationToken ct)
39+
private async Task<Document> UseInvokeAsync(Document document, InvocationExpressionSyntax invocation, CancellationToken ct)
4040
{
4141
var newInvocation =
4242
SyntaxFactory.ConditionalAccessExpression(

src/CSharp/CodeCracker/Performance/EmptyFinalizerCodeFixProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ public sealed override async Task ComputeFixesAsync(CodeFixContext context)
2828
var finalizer = root.FindToken(sourceSpan.Start).Parent.AncestorsAndSelf().OfType<DestructorDeclarationSyntax>().First();
2929

3030
context.RegisterFix(
31-
CodeAction.Create("Remove finalizer", ct => RemoveThrow(context.Document, finalizer, ct)), diagnostic);
31+
CodeAction.Create("Remove finalizer", ct => RemoveThrowAsync(context.Document, finalizer, ct)), diagnostic);
3232
}
3333

34-
private async Task<Document> RemoveThrow(Document document, DestructorDeclarationSyntax finalizer, CancellationToken ct)
34+
private async Task<Document> RemoveThrowAsync(Document document, DestructorDeclarationSyntax finalizer, CancellationToken ct)
3535
{
3636
return document.WithSyntaxRoot((await document.GetSyntaxRootAsync(ct)).RemoveNode(finalizer, SyntaxRemoveOptions.KeepNoTrivia));
3737
}

src/CSharp/CodeCracker/Performance/RemoveWhereWhenItIsPossibleCodeFixProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ public sealed override async Task ComputeFixesAsync(CodeFixContext context)
2727
var whereInvoke = root.FindToken(diagnosticSpan.Start).Parent.AncestorsAndSelf().OfType<InvocationExpressionSyntax>().First();
2828
var nextMethodInvoke = whereInvoke.Parent.FirstAncestorOrSelf<InvocationExpressionSyntax>();
2929
var message = "Remove 'Where' moving predicate to '" + RemoveWhereWhenItIsPossibleAnalyzer.GetNameOfTheInvokedMethod(nextMethodInvoke) + "'";
30-
context.RegisterFix(CodeAction.Create(message, c => RemoveWhere(context.Document, whereInvoke, nextMethodInvoke, c)), diagnostic);
30+
context.RegisterFix(CodeAction.Create(message, c => RemoveWhereAsync(context.Document, whereInvoke, nextMethodInvoke, c)), diagnostic);
3131
}
3232

33-
private async Task<Document> RemoveWhere(Document document, InvocationExpressionSyntax whereInvoke, InvocationExpressionSyntax nextMethodInvoke, CancellationToken cancellationToken)
33+
private async Task<Document> RemoveWhereAsync(Document document, InvocationExpressionSyntax whereInvoke, InvocationExpressionSyntax nextMethodInvoke, CancellationToken cancellationToken)
3434
{
3535
var root = await document.GetSyntaxRootAsync(cancellationToken);
3636
var whereMemberAccess = whereInvoke.ChildNodes().OfType<MemberAccessExpressionSyntax>().FirstOrDefault();

src/CSharp/CodeCracker/Performance/SealedAttributeCodeFixProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ public sealed override async Task ComputeFixesAsync(CodeFixContext context)
2727
var sourceSpan = diagnostic.Location.SourceSpan;
2828
var type = root.FindToken(sourceSpan.Start).Parent.AncestorsAndSelf().OfType<ClassDeclarationSyntax>().First();
2929

30-
context.RegisterFix(CodeAction.Create("Mark as sealed", ct => MarkClassAsSealed(context.Document, type, ct)), diagnostic);
30+
context.RegisterFix(CodeAction.Create("Mark as sealed", ct => MarkClassAsSealedAsync(context.Document, type, ct)), diagnostic);
3131
}
3232

33-
private async Task<Document> MarkClassAsSealed(Document document, ClassDeclarationSyntax type, CancellationToken ct)
33+
private async Task<Document> MarkClassAsSealedAsync(Document document, ClassDeclarationSyntax type, CancellationToken ct)
3434
{
3535
return document
3636
.WithSyntaxRoot((await document.GetSyntaxRootAsync(ct))

0 commit comments

Comments
 (0)