-
Notifications
You must be signed in to change notification settings - Fork 377
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
Add meta_struct and stack trace collection #4269
base: master
Are you sure you want to change the base?
Conversation
Datadog ReportBranch report: ❌ 9 Failed (0 Known Flaky), 21946 Passed, 1476 Skipped, 5m 27.74s Total Time ❌ Failed Tests (9)
|
BenchmarksBenchmark execution time: 2025-01-24 17:32:37 Comparing candidate commit 4b91c61 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 31 metrics, 2 unstable metrics. |
f79044e
to
77e9969
Compare
|
||
it 'creates a stack trace with 4 top frames' do | ||
expect(dd_stack_trace.frames.size).to eq(4) | ||
expect(dd_stack_trace.frames[0].text).to eq(stack_trace[0].to_s) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚪ Code Quality Violation
expect(dd_stack_trace.frames[0].text).to eq(stack_trace[0].to_s) | |
expect(dd_stack_trace.frames[0].text).to eq(stack_trace.first.to_s) |
Improve readability with first (...read more)
This rule encourages the use of first
and last
methods over array indexing to access the first and last elements of an array, respectively. The primary reason behind this rule is to improve code readability. Using first
and last
makes it immediately clear that you are accessing the first or last element of the array, which might not be immediately obvious with array indexing, especially for developers who are new to Ruby.
The use of these methods also helps to make your code more idiomatic, which is a crucial aspect of writing effective Ruby code. Idiomatic code is easier to read, understand, and maintain. It also tends to be more efficient, as idioms often reflect patterns that are optimized for the language.
To adhere to this rule, replace the use of array indexing with first
or last
methods when you want to access the first and last elements of an array. For instance, instead of arr[0]
use arr.first
and instead of arr[-1]
use arr.last
. However, note that this rule should be applied only when reading values. When modifying the first or last elements, array indexing should still be used. For example, arr[0] = 'new_value'
and arr[-1] = 'new_value'
.
|
||
it 'creates a stack trace with 4 frames, 1 top' do | ||
expect(dd_stack_trace.frames.size).to eq(4) | ||
expect(dd_stack_trace.frames[0].text).to eq(stack_trace[0].to_s) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚪ Code Quality Violation
expect(dd_stack_trace.frames[0].text).to eq(stack_trace[0].to_s) | |
expect(dd_stack_trace.frames[0].text).to eq(stack_trace.first.to_s) |
Improve readability with first (...read more)
This rule encourages the use of first
and last
methods over array indexing to access the first and last elements of an array, respectively. The primary reason behind this rule is to improve code readability. Using first
and last
makes it immediately clear that you are accessing the first or last element of the array, which might not be immediately obvious with array indexing, especially for developers who are new to Ruby.
The use of these methods also helps to make your code more idiomatic, which is a crucial aspect of writing effective Ruby code. Idiomatic code is easier to read, understand, and maintain. It also tends to be more efficient, as idioms often reflect patterns that are optimized for the language.
To adhere to this rule, replace the use of array indexing with first
or last
methods when you want to access the first and last elements of an array. For instance, instead of arr[0]
use arr.first
and instead of arr[-1]
use arr.last
. However, note that this rule should be applied only when reading values. When modifying the first or last elements, array indexing should still be used. For example, arr[0] = 'new_value'
and arr[-1] = 'new_value'
.
5d75fc3
to
255e242
Compare
@@ -35,7 +35,7 @@ def self.subscribe(engine, context) | |||
next unless result.match? | |||
|
|||
yield result | |||
throw(:block, true) unless result.actions.empty? | |||
throw(:block, true) if result.actions.include?('block') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we changing this everywhere?
Datadog ReportBranch report: ✅ 0 Failed, 22127 Passed, 1476 Skipped, 5m 17.04s Total Time |
|
||
it 'creates a stack trace with 4 top frames' do | ||
expect(collection.count).to eq(4) | ||
expect(collection[0].text).to eq(frames[0].to_s) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚪ Code Quality Violation
expect(collection[0].text).to eq(frames[0].to_s) | |
expect(collection.first.text).to eq(frames[0].to_s) |
Improve readability with first (...read more)
This rule encourages the use of first
and last
methods over array indexing to access the first and last elements of an array, respectively. The primary reason behind this rule is to improve code readability. Using first
and last
makes it immediately clear that you are accessing the first or last element of the array, which might not be immediately obvious with array indexing, especially for developers who are new to Ruby.
The use of these methods also helps to make your code more idiomatic, which is a crucial aspect of writing effective Ruby code. Idiomatic code is easier to read, understand, and maintain. It also tends to be more efficient, as idioms often reflect patterns that are optimized for the language.
To adhere to this rule, replace the use of array indexing with first
or last
methods when you want to access the first and last elements of an array. For instance, instead of arr[0]
use arr.first
and instead of arr[-1]
use arr.last
. However, note that this rule should be applied only when reading values. When modifying the first or last elements, array indexing should still be used. For example, arr[0] = 'new_value'
and arr[-1] = 'new_value'
.
|
||
it 'creates a stack trace with 4 bottom frames' do | ||
expect(collection.count).to eq(4) | ||
expect(collection[0].text).to eq(frames[1].to_s) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚪ Code Quality Violation
expect(collection[0].text).to eq(frames[1].to_s) | |
expect(collection.first.text).to eq(frames[1].to_s) |
Improve readability with first (...read more)
This rule encourages the use of first
and last
methods over array indexing to access the first and last elements of an array, respectively. The primary reason behind this rule is to improve code readability. Using first
and last
makes it immediately clear that you are accessing the first or last element of the array, which might not be immediately obvious with array indexing, especially for developers who are new to Ruby.
The use of these methods also helps to make your code more idiomatic, which is a crucial aspect of writing effective Ruby code. Idiomatic code is easier to read, understand, and maintain. It also tends to be more efficient, as idioms often reflect patterns that are optimized for the language.
To adhere to this rule, replace the use of array indexing with first
or last
methods when you want to access the first and last elements of an array. For instance, instead of arr[0]
use arr.first
and instead of arr[-1]
use arr.last
. However, note that this rule should be applied only when reading values. When modifying the first or last elements, array indexing should still be used. For example, arr[0] = 'new_value'
and arr[-1] = 'new_value'
.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4269 +/- ##
==========================================
- Coverage 97.70% 97.69% -0.02%
==========================================
Files 1359 1362 +3
Lines 82479 82864 +385
Branches 4198 4217 +19
==========================================
+ Hits 80589 80954 +365
- Misses 1890 1910 +20 ☔ View full report in Codecov by Sentry. |
What does this PR do?
This PR adds meta_struct and stack trace collection support
Motivation:
Stack trace collection is required for exploit prevention. meta_struct is required for stack trace collection
Change log entry
None.
Additional Notes:
How to test the change?