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

[#1466] Filter intersection of tags #1467

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

AnOtterGithubUser
Copy link

Hello,
I added a new flag --include-all-tags that works with --tags options to get the behavior requested in #1466
Default flag value is set to false to keep existing behavior unchanged

@google-cla
Copy link

google-cla bot commented Mar 11, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Contributor

@Ekrekr Ekrekr left a comment

Choose a reason for hiding this comment

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

Sorry that this went under the radar for so long! It just needs a sync and a few nits, then we can get this in.

@@ -10,6 +10,7 @@ option go_package = "github.com/dataform-co/dataform/protos/dataform";
message RunConfig {
repeated string actions = 1;
repeated string tags = 5;
bool include_all_tags = 10;
Copy link
Contributor

Choose a reason for hiding this comment

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

"include all" is ambiguous in semantic meaning - IMO something like filterTagsAsIntersection would be better as it's more explicit.

Comment on lines +412 to +417
expect(actionNames).includes("schema.op_e");
expect(actionNames).includes("schema.tab_a");
expect(actionNames).not.includes("schema.op_a");
expect(actionNames).not.includes("schema.op_b");
expect(actionNames).not.includes("schema.op_c");
expect(actionNames).not.includes("schema.op_d");
Copy link
Contributor

Choose a reason for hiding this comment

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

This would be better as expect(actionNames).deep.equals(["schema.op_e", "schema.op_a"]);

allActions
.filter(action => action.tags.some(tag => runConfig.tags.includes(tag)))
.forEach(action => includedActionNames.add(targetAsReadableString(action.target)));
// Keep actions wich include every tags in --tag option
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Keep actions wich include every tags in --tag option
// Select actions which match the intersection of the set of tags.

.filter(action => runConfig.tags.every(tag => action.tags.includes(tag)))
.forEach(action => includedActionNames.add(targetAsReadableString(action.target)));
}
// Keep actions with include at least one tag in --tag option
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Keep actions with include at least one tag in --tag option
// Select actions which match the union of the set of tags.

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.

2 participants