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 duplicate then statement; collapse duplicate if statements #1219

Merged
merged 1 commit into from Jan 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -118,11 +118,7 @@ public class TarCopyActionSpec extends Specification {
action.execute(new CopyActionProcessingStream() {
public void process(CopyActionProcessingStreamAction action) {
for (FileCopyDetailsInternal f : files) {
if (f.isDirectory()) {
action.processFile(f);
} else {
action.processFile(f);
}
action.processFile(f);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

a cursory inspection seems to indicate this is the correct fix but there is a good chance I missed the logic here and really the the first if statement should be changed.

Copy link
Contributor

Choose a reason for hiding this comment

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

This logic is correct assuming that f.isDirectory() has no side effects. I checked all implementors of FileCopyDetails.isDirectory() and that seems to be correct.

}
}
});
Expand Down
Expand Up @@ -134,7 +134,6 @@ class DefaultBuildOperationExecutorTest extends ConcurrentSpec {
when:
operationExecutor.run("<some-operation>", action)

then:
then:
1 * action.transform(_) >> { BuildOperationContext context -> context.failed(failure) }

Expand Down