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

Remove `IActionContext.NewGuid()` & Add `RandomExtension.GenerateRandomGuid()` #508

Merged
merged 4 commits into from Sep 10, 2019

Conversation

@Unengine
Copy link
Contributor

commented Sep 10, 2019

I think getting a random Guid in IActionContext is a bad usage because dummy objects (for testing, debugging or etc ...) using random Guid in games don't need IActionContext. IRandoms are enough to acquire the same thing.

So I removed IActionContext.NewGuid().
Instead I added an extension class, RandomExtension that includes a extension method, GenerateRandomGuid().
Since RandomExtension is an extension class, I implemented generating a random Guid.

@CLAassistant

This comment has been minimized.

Copy link

commented Sep 10, 2019

CLA assistant check
All committers have signed the CLA.

@dahlia dahlia requested review from dahlia, earlbread, limebell, longfin and moreal Sep 10, 2019
Copy link
Member

left a comment

Is it okay without removing ActionContext.NewGuid()?

/// <seealso cref="IRandom"/>
public static Guid GenerateRandomGuid(this IRandom random)
{
var bytes = new byte[16];

This comment has been minimized.

Copy link
@longfin

longfin Sep 10, 2019

Member

It would be better if there is mention as this.

This comment has been minimized.

Copy link
@Unengine

Unengine Sep 10, 2019

Author Contributor

Both are fixed! Thanks!

This comment has been minimized.

Copy link
@dahlia

dahlia Sep 10, 2019

Member

@Unengine Still not addressed I think?

This comment has been minimized.

Copy link
@Unengine

Unengine Sep 10, 2019

Author Contributor

Sorry, I forgot to commit. I'll also commit your suggestions at once!

This comment has been minimized.

Copy link
@Unengine

Unengine Sep 10, 2019

Author Contributor

Job's done!

Copy link
Member

left a comment

Please write two entries to the changelog file.

@codecov

This comment has been minimized.

Copy link

commented Sep 10, 2019

Codecov Report

Merging #508 into master will increase coverage by 0.02%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master     #508      +/-   ##
==========================================
+ Coverage   90.05%   90.07%   +0.02%     
==========================================
  Files         200      201       +1     
  Lines       14718    14718              
==========================================
+ Hits        13254    13257       +3     
+ Misses       1180     1177       -3     
  Partials      284      284
Impacted Files Coverage Δ
Libplanet/Action/ActionContext.cs 100% <ø> (ø) ⬆️
Libplanet/Action/RandomExtension.cs 100% <100%> (ø)
Libplanet.Tests/Action/ActionContextTest.cs 89.7% <100%> (ø) ⬆️
Libplanet/Net/Protocols/KademliaProtocol.cs 60.86% <0%> (+0.86%) ⬆️
Copy link
Contributor

left a comment

I think you should fix some tests which uses NewGuid().

@limebell limebell self-requested a review Sep 10, 2019
@Unengine

This comment has been minimized.

Copy link
Contributor Author

commented Sep 10, 2019

I think you should fix some tests which uses NewGuid().

You're right. Job's done!

@Unengine Unengine requested review from dahlia and longfin Sep 10, 2019
CHANGES.md Outdated Show resolved Hide resolved
CHANGES.md Outdated Show resolved Hide resolved
@Unengine Unengine requested a review from dahlia Sep 10, 2019
@dahlia
dahlia approved these changes Sep 10, 2019
Copy link
Member

left a comment

🎉

@dahlia dahlia merged commit 738bb57 into planetarium:master Sep 10, 2019
17 checks passed
17 checks passed
WIP Ready for review
Details
changelog This contains self-describing changelog.
Details
codecov/patch 100% of diff hit (target 90.05%)
Details
codecov/project 90.07% (+0.02%) compared to 16cf867
Details
docs Libplanet docs generated by DocFX
Details
license/cla Contributor License Agreement is signed.
Details
planetarium.libplanet Build #20190910.41 succeeded
Details
planetarium.libplanet (Linux_Mono) Linux_Mono succeeded
Details
planetarium.libplanet (Linux_NETCore) Linux_NETCore succeeded
Details
planetarium.libplanet (Windows_Mono) Windows_Mono succeeded
Details
planetarium.libplanet (Windows_NETCore) Windows_NETCore succeeded
Details
planetarium.libplanet (Windows_NETCore_Benchmark) Windows_NETCore_Benchmark succeeded
Details
planetarium.libplanet (Windows_NETCore_coverage) Windows_NETCore_coverage succeeded
Details
planetarium.libplanet (Windows_NETFramework) Windows_NETFramework succeeded
Details
planetarium.libplanet (macOS_Mono) macOS_Mono succeeded
Details
planetarium.libplanet (macOS_NETCore) macOS_NETCore succeeded
Details
planetarium.libplanet (macOS_Unity) macOS_Unity succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.