akkadotnet / akka.analyzers

Roslyn analyzers for Akka.NET developers.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AK1001: CodeFix accidentally removes other `PipeTo` arguments in addition to `Sender`

Aaronontheweb opened this issue · comments

Version Information
Version of Akka.NET? v0.1.1
Which Akka.NET Modules? Akka.Analyzer

Describe the bug

We have the following original code:

https://github.com/akkadotnet/akka.net/blob/2633f914122b42aae87de807cee1561ab9749f27/src/core/Akka.Docs.Tests/Streams/StreamRefsDocTests.cs#L56-L61

It should be refactored to:

 // create a source
var sender = Sender;
StreamLogs(request.StreamId)
    // materialize it using stream refs
    .RunWith(StreamRefs.SourceRef<string>(), Context.System.Materializer())
    // and send to sender
    .PipeTo(sender, success: sourceRef => new LogsOffer(request.StreamId, sourceRef));

But is INSTEAD refactored to

 // create a source
var sender = Sender;
StreamLogs(request.StreamId)
    // materialize it using stream refs
    .RunWith(StreamRefs.SourceRef<string>(), Context.System.Materializer())
    // and send to sender
    .PipeTo(sender));

The success: sourceRef => new LogsOffer(request.StreamId, sourceRef) gets deleted by accident here.

Expected behavior

Only the replyTo argument on the PipeTo call should be changed, not 100% of the arguments.

Actual behavior

The success: sourceRef => new LogsOffer(request.StreamId, sourceRef) gets deleted by accident here.

Additional context

If there are any other optional parameters for PipeTo, we should add cases to cover those inside the code fix test suite for it as well. Do this exhaustively so we ensure that there are no problems.