-
Notifications
You must be signed in to change notification settings - Fork 3
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
NH-67864: use rubocop-performance #94
Conversation
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
@@ -98,8 +98,7 @@ def for_log | |||
# * Hash | |||
# | |||
def hash_for_log | |||
@hash_for_log = {} | |||
@hash_for_log = {trace_id: @trace_id, span_id: @span_id, trace_flags: @trace_flags, service_name: @service_name} if @do_log | |||
@hash_for_log = @do_log ? {'trace_id' => @trace_id, 'span_id' => @span_id, 'trace_flags' => @trace_flags, 'resource.service.name' => @service_name} : {} |
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.
Nice, so seems this also fixes the minor problem you mentioned while reviewing the prerelease doc?
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.
Yes, it fixed that issue.
@@ -181,7 +181,7 @@ def validate_token(token) | |||
end | |||
|
|||
def validate_transform_service_name(service_name) | |||
service_name = 'test_ssl_collector' if ENV['SW_APM_COLLECTOR'] =~ /java-collector:1222/ | |||
service_name = 'test_ssl_collector' if /java-collector:1222/.match?(ENV['SW_APM_COLLECTOR']) |
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.
Hmm I question whether this line should actually be in the code, seems easy enough for testing setup to just specify a service name rather than pollute the code.
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.
I'd agree. I removed all the logic related with java-collector.
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.
Nice learning experience to read the changes, thanks @xuan-cao-swi! I left a few comments and also wondering if there was a hurdle to running it in a matrix of ruby versions?
Yes, it seems like although the github action ran successfully, but the uploading the sarif output is problematic. |
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.
LGTM, thanks for the revisit @xuan-cao-swi!
Description
Use rubocop-performance to find out the potential improvement of efficiency.