Skip to content
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

Enable consistent comma style #270

Merged
merged 1 commit into from
Sep 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,9 @@ Metrics/MethodLength:
Metrics/ModuleLength:
Exclude:
- 'spec/**/*'

Style/TrailingCommaInArrayLiteral:
EnforcedStyleForMultiline: consistent_comma

Style/TrailingCommaInHashLiteral:
EnforcedStyleForMultiline: consistent_comma
30 changes: 0 additions & 30 deletions .rubocop_todo.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions lib/heathen/processor_methods/convert_image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ def convert_image(to: 'tiff', params: '')

target_file = temp_file_name '', ".#{to.to_s}"
executioner.execute(
*[Colore::C_.convert_path,
job.content_file,
params.split(/ +/),
target_file].flatten
*[
Colore::C_.convert_path,
job.content_file,
params.split(/ +/),
target_file,
].flatten
)
raise ConversionFailed.new if executioner.last_exit_status != 0

Expand Down
4 changes: 2 additions & 2 deletions lib/heathen/processor_methods/libreoffice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ def libreoffice(format:)
'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'odp',
},
'txt' => {
'.*' => 'txt'
}
'.*' => 'txt',
},
}

raise InvalidParameterInStep.new('format', format) unless suffixes[format.to_s]
Expand Down
2 changes: 1 addition & 1 deletion lib/sidekiq_workers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class LegacyPurgeWorker

::Sidekiq::Cron::Job.load_from_hash('legacy_purge_worker' => {
'cron' => '0 6 * * *',
'class' => self.name
'class' => self.name,
})

# Looks for old legacy docs and deletes them
Expand Down
8 changes: 4 additions & 4 deletions spec/helpers/mime_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ def ms_excel_mime_types
[
'application/octet-stream; charset=binary', # LibreOffice 5.1
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; charset=binary',
'application/zip; charset=binary' # LibreOffice 6.0.7
'application/zip; charset=binary', # LibreOffice 6.0.7
]
end

def ms_powerpoint_mime_types
[
'application/octet-stream; charset=binary', # LibreOffice 6.0.7
'application/vnd.openxmlformats-officedocument.presentationml.presentation; charset=binary'
'application/vnd.openxmlformats-officedocument.presentationml.presentation; charset=binary',
]
end

def ms_word_mime_types
[
'application/octet-stream; charset=binary', # LibreOffice 6.0.7
'application/vnd.openxmlformats-officedocument.wordprocessingml.document; charset=binary',
'application/zip; charset=binary'
'application/zip; charset=binary',
]
end

Expand All @@ -38,6 +38,6 @@ def oo_odt_mime_types
def tesseract_hocr_mime_types
[
'application/xml; charset=us-ascii', # tesseract v3
'text/xml; charset=us-ascii' # tesseract v4
'text/xml; charset=us-ascii', # tesseract v4
]
end
26 changes: 13 additions & 13 deletions spec/lib/app_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def show_backtrace(response)
file: Rack::Test::UploadedFile.new(__FILE__, 'application/ruby'),
actions: ['ocr', 'pdf'],
author: author,
backtrace: true
backtrace: true,
}
show_backtrace last_response
expect(last_response.status).to eq 201
Expand All @@ -54,7 +54,7 @@ def show_backtrace(response)
title: 'A title',
file: Rack::Test::UploadedFile.new(__FILE__, 'application/ruby'),
actions: ['ocr', 'pdf'],
backtrace: true
backtrace: true,
}
show_backtrace last_response
expect(last_response.status).to eq 409
Expand All @@ -69,7 +69,7 @@ def show_backtrace(response)
post "/document/#{appname}/#{doc_id}/#{filename}", {
file: Rack::Test::UploadedFile.new(__FILE__, 'application/ruby'),
actions: ['ocr', 'pdf'],
backtrace: true
backtrace: true,
}
show_backtrace last_response
expect(last_response.status).to eq 201
Expand All @@ -85,7 +85,7 @@ def show_backtrace(response)
file: Rack::Test::UploadedFile.new(__FILE__, 'application/ruby'),
actions: ['ocr', 'pdf'],
author: author,
backtrace: true
backtrace: true,
}
expect(last_response.status).to eq 404
expect(last_response.content_type).to eq 'application/json'
Expand Down Expand Up @@ -115,7 +115,7 @@ def show_backtrace(response)
context 'POST new conversion' do
it 'starts a new conversion' do
post "/document/#{appname}/#{doc_id}/current/#{filename}/ocr", {
backtrace: true
backtrace: true,
}
show_backtrace last_response
expect(last_response.status).to eq 202
Expand All @@ -127,7 +127,7 @@ def show_backtrace(response)
end
it 'fails if invalid document' do
post "/document/#{appname}/#{invalid_doc_id}/current/#{filename}/ocr", {
backtrace: true
backtrace: true,
}
show_backtrace last_response
expect(last_response.status).to eq 404
Expand All @@ -137,7 +137,7 @@ def show_backtrace(response)
end
it 'fails if invalid version' do
post "/document/#{appname}/#{doc_id}/fred/#{filename}/ocr", {
backtrace: true
backtrace: true,
}
show_backtrace last_response
expect(last_response.status).to eq 400
Expand All @@ -150,7 +150,7 @@ def show_backtrace(response)
context 'DELETE document' do
it 'runs' do
delete "/document/#{appname}/#{doc_id}", {
deleted_by: 'a.person'
deleted_by: 'a.person',
}
show_backtrace last_response
expect(last_response.status).to eq 200
Expand All @@ -164,7 +164,7 @@ def show_backtrace(response)
context 'DELETE document version' do
it 'runs' do
delete "/document/#{appname}/#{doc_id}/v001", {
deleted_by: 'a.person'
deleted_by: 'a.person',
}
show_backtrace last_response
expect(last_response.status).to eq 200
Expand All @@ -175,7 +175,7 @@ def show_backtrace(response)
end
it 'fails if you try to delete current' do
delete "/document/#{appname}/#{doc_id}/current", {
deleted_by: 'a.person'
deleted_by: 'a.person',
}
show_backtrace last_response
expect(last_response.status).to eq 400
Expand All @@ -184,7 +184,7 @@ def show_backtrace(response)
end
it 'fails if you try to delete the current version' do
delete "/document/#{appname}/#{doc_id}/v002", {
deleted_by: 'a.person'
deleted_by: 'a.person',
}
show_backtrace last_response
expect(last_response.status).to eq 400
Expand Down Expand Up @@ -235,7 +235,7 @@ def show_backtrace(response)
context 'when file is nil' do
it 'returns an error' do
params = {
file: nil
file: nil,
}
post "/convert", params
expect(last_response.status).to eq 400
Expand All @@ -247,7 +247,7 @@ def show_backtrace(response)
context 'when file is not correct' do
it 'returns an error' do
params = {
file: "I'm definitely not a file"
file: "I'm definitely not a file",
}
post "/convert", params
expect(last_response.status).to eq 400
Expand Down
8 changes: 4 additions & 4 deletions spec/lib/autoheathen/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
'horse' => {
'duck' => :duckle,
'fish' => 'fishle',
'eagle' => ['the', 'quick', 'brown', 'fox']
}
'eagle' => ['the', 'quick', 'brown', 'fox'],
},
}
hash = @obj.symbolize_keys in_hash
expect(hash).to eq({
Expand All @@ -57,8 +57,8 @@
horse: {
duck: :duckle,
fish: 'fishle',
eagle: ['the', 'quick', 'brown', 'fox']
}
eagle: ['the', 'quick', 'brown', 'fox'],
},
})
end
end
6 changes: 3 additions & 3 deletions spec/lib/utils_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
'awards' => [
{ type: 'Medal of Honour', 'reason' => 'Stupidity' },
{ 'type' => 'George Cross', reason: 'Bravery' },
]
],
}
expect(symbolize_keys(h)).to eq({
name: 'Fred',
Expand All @@ -32,7 +32,7 @@
awards: [
{ type: 'Medal of Honour', reason: 'Stupidity' },
{ type: 'George Cross', reason: 'Bravery' },
]
],
})
end

Expand Down Expand Up @@ -61,7 +61,7 @@
content_type: 'application/pdf',
filename: 'foo.pdf',
},
}
},
}
expect(symbolize_keys(h)).to eq h
end
Expand Down