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

ignores: Don't use strings.Contains #112

Merged
merged 1 commit into from Oct 23, 2023
Merged

ignores: Don't use strings.Contains #112

merged 1 commit into from Oct 23, 2023

Conversation

abhinav
Copy link
Collaborator

@abhinav abhinav commented Oct 21, 2023

Instead of matching for built-in functions with strings.Contains,
use the parsed stack information to match function names exactly.

Following this change, the only remaining strings.Contains are
to match on the goroutine state:

% rg strings.Contains
utils_test.go
84:             if strings.Contains(s.State(), "run") {

internal/stack/stacks_test.go
249:            if strings.Contains(s.State(), "run") {

Resolves #41
Depends on #111

@codecov
Copy link

codecov bot commented Oct 21, 2023

Codecov Report

Merging #112 (78c5017) into master (91de685) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #112   +/-   ##
=======================================
  Coverage   98.50%   98.50%           
=======================================
  Files           6        6           
  Lines         334      334           
=======================================
  Hits          329      329           
  Misses          4        4           
  Partials        1        1           
Files Coverage Δ
options.go 100.00% <100.00%> (ø)
tracestack_new.go 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@abhinav abhinav force-pushed the strings-contains branch 2 times, most recently from 2a14a39 to f901fec Compare October 21, 2023 20:54
@abhinav abhinav force-pushed the parse-stack branch 2 times, most recently from f46c0cd to 7bdc274 Compare October 22, 2023 18:15
Base automatically changed from parse-stack to master October 23, 2023 04:16
Instead of matching for built-in functions with strings.Contains,
use the parsed stack information to match function names exactly.

Following this change, the only remaining strings.Contains are
to match on the goroutine state:

```
% rg strings.Contains
utils_test.go
84:             if strings.Contains(s.State(), "run") {

internal/stack/stacks_test.go
249:            if strings.Contains(s.State(), "run") {
```

Resolves #41
@abhinav abhinav merged commit ecabcf9 into master Oct 23, 2023
7 checks passed
@abhinav abhinav deleted the strings-contains branch October 23, 2023 04:18
@mway mway mentioned this pull request Oct 24, 2023
mway added a commit that referenced this pull request Oct 24, 2023
### Fixed
- Built-in ignores now match function names more accurately.
  They will no longer ignore stacks because of file names
  that look similar to function names. (#112)
### Added
- Add an `IgnoreAnyFunction` option to ignore stack traces
  that have the provided function anywhere in the stack. (#113)
- Ignore `testing.runFuzzing` and `testing.runFuzzTests` alongside
  other already-ignored test functions (`testing.RunTests`, etc). (#105)

### Changed
- Miscellaneous CI-related fixes. (#103, #108, #114)

---------

Co-authored-by: Abhinav Gupta <mail@abhinavg.net>
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.

Parse stack traces to avoid string contains checks
2 participants