Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Emit warning when a mapping doesn't use the source value. #1111

Closed
TimothyMakkison opened this issue Feb 8, 2024 · 2 comments
Closed

Emit warning when a mapping doesn't use the source value. #1111

TimothyMakkison opened this issue Feb 8, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@TimothyMakkison
Copy link
Collaborator

Mapperly should emit a warning when a mapping function is generated where the source is not used at any point to generate the target value. I'd argue that this is never intentional and only causes unexpected bugs, see #1107

ie

private static Protobuf.Timestamp MapToTimestamp(global::System.DateTimeOffset source)
{
    // source is not used, probably a bug.
    var target = new Protobuf.Timestamp();
    return target;
}

I'm not sure how it should be configurable be able to be disabled. There might be some scenarios where this is intentional.

@TimothyMakkison TimothyMakkison added the enhancement New feature or request label Feb 8, 2024
@latonz
Copy link
Contributor

latonz commented Feb 9, 2024

This would address the same use-case / issue as #660, wouldn‘t it? But this seems to be a lot more complex to implement 🤔

@latonz
Copy link
Contributor

latonz commented Feb 16, 2024

Closing for now in favor of #660

@latonz latonz closed this as completed Feb 16, 2024
@latonz latonz closed this as not planned Won't fix, can't repro, duplicate, stale Feb 20, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants