Skip to content

Commit

Permalink
Fix Style/TrailingCommaInArguments violations
Browse files Browse the repository at this point in the history
  • Loading branch information
jenshenny committed Apr 26, 2024
1 parent a4d9325 commit 273ad53
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion lib/app_profiler/middleware.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def profile(env, params)
profile,
response: response,
autoredirect: params.autoredirect,
async: params.async
async: params.async,
)

response
Expand Down
2 changes: 1 addition & 1 deletion lib/app_profiler/middleware/upload_action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def call(profile, response: nil, autoredirect: nil, async: false)
append_headers(
response,
upload: profile_upload,
autoredirect: autoredirect.nil? ? AppProfiler.autoredirect : autoredirect
autoredirect: autoredirect.nil? ? AppProfiler.autoredirect : autoredirect,
) if response
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/app_profiler/profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def upload
AppProfiler.storage.upload(self).tap do |upload|
if upload && defined?(upload.url)
AppProfiler.logger.info(
<<~INFO.squish
<<~INFO.squish,
[Profiler] data uploaded:
profile_url=#{upload.url}
profile_viewer_url=#{AppProfiler.profile_url(upload)}
Expand All @@ -51,7 +51,7 @@ def upload
end
rescue => error
AppProfiler.logger.info(
"[Profiler] failed to upload profile error_class=#{error.class} error_message=#{error.message}"
"[Profiler] failed to upload profile error_class=#{error.class} error_message=#{error.message}",
)
nil
end
Expand Down
4 changes: 2 additions & 2 deletions lib/app_profiler/profiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def start(params = {})
StackProf.start(**DEFAULTS, **params)
rescue => error
AppProfiler.logger.info(
"[Profiler] failed to start the profiler error_class=#{error.class} error_message=#{error.message}"
"[Profiler] failed to start the profiler error_class=#{error.class} error_message=#{error.message}",
)
# This is a boolean instead of nil because StackProf#start returns a
# boolean as well.
Expand All @@ -52,7 +52,7 @@ def results
Profile.from_stackprof(stackprof_profile)
rescue => error
AppProfiler.logger.info(
"[Profiler] failed to obtain the profile error_class=#{error.class} error_message=#{error.message}"
"[Profiler] failed to obtain the profile error_class=#{error.class} error_message=#{error.message}",
)
nil
end
Expand Down
4 changes: 2 additions & 2 deletions lib/app_profiler/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def initialize(transport, logger)
@listen_thread = nil

@logger.info(
"[AppProfiler::Server] listening on addr=#{@transport.socket.addr}"
"[AppProfiler::Server] listening on addr=#{@transport.socket.addr}",
)
@pid = Process.pid
end
Expand Down Expand Up @@ -342,7 +342,7 @@ def serve
end
rescue => e
@logger.error(
"[AppProfiler::Server] exception #{e} responding to request #{request}: #{e.message}"
"[AppProfiler::Server] exception #{e} responding to request #{request}: #{e.message}",
)
ensure
session.close
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def index(_env)
</p>
HTML
end
end
end,
)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Middleware < BaseMiddleware
def initialize(app)
super
@speedscope = Rack::File.new(
File.join(AppProfiler.root, "node_modules/speedscope/dist/release")
File.join(AppProfiler.root, "node_modules/speedscope/dist/release"),
)
end

Expand All @@ -33,7 +33,7 @@ def show(_env, name)
end || raise(ArgumentError)

render(
<<~HTML
<<~HTML,
<script type="text/javascript">
var graph = #{profile.read};
var json = JSON.stringify(graph);
Expand Down
2 changes: 1 addition & 1 deletion lib/app_profiler/yarn/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def ensure_yarn_installed
exec("which", "yarn", silent: true) do
raise(
YarnError,
<<~MSG.squish
<<~MSG.squish,
`yarn` command not found.
Please install `yarn` or make it available in PATH.
MSG
Expand Down
4 changes: 2 additions & 2 deletions test/app_profiler/middleware_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,14 @@ class MiddlewareTest < TestCase
middleware = AppProfiler::Middleware.new(app_env)
middleware.call(
mock_request_env(
path: <<~PATH.delete("\n")
path: <<~PATH.delete("\n"),
/?profile=cpu&contact%5Bemail%5D]%F0%9D%92%B6]%F0%9D%92%B6]%22]
%22]%22]%22]%22]%22]%22]%22]%22]%22]%22]%22]%22]]%22]%22]%22]%22]%22]%22]%22]%22]%22]%22]%22]%22]]%22]
%22]%22]%22]%22]%22]%22]%22]%22]%22]%22]%22]]%22]%22]%22]%22]%22]%22]%22]%22]%22]%22]%22]%22]]%22]%22]
%22]%22]%22]%22%22]%22]%22]%22]%22]]%22]%22]%22]%22]%22]%22]%22]]%22]%22]%22]%22]%22]%22]%22]%22]%22]
%22]]%22]%22%22]%22]%22]%22]%22]%22]%22]%22]%22]%22]]%22]%22]%22]%22]%22]%22]%22%22]%22]%22]%22]
PATH
)
),
)
end
end
Expand Down
4 changes: 2 additions & 2 deletions test/app_profiler/request_parameters_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class RequestParametersTest < TestCase

assert_equal(
{ mode: mode.to_sym, interval: interval.to_i, ignore_gc: true, metadata: { id: "123", context: "test" } },
params.to_h
params.to_h,
)
assert_predicate(params, :valid?)
end
Expand All @@ -72,7 +72,7 @@ def request_params(headers: {})

def mock_request(headers, path: "/")
Rack::Request.new(
Rack::MockRequest.env_for("https://example.com#{path}", headers)
Rack::MockRequest.env_for("https://example.com#{path}", headers),
)
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/app_profiler/storage/google_cloud_storage_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def teardown
test "directory includes context" do
assert_equal(
GoogleCloudStorage.send(:gcs_filename, stub(context: "context", file: Pathname.new("foo"))),
"context/foo"
"context/foo",
)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class SpeedscopeRemoteViewer
class MiddlewareTest < TestCase
setup do
@app = Middleware.new(
proc { [200, { "Content-Type" => "text/plain" }, ["Hello world!"]] }
proc { [200, { "Content-Type" => "text/plain" }, ["Hello world!"]] },
)
end

Expand Down Expand Up @@ -71,7 +71,7 @@ class MiddlewareTest < TestCase
assert_match(
%r{'Flamegraph for .*'\);\n</script>},
html[-200..-1],
message: "The generated HTML was incomplete"
message: "The generated HTML was incomplete",
)
end

Expand Down
2 changes: 1 addition & 1 deletion test/app_profiler/viewer/speedscope_remote_viewer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class SpeedscopeRemoteViewerTest < TestCase
id = SpeedscopeRemoteViewer::Middleware.id(profile.file)

AppProfiler.logger.expects(:info).with(
"[Profiler] Profile available at /app_profiler/#{id}\n"
"[Profiler] Profile available at /app_profiler/#{id}\n",
)

viewer.view
Expand Down

0 comments on commit 273ad53

Please sign in to comment.