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

refactor: Simplify beforeRunTests return singature #1339

Merged
merged 4 commits into from
Nov 24, 2020
Merged

Conversation

jan-goral
Copy link
Contributor

@jan-goral jan-goral commented Nov 21, 2020

This PR is a cherrypicked refactor from #1321

After merging this one, the #1321 will slim down a little.

Checklist

  • Simplify beforeRunTests return signature
  • Treat Args as context

@github-actions
Copy link
Contributor

github-actions bot commented Nov 21, 2020

Timestamp: 2020-11-23 20:18:15
Buildscan url for ubuntu-workflow run 379689865
https://gradle.com/s/5qjiyqgtn2ibs

@jan-goral jan-goral assigned zuziaka and unassigned zuziaka Nov 21, 2020
@codecov-io
Copy link

Codecov Report

Merging #1339 (408c779) into master (ac5a2a8) will decrease coverage by 0.02%.
The diff coverage is 82.02%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1339      +/-   ##
============================================
- Coverage     79.06%   79.04%   -0.03%     
+ Complexity      706      705       -1     
============================================
  Files           244      244              
  Lines          4687     4692       +5     
  Branches        824      825       +1     
============================================
+ Hits           3706     3709       +3     
  Misses          551      551              
- Partials        430      432       +2     

suspend fun dumpShards(
args: AndroidArgs,
suspend fun AndroidArgs.dumpShards(
@VisibleForTesting
Copy link
Contributor

Choose a reason for hiding this comment

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

@VisibleForTesting is used for field, class, method visibility, not for a method parameter, which do not have any visibility. We should not use it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For me, it's the only convention for marking why something is exposed but is not used in production code.

fun dumpShards(
args: IosArgs,
fun IosArgs.dumpShards(
@VisibleForTesting
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

saveShardChunks(
shardFilePath = shardFilePath,
shards = shards,
size = shards.flatMap { it.value.shards.values }.count(),
obfuscatedOutput = args.obfuscateDumpShards
obfuscatedOutput = obfuscateDumpShards
)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

How about

getAndroidMatrixShards().run {
    saveShardChunks(
        shardFilePath = shardFilePath,
        shards = this,
        size = flatMap { it.value.shards.values }.count(),
       obfuscatedOutput = obfuscateDumpShards
    )
}

?

Copy link
Contributor Author

@jan-goral jan-goral Nov 23, 2020

Choose a reason for hiding this comment

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

I don't like using val but also I don't like unnecessary nested scopes and explicit this keyword so it is the same for me but the current version gives fewer changes in diff.

println(args)
val (matrixMap, testShardChunks, ignoredTests) = cancelTestsOnTimeout(args.project) { runTests(args) }
val (matrixMap, testShardChunks, ignoredTests) =
cancelTestsOnTimeout(project) { runTests() }
Copy link
Contributor

Choose a reason for hiding this comment

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

could be single line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

single line is not fully visible on 14 cal split screen ;P.

@piotradamczyk5 piotradamczyk5 self-requested a review November 24, 2020 06:30
@mergify mergify bot merged commit a098501 into master Nov 24, 2020
@mergify mergify bot deleted the 685-refactor branch November 24, 2020 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants