Skip to content

Commit

Permalink
Rubocop updates
Browse files Browse the repository at this point in the history
  • Loading branch information
elohanlon committed Dec 24, 2024
1 parent f7cc740 commit d718cf3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Metrics/AbcSize:
- lib/derivativo/access_generator.rb
- app/jobs/derivative_request_jobs/derivative_request_job.rb
- lib/derivativo/conversion/ffmpeg_helpers.rb
- lib/derivativo/utils/shell_utils.rb
- lib/derivativo/conversion/office_helpers.rb

Metrics/CyclomaticComplexity:
Exclude:
Expand All @@ -49,6 +51,7 @@ Metrics/MethodLength:
- app/jobs/derivative_request_jobs/prepare_derivative_request_job.rb
- lib/derivativo/poster_generator.rb
- lib/derivativo/conversion/office_helpers.rb
- lib/derivativo/utils/shell_utils.rb

Metrics/ParameterLists:
Enabled: false
Expand Down
2 changes: 1 addition & 1 deletion lib/derivativo/conversion/office_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module OfficeHelpers

SIZE_THRESHOLD_FOR_LARGE_OFFICE_CONVERSION_DOC_TIMEOUT = 5.megabytes
SMALL_OFFICE_CONVERSION_DOC_TIMEOUT = 30.seconds
LARGE_OFFICE_CONVERSION_DOC_TIMEOUT = 120.seconds
LARGE_OFFICE_CONVERSION_DOC_TIMEOUT = 120.seconds

# Converts an input office output audiovisual file
def self.office_convert_to_pdf(src_file_path:, dst_file_path:)
Expand Down
4 changes: 3 additions & 1 deletion lib/derivativo/utils/shell_utils.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# frozen_string_literal: true

module Derivativo::Utils::ShellUtils
def self.run_with_timeout(cmd, timeout_in_seconds)
stdout_str = ''
stderr_str = ''
begin
read_out, write_out = IO.pipe
read_err, write_err = IO.pipe
pid = Process.spawn(cmd, pgroup: true, :out => write_out, :err => write_err)
pid = Process.spawn(cmd, pgroup: true, out: write_out, err: write_err)
Timeout.timeout(timeout_in_seconds) do
Process.waitpid(pid)

Expand Down
4 changes: 3 additions & 1 deletion spec/derivativo/utils/uri_utils_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe Derivativo::Utils::UriUtils do
Expand All @@ -13,7 +15,7 @@

describe '.location_uri_to_file_path' do
{
'file:///a/b/c.png' => '/a/b/c.png',
'file:///a/b/c.png' => '/a/b/c.png'
}.each do |location_uri, expected_file_path|
it 'converts as expected ' do
expect(described_class.location_uri_to_file_path(location_uri)).to eq(expected_file_path)
Expand Down

0 comments on commit d718cf3

Please sign in to comment.