Skip to content

Commit

Permalink
Add unconfigured rubocops and fix errors (#4169)
Browse files Browse the repository at this point in the history
  • Loading branch information
moleske authored Jan 13, 2025
1 parent b536c96 commit 91604fc
Show file tree
Hide file tree
Showing 49 changed files with 529 additions and 495 deletions.
34 changes: 34 additions & 0 deletions .rubocop_cc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ Lint/AmbiguousRange:
Enabled: true
Lint/ConstantOverwrittenInRescue:
Enabled: true
Lint/ConstantReassignment:
Enabled: true
Lint/DeprecatedConstants:
Enabled: true
Lint/DuplicateBranch:
Expand All @@ -172,12 +174,16 @@ Lint/DuplicateMatchPattern:
Enabled: true
Lint/DuplicateRegexpCharacterClassElement:
Enabled: true
Lint/DuplicateSetElement:
Enabled: true
Lint/EmptyBlock:
Enabled: true
Lint/EmptyClass:
Enabled: true
Lint/EmptyInPattern:
Enabled: true
Lint/HashNewWithKeywordArgumentsAsDefault:
Enabled: true
Lint/IncompatibleIoSelectWithFiberScheduler:
Enabled: true
Lint/ItWithoutArgumentsInBlock:
Expand All @@ -194,6 +200,8 @@ Lint/NonAtomicFileOperation:
Enabled: true
Lint/NumberedParameterAssignment:
Enabled: true
Lint/NumericOperationWithConstantResult:
Enabled: true
Lint/OrAssignmentToConstant:
Enabled: true
Lint/RedundantDirGlobSort:
Expand All @@ -206,16 +214,22 @@ Lint/RequireRangeParentheses:
Enabled: true
Lint/RequireRelativeSelfPath:
Enabled: true
Lint/SharedMutableDefault:
Enabled: true
Lint/SymbolConversion:
Enabled: true
Lint/ToEnumArguments:
Enabled: true
Lint/TripleQuotes:
Enabled: true
Lint/UnescapedBracketInRegexp:
Enabled: true
Lint/UnexpectedBlockArity:
Enabled: true
Lint/UnmodifiedReduceAccumulator:
Enabled: true
Lint/UselessDefined:
Enabled: true
Lint/UselessRescue:
Enabled: true
Lint/UselessRuby2Keywords:
Expand All @@ -228,18 +242,26 @@ Security/CompoundHash:
Enabled: true
Security/IoMethods:
Enabled: true
Style/AmbiguousEndlessMethodDefinition:
Enabled: true
Style/ArgumentsForwarding:
Enabled: true
Style/ArrayIntersect:
Enabled: true
Style/BitwisePredicate:
Enabled: true
Style/CollectionCompact:
Enabled: true
Style/CombinableDefined:
Enabled: true
Style/ComparableClamp:
Enabled: true
Style/ConcatArrayLiterals:
Enabled: true
Style/DataInheritance:
Enabled: true
Style/DigChain:
Enabled: true
Style/DirEmpty:
Enabled: true
Style/DocumentDynamicEvalDefinition:
Expand All @@ -256,8 +278,12 @@ Style/FetchEnvVar:
Enabled: true
Style/FileEmpty:
Enabled: true
Style/FileNull:
Enabled: true
Style/FileRead:
Enabled: true
Style/FileTouch:
Enabled: true
Style/FileWrite:
Enabled: true
Style/HashConversion:
Expand All @@ -268,6 +294,10 @@ Style/IfWithBooleanLiteralBranches:
Enabled: true
Style/InPatternThen:
Enabled: true
Style/ItAssignment:
Enabled: true
Style/KeywordArgumentsMerging:
Enabled: true
Style/MagicCommentFormat:
Enabled: true
Style/MapCompactWithConditionalBlock:
Expand Down Expand Up @@ -328,6 +358,8 @@ Style/RedundantStringEscape:
Enabled: true
Style/ReturnNilInPredicateMethodDefinition:
Enabled: true
Style/SafeNavigationChainLength:
Enabled: true
Style/SelectByRegexp:
Enabled: true
Style/StringChars:
Expand Down Expand Up @@ -528,6 +560,8 @@ RSpec/SpecFilePathFormat:
Enabled: true
RSpec/SpecFilePathSuffix:
Enabled: true
RSpec/StringAsInstanceDoubleConstant:
Enabled: true
RSpec/SubjectDeclaration:
Enabled: true
RSpec/VerifiedDoubleReference:
Expand Down
2 changes: 1 addition & 1 deletion config/environment.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path('application', __dir__)

Rails.logger = Logger.new('/dev/null')
Rails.logger = Logger.new(File::NULL)
Rails.application.initialize!
2 changes: 1 addition & 1 deletion lib/cloud_controller/blobstore/fingerprints_collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def each(&block)

def parse_mode(raw_mode, filename)
mode = raw_mode ? raw_mode.to_i(8) : DEFAULT_FILE_MODE
unless (mode & 0o600) == 0o600
unless mode.allbits?(0o600)
raise CloudController::Errors::ApiError.new_from_details('AppResourcesFileModeInvalid',
"File mode '#{raw_mode}' with path '#{filename}' is invalid. Minimum file mode is '0600'")
end
Expand Down
2 changes: 1 addition & 1 deletion spec/request/admin_actions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

let(:expected_codes_and_responses) do
h = Hash.new(
code: 403
{ code: 403 }.freeze
)
h['admin'] = {
code: 202
Expand Down
10 changes: 5 additions & 5 deletions spec/request/app_features_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
end

let(:expected_codes_and_responses) do
h = Hash.new(code: 404)
h = Hash.new({ code: 404 }.freeze)
%w[admin admin_read_only global_auditor space_developer space_manager space_auditor org_manager
space_supporter].each do |r|
h[r] = { code: 200, response_object: features_response_object }
Expand All @@ -62,7 +62,7 @@

describe 'GET /v3/apps/:guid/features/:name' do
let(:expected_codes_and_responses) do
h = Hash.new(code: 404)
h = Hash.new({ code: 404 }.freeze)
%w[admin admin_read_only global_auditor space_developer space_manager space_auditor org_manager
space_supporter].each do |r|
h[r] = { code: 200, response_object: feature_response_object }
Expand Down Expand Up @@ -132,7 +132,7 @@
end

let(:expected_codes_and_responses) do
h = Hash.new(code: 403, errors: CF_NOT_AUTHORIZED)
h = Hash.new({ code: 403, errors: CF_NOT_AUTHORIZED }.freeze)
%w[no_role org_auditor org_billing_manager].each { |r| h[r] = { code: 404 } }
%w[admin space_developer].each { |r| h[r] = { code: 200, response_object: feature_response_object } }
h
Expand Down Expand Up @@ -166,7 +166,7 @@
end

let(:expected_codes_and_responses) do
h = Hash.new(code: 403, errors: CF_NOT_AUTHORIZED)
h = Hash.new({ code: 403, errors: CF_NOT_AUTHORIZED }.freeze)
%w[no_role org_auditor org_billing_manager].each { |r| h[r] = { code: 404 } }
%w[admin space_developer space_supporter].each do |r|
h[r] = { code: 200, response_object: feature_response_object }
Expand Down Expand Up @@ -202,7 +202,7 @@
end

let(:expected_codes_and_responses) do
h = Hash.new(code: 403, errors: CF_NOT_AUTHORIZED)
h = Hash.new({ code: 403, errors: CF_NOT_AUTHORIZED }.freeze)
%w[no_role org_auditor org_billing_manager].each { |r| h[r] = { code: 404 } }
%w[admin space_developer].each { |r| h[r] = { code: 200, response_object: feature_response_object } }
h
Expand Down
2 changes: 1 addition & 1 deletion spec/request/app_manifests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
context 'permissions' do
let(:api_call) { ->(user_headers) { get "/v3/apps/#{app_model.guid}/manifest", nil, user_headers } }
let(:expected_codes_and_responses) do
h = Hash.new(code: 403)
h = Hash.new({ code: 403 }.freeze)
h['no_role'] = { code: 404 }
h['org_auditor'] = { code: 404 }
h['org_billing_manager'] = { code: 404 }
Expand Down
10 changes: 5 additions & 5 deletions spec/request/app_usage_events_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

let(:expected_codes_and_responses) do
h = Hash.new(
code: 404,
response_object: []
{ code: 404,
response_object: [] }.freeze
)
h['admin'] = {
code: 200,
Expand Down Expand Up @@ -63,8 +63,8 @@

let(:expected_codes_and_responses) do
h = Hash.new(
code: 200,
response_objects: []
{ code: 200,
response_objects: [] }.freeze
)
h['admin'] = {
code: 200,
Expand Down Expand Up @@ -151,7 +151,7 @@
end

let(:expected_codes_and_responses) do
h = Hash.new(code: 403)
h = Hash.new({ code: 403 }.freeze)
h['admin'] = { code: 200 }
h
end
Expand Down
Loading

0 comments on commit 91604fc

Please sign in to comment.