Skip to content

Commit

Permalink
Enable First*ElementLineBreak RuboCop rules (#117)
Browse files Browse the repository at this point in the history
Last change I found it difficult to follow when the modified hash and
arrays in this commit ended. There were a bunch of `}` on one line.

Enable rules to enforce the first key/value in a hash or array always
start on a new line in multi line definitions.
  • Loading branch information
tombruijn authored May 3, 2024
1 parent b60c3b7 commit 80977bd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
9 changes: 6 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ Style/StringLiteralsInInterpolation:
Style/HashSyntax:
EnforcedStyle: hash_rockets

Layout/HashAlignment:
EnforcedLastArgumentHashStyle: ignore_implicit

Layout/ArgumentAlignment:
EnforcedStyle: with_fixed_indentation

Expand All @@ -31,6 +28,12 @@ Layout/MultilineMethodCallIndentation:
Layout/MultilineOperationIndentation:
EnforcedStyle: indented

Layout/FirstHashElementLineBreak:
Enabled: true

Layout/FirstArrayElementLineBreak:
Enabled: true

Layout/FirstArrayElementIndentation:
EnforcedStyle: consistent

Expand Down
33 changes: 19 additions & 14 deletions spec/diagnose_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -913,8 +913,9 @@
"system" => {}
}
when :python
{ "default" =>
{ "ca_file_path" => ending_with("resources/cacert.pem"),
{
"default" => {
"ca_file_path" => ending_with("resources/cacert.pem"),
"diagnose_endpoint" => ending_with("diag"),
"enable_host_metrics" => true,
"enable_minutely_probes" => true,
Expand All @@ -930,24 +931,28 @@
"send_environment_metadata" => true,
"send_params" => true,
"send_session_data" => true,
"request_headers" =>
["accept",
"accept-charset",
"accept-encoding",
"accept-language",
"cache-control",
"connection",
"content-length",
"range"] },
"request_headers" => [
"accept",
"accept-charset",
"accept-encoding",
"accept-language",
"cache-control",
"connection",
"content-length",
"range"
]
},
"system" => { "app_path" => ending_with("diagnose/python") },
"initial" => { "name" => "DiagnoseTests" },
"environment" =>
{ "diagnose_endpoint" => ending_with("diag"),
"environment" => {
"diagnose_endpoint" => ending_with("diag"),
"enable_minutely_probes" => false,
"endpoint" => ENV.fetch("APPSIGNAL_PUSH_API_ENDPOINT", nil),
"environment" => "development",
"name" => "DiagnoseTests",
"push_api_key" => "test" } }
"push_api_key" => "test"
}
}
else
raise "No clause for runner #{@runner}"
end
Expand Down

0 comments on commit 80977bd

Please sign in to comment.