Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fix: enable static user methods for instance mappers #364

Merged
merged 1 commit into from
Apr 20, 2023

Conversation

TimothyMakkison
Copy link
Collaborator

Resolve #200

  • Edit BuildUserImplementedMapping to allow static instance members.
  • Add unit test to UserMethodTest and renamed some other tests, deleting the unused snapshots

Is it possible to get the diagnostic PartialInstanceMethodInStaticMapper? It looks like line 83 should be impossible to hit in normal C# code because you can't have an instance method in a static class.

@codecov-commenter
Copy link

codecov-commenter commented Apr 20, 2023

Codecov Report

Merging #364 (983df9d) into main (dce4b42) will decrease coverage by 0.06%.
The diff coverage is 90.53%.

❗ Current head 983df9d differs from pull request most recent head 655e93f. Consider uploading reports for the commit 655e93f to get more accurate results

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main     #364      +/-   ##
==========================================
- Coverage   91.71%   91.65%   -0.06%     
==========================================
  Files         109      126      +17     
  Lines        3379     3907     +528     
  Branches      438      543     +105     
==========================================
+ Hits         3099     3581     +482     
- Misses        189      215      +26     
- Partials       91      111      +20     
Impacted Files Coverage Δ
src/Nullable.cs 0.00% <ø> (ø)
src/Riok.Mapperly.Abstractions/MapEnumAttribute.cs 100.00% <ø> (ø)
...appingBuilders/DateTimeToDateOnlyMappingBuilder.cs 60.00% <0.00%> (-6.67%) ⬇️
...appingBuilders/DateTimeToTimeOnlyMappingBuilder.cs 60.00% <0.00%> (-6.67%) ⬇️
...criptors/MappingBuilders/ToStringMappingBuilder.cs 100.00% <ø> (ø)
...escriptors/Mappings/ForEachSetDictionaryMapping.cs 100.00% <ø> (ø)
src/Riok.Mapperly/Helpers/DictionaryExtensions.cs 100.00% <ø> (ø)
src/Riok.Mapperly/Helpers/EnumerableExtensions.cs 95.08% <ø> (ø)
...berMappings/MemberNullDelegateAssignmentMapping.cs 53.12% <25.00%> (ø)
...criptors/MappingBuilders/NullableMappingBuilder.cs 91.66% <33.33%> (-2.09%) ⬇️
... and 100 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@latonz latonz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for all those great contributions 😊

I can't think of a scenario which triggers PartialInstanceMethodInStaticMapper / RMG019. There is also no test for it, no idea why I added it in the first place 🤷 Feel free to remove it.

@TimothyMakkison
Copy link
Collaborator Author

TimothyMakkison commented Apr 20, 2023

Ok, I've deleted the DiagnosticDescriptor and updated the shipped file.

@latonz latonz enabled auto-merge (squash) April 20, 2023 11:48
@latonz latonz merged commit 7e1cb8f into riok:main Apr 20, 2023
@TimothyMakkison TimothyMakkison deleted the add_static_instance branch August 2, 2023 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support static user implemented mapping methods in non-static mappers
3 participants