-
Notifications
You must be signed in to change notification settings - Fork 376
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
WIP: Better span events serialization when supported #4279
base: master
Are you sure you want to change the base?
Conversation
👋 Hey @marcotc, please fill "Change log entry" section in the pull request description. If changes need to be present in CHANGELOG.md you can state it this way **Change log entry**
Yes. A brief summary to be placed into the CHANGELOG.md (possible answers Yes/Yep/Yeah) Or you can opt out like that **Change log entry**
None. (possible answers No/Nope/None) Visited at: 2025-01-10 23:31:10 UTC |
allow(trace_encoder).to receive(:encode_trace).with(encoder, traces[0]).and_return('1') | ||
allow(trace_encoder).to receive(:encode_trace).with(encoder, traces[1]).and_return('22') | ||
allow(trace_encoder).to receive(:encode_trace).with(encoder, traces[2]).and_return('333') | ||
allow(trace_encoder).to receive(:encode_trace).with(encoder, traces[0], native_events_supported).and_return('1') |
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
allow(trace_encoder).to receive(:encode_trace).with(encoder, traces[0], native_events_supported).and_return('1') | |
allow(trace_encoder).to receive(:encode_trace).with(encoder, traces.first, native_events_supported).and_return('1') |
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'
.
Datadog ReportBranch report: ✅ 0 Failed, 22148 Passed, 1476 Skipped, 5m 21.53s Total Time |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4279 +/- ##
==========================================
+ Coverage 97.73% 97.75% +0.01%
==========================================
Files 1354 1355 +1
Lines 82449 82543 +94
Branches 4236 4241 +5
==========================================
+ Hits 80584 80686 +102
+ Misses 1865 1857 -8 ☔ View full report in Codecov by Sentry. |
What does this PR do?
Motivation:
Change log entry
Additional Notes:
How to test the change?