Skip to content

Commit

Permalink
Fix frozen string literal issues
Browse files Browse the repository at this point in the history
  • Loading branch information
chaadow committed Jun 15, 2024
1 parent 3ad2a93 commit 2555efc
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 14 deletions.
20 changes: 18 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,21 @@ permissions:
contents: read

jobs:
Shared:
uses: fog/.github/.github/workflows/[email protected]
test:

runs-on: ubuntu-latest

strategy:
matrix:
ruby-version: ['3.0', '3.1', '3.2', '3.3', 'head']
continue-on-error: ${{ matrix.ruby-version == 'head' }}

steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Run tests
run: bundle exec rake RUBYOPT="--enable-frozen-string-literal"
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ group :test, :default do
end

group :test do
gem "simplecov"
gem "simplecov", '~> 0.22.0'
gem "codeclimate-test-reporter", "~> 1.0.0"
end
2 changes: 1 addition & 1 deletion lib/fog/aws/requests/lambda/create_event_source_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def create_event_source_mapping(params={})
function = self.get_function_configuration('FunctionName' => function_name).body

unless event_source_arn
message = "ValidationException => "
message = +"ValidationException => "
message << "'eventSourceArn' cannot be blank"
raise Fog::AWS::Lambda::Error, message
end
Expand Down
2 changes: 1 addition & 1 deletion lib/fog/aws/requests/lambda/create_function.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def create_function(params={})
end

if !function.empty?
message = "ResourceConflictException => "
message = +"ResourceConflictException => "
message << "Function already exist: #{function_name}"
raise Fog::AWS::Lambda::Error, message
end
Expand Down
2 changes: 1 addition & 1 deletion lib/fog/aws/requests/lambda/get_event_source_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def get_event_source_mapping(params={})
mapping_id = params.delete('UUID')

unless mapping = self.data[:event_source_mappings][mapping_id]
message = 'ResourceNotFoundException => '
message = +'ResourceNotFoundException => '
message << 'The resource you requested does not exist.'
raise Fog::AWS::Lambda::Error, message
end
Expand Down
2 changes: 1 addition & 1 deletion lib/fog/aws/requests/lambda/get_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def get_policy(params={})
statements = self.data[:permissions][function_arn] || []

if statements.empty?
message = "ResourceNotFoundException => "
message = +"ResourceNotFoundException => "
message << "The resource you requested does not exist."
raise Fog::AWS::Lambda::Error, message
end
Expand Down
4 changes: 2 additions & 2 deletions lib/fog/aws/requests/lambda/invoke.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def invoke(params={})
response.body = ''

unless function_id = params.delete('FunctionName')
message = 'AccessDeniedException => '
message = +'AccessDeniedException => '
message << 'Unable to determine service/operation name to be authorized'
raise Fog::AWS::Lambda::Error, message
end
Expand All @@ -63,7 +63,7 @@ def invoke(params={})
end

if payload
message = "payload parameter is ignored since we are not really "
message = +"payload parameter is ignored since we are not really "
message << "invoking a function [light_black](#{caller.first})[/]"
Fog::Logger.warning message
end
Expand Down
2 changes: 1 addition & 1 deletion lib/fog/aws/requests/lambda/update_event_source_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def update_event_source_mapping(params={})
mapping = self.data[:event_source_mappings][mapping_id]

unless mapping
message = 'ResourceNotFoundException => '
message = +'ResourceNotFoundException => '
message << 'The resource you requested does not exist.'
raise Fog::AWS::Lambda::Error, message
end
Expand Down
2 changes: 1 addition & 1 deletion lib/fog/aws/requests/storage/acl_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Storage

private
def self.hash_to_acl(acl)
data = "<AccessControlPolicy>\n"
data = +"<AccessControlPolicy>\n"

if acl['Owner'] && (acl['Owner']['ID'] || acl['Owner']['DisplayName'])
data << " <Owner>\n"
Expand Down
2 changes: 1 addition & 1 deletion lib/fog/aws/requests/storage/cors_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Storage
private

def self.hash_to_cors(cors)
data = "<CORSConfiguration>\n"
data = +"<CORSConfiguration>\n"

[cors['CORSConfiguration']].flatten.compact.each do |rule|
data << " <CORSRule>\n"
Expand Down
2 changes: 1 addition & 1 deletion tests/requests/lambda/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ module Formats
DELETE_EVENT_SOURCE_MAPPING = GET_EVENT_SOURCE_MAPPING

def self.zip(data, filename='index.js')
data_io = Zip::OutputStream.write_buffer do |zio|
data_io = Zip::OutputStream.write_buffer(StringIO.new) do |zio|
zio.put_next_entry(filename)
zio.write(data)
end
Expand Down
2 changes: 1 addition & 1 deletion tests/requests/storage/object_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
end

tests("#get_object('#{@directory.identity}', 'fog_object', &block)").returns(lorem_file.read) do
data = ''
data = +''
Fog::Storage[:aws].get_object(@directory.identity, 'fog_object') do |chunk, remaining_bytes, total_bytes|
data << chunk
end
Expand Down

0 comments on commit 2555efc

Please sign in to comment.