Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Search: make 'exclude tests' more general#63762

Merged
jtibshirani merged 3 commits into
mainfrom
jtibs/filters
Jul 12, 2024
Merged

Search: make 'exclude tests' more general#63762
jtibshirani merged 3 commits into
mainfrom
jtibs/filters

Conversation

@jtibshirani

@jtibshirani jtibshirani commented Jul 10, 2024

Copy link
Copy Markdown
Contributor

The "Exclude" options in the filter panels are very useful, but many are specific to Go. This change generalizes them so they apply in many more cases:

  • All files with suffix _test plus extension (covers Go, Python, some Ruby, C++, C, more)
  • All files with suffix .test plus extension (covers Javascript, some Ruby)
  • Ruby specs
  • Third party folders (common general naming pattern)

Relates to SPLF-70

Test plan

Added new unit test. Tested manually.

Screenshot 2024-07-10 at 12 46 53 PM

@cla-bot cla-bot Bot added the cla-signed label Jul 10, 2024
@github-actions github-actions Bot added team/product-platform team/search-platform Issues owned by the search platform team labels Jul 10, 2024

@jtibshirani jtibshirani Jul 10, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Any suggestions about the name here? We can't just say "exclude tests" because the regexp isn't comprehensive. For example, it will miss Java tests like AgentTest.java. If this was called "exclude tests", Java users would wonder "why didn't it exclude my tests"?

Aside: I looked into crafting a general regexp that covers most test names across languages. This proved tricky, especially because we need to rely on case sensitivity (CamelCaseTest), which we can't really "toggle on" here.

@stefanhengl stefanhengl Jul 11, 2024

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Personally, I would prefer _test.* over _test.xx.

Alternative: we could use a match group to extract the extension and create a label for it. I played around a bit locally and it would look like this

image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The match group approach looks a bit noisy to me. If I were a user, and my results had too many tests, I'd want to exclude as many tests as possible in one click. And it makes the filters panel more "busy" 🤔

As for _test.* -- I wasn't sure about using globbing, since our query language uses regexp. But it does feel natural!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was unused

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Just renamed this, as it is not specific to Go (vendor directories are used in other ecosystems too)

Comment thread internal/search/streaming/search_filters.go Outdated
@jtibshirani jtibshirani requested review from a team July 11, 2024 00:32
@jtibshirani jtibshirani marked this pull request as ready for review July 11, 2024 00:32
@jtibshirani jtibshirani merged commit 85686e4 into main Jul 12, 2024
@jtibshirani jtibshirani deleted the jtibs/filters branch July 12, 2024 16:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed team/product-platform team/search-platform Issues owned by the search platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants