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

Removed: frozen string literal #564

Closed
wants to merge 2 commits into from
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AllCops:
TargetRubyVersion: 2.6
TargetRubyVersion: 3.1
Exclude:
- Gemfile
- generate/Gemfile
Expand Down Expand Up @@ -61,7 +61,7 @@ Style/Not:
Enabled: false
Naming/FileName:
Enabled: true
Regex: !ruby/regexp '/^.{3,200}$/'
Regex: !ruby/regexp '/^.{3, 99}$/'
Style/TrailingCommaInArrayLiteral:
EnforcedStyleForMultiline: comma
Style/TrailingCommaInHashLiteral:
Expand Down
38 changes: 19 additions & 19 deletions generate/gen-controls/bigquery_dataset.rb
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
# frozen_string_literal: true

require 'yaml'
require 'logger'

title 'Test GCP google_bigquery_dataset resource.'
require "yaml"
require "logger"

title "Test GCP google_bigquery_dataset resource."
# rubocop:disable Metrics/BlockLength
control 'google_bigquery_dataset-1.0' do
control "google_bigquery_dataset-1.0" do
impact 1.0
title 'google_bigquery_dataset resource test'
title "google_bigquery_dataset resource test"

logger = Logger.new(STDOUT)
logger.level = Logger::WARN
logger.warn('Generating tests for google_bigquery_dataset')
logger.warn("Generating tests for google_bigquery_dataset")
filters = []
ignored_fields = []
output_folder = ENV['OUTPUT_PATH']
output_folder = ENV["OUTPUT_PATH"]

if output_folder.nil?
output_folder = File.join(File.dirname(__FILE__), '../../generated_tests')
output_folder = File.join(File.dirname(__FILE__), "../../generated_tests")
logger.warn("Undefined output folder path at variable OUTPUT_PATH. Defaulting to #{File.expand_path(output_folder)}")
end

Dir.mkdir(output_folder) unless File.exist?(output_folder)
template_path = File.join(File.dirname(__FILE__), '../../generated_test_template.erb')
config_folder = ENV['CNF_PATH']
logger.warn('Undefined configuration folder path at variable CNF_PATH. Ignoring configuration files')
template_path = File.join(File.dirname(__FILE__), "../../generated_test_template.erb")
config_folder = ENV["CNF_PATH"]
logger.warn("Undefined configuration folder path at variable CNF_PATH. Ignoring configuration files")
unless config_folder.nil?
file_name = File.join(config_folder, 'google_bigquery_dataset.yaml')
file_name = File.join(config_folder, "google_bigquery_dataset.yaml")
if File.file?(file_name)
config = YAML.load_file(file_name)
config_filters = config['filters']
config_filters = config["filters"]
config_filters.each do
# This is not currently implemented
logger.warn('Filters are not currently supported, ignoring')
logger.warn("Filters are not currently supported, ignoring")
end
config_ignored = config['ignore_fields']
config_ignored = config["ignore_fields"]
ignored_fields += config_ignored
end
end
project_name = ENV['GCP_PROJECT_NAME']
raise 'Undefined project name, please set the GCP_PROJECT_NAME variable' if project_name.nil?
project_name = ENV["GCP_PROJECT_NAME"]
raise "Undefined project name, please set the GCP_PROJECT_NAME variable" if project_name.nil?
plural_identifiers = [{ project: project_name }]

all_identifiers = []
Expand All @@ -60,7 +60,7 @@
output = "Writing #{File.expand_path(output_folder)}/Dataset_#{i}.rb"
describe output do
# Prints pretty message when writing controls to files
its('length') { should be >= 0 }
its("length") { should be >= 0 }
end
i += 1
end
Expand Down
40 changes: 20 additions & 20 deletions generate/gen-controls/bigquery_table.rb
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
# frozen_string_literal: true

require 'yaml'
require 'logger'

title 'Test GCP google_bigquery_table resource.'
require "yaml"
require "logger"

title "Test GCP google_bigquery_table resource."
# rubocop:disable Metrics/BlockLength
control 'google_bigquery_table-1.0' do
control "google_bigquery_table-1.0" do
impact 1.0
title 'google_bigquery_table resource test'
title "google_bigquery_table resource test"

logger = Logger.new(STDOUT)
logger.level = Logger::WARN
logger.warn('Generating tests for google_bigquery_table')
logger.warn("Generating tests for google_bigquery_table")
filters = []
ignored_fields = []
output_folder = ENV['OUTPUT_PATH']
output_folder = ENV["OUTPUT_PATH"]

if output_folder.nil?
output_folder = File.join(File.dirname(__FILE__), '../../generated_tests')
output_folder = File.join(File.dirname(__FILE__), "../../generated_tests")
logger.warn("Undefined output folder path at variable OUTPUT_PATH. Defaulting to #{File.expand_path(output_folder)}")
end

Dir.mkdir(output_folder) unless File.exist?(output_folder)
template_path = File.join(File.dirname(__FILE__), '../../generated_test_template.erb')
config_folder = ENV['CNF_PATH']
logger.warn('Undefined configuration folder path at variable CNF_PATH. Ignoring configuration files')
template_path = File.join(File.dirname(__FILE__), "../../generated_test_template.erb")
config_folder = ENV["CNF_PATH"]
logger.warn("Undefined configuration folder path at variable CNF_PATH. Ignoring configuration files")
unless config_folder.nil?
file_name = File.join(config_folder, 'google_bigquery_table.yaml')
file_name = File.join(config_folder, "google_bigquery_table.yaml")
if File.file?(file_name)
config = YAML.load_file(file_name)
config_filters = config['filters']
config_filters = config["filters"]
config_filters.each do
# This is not currently implemented
logger.warn('Filters are not currently supported, ignoring')
logger.warn("Filters are not currently supported, ignoring")
end
config_ignored = config['ignore_fields']
config_ignored = config["ignore_fields"]
ignored_fields += config_ignored
end
end
project_name = ENV['GCP_PROJECT_NAME']
raise 'Undefined project name, please set the GCP_PROJECT_NAME variable' if project_name.nil?
project_name = ENV["GCP_PROJECT_NAME"]
raise "Undefined project name, please set the GCP_PROJECT_NAME variable" if project_name.nil?
plural_identifiers = [{ project: project_name }]

next_identifiers = []
dataset_ids = google_bigquery_datasets(project: project_name).ids
dataset_ids.each do |dataset_id|
plural_identifiers.each do |plural_identifier|
next_identifiers.push(plural_identifier.merge({ dataset: dataset_id.split(':').last }))
next_identifiers.push(plural_identifier.merge({ dataset: dataset_id.split(":").last }))
end
end
plural_identifiers = next_identifiers
Expand All @@ -69,7 +69,7 @@
output = "Writing #{File.expand_path(output_folder)}/Table_#{i}.rb"
describe output do
# Prints pretty message when writing controls to files
its('length') { should be >= 0 }
its("length") { should be >= 0 }
end
i += 1
end
Expand Down
38 changes: 19 additions & 19 deletions generate/gen-controls/cloudfunctions_cloud_function.rb
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
# frozen_string_literal: true

require 'yaml'
require 'logger'

title 'Test GCP google_cloudfunctions_cloud_function resource.'
require "yaml"
require "logger"

title "Test GCP google_cloudfunctions_cloud_function resource."
# rubocop:disable Metrics/BlockLength
control 'google_cloudfunctions_cloud_function-1.0' do
control "google_cloudfunctions_cloud_function-1.0" do
impact 1.0
title 'google_cloudfunctions_cloud_function resource test'
title "google_cloudfunctions_cloud_function resource test"

logger = Logger.new(STDOUT)
logger.level = Logger::WARN
logger.warn('Generating tests for google_cloudfunctions_cloud_function')
logger.warn("Generating tests for google_cloudfunctions_cloud_function")
filters = []
ignored_fields = []
output_folder = ENV['OUTPUT_PATH']
output_folder = ENV["OUTPUT_PATH"]

if output_folder.nil?
output_folder = File.join(File.dirname(__FILE__), '../../generated_tests')
output_folder = File.join(File.dirname(__FILE__), "../../generated_tests")
logger.warn("Undefined output folder path at variable OUTPUT_PATH. Defaulting to #{File.expand_path(output_folder)}")
end

Dir.mkdir(output_folder) unless File.exist?(output_folder)
template_path = File.join(File.dirname(__FILE__), '../../generated_test_template.erb')
config_folder = ENV['CNF_PATH']
logger.warn('Undefined configuration folder path at variable CNF_PATH. Ignoring configuration files')
template_path = File.join(File.dirname(__FILE__), "../../generated_test_template.erb")
config_folder = ENV["CNF_PATH"]
logger.warn("Undefined configuration folder path at variable CNF_PATH. Ignoring configuration files")
unless config_folder.nil?
file_name = File.join(config_folder, 'google_cloudfunctions_cloud_function.yaml')
file_name = File.join(config_folder, "google_cloudfunctions_cloud_function.yaml")
if File.file?(file_name)
config = YAML.load_file(file_name)
config_filters = config['filters']
config_filters = config["filters"]
config_filters.each do
# This is not currently implemented
logger.warn('Filters are not currently supported, ignoring')
logger.warn("Filters are not currently supported, ignoring")
end
config_ignored = config['ignore_fields']
config_ignored = config["ignore_fields"]
ignored_fields += config_ignored
end
end
project_name = ENV['GCP_PROJECT_NAME']
raise 'Undefined project name, please set the GCP_PROJECT_NAME variable' if project_name.nil?
project_name = ENV["GCP_PROJECT_NAME"]
raise "Undefined project name, please set the GCP_PROJECT_NAME variable" if project_name.nil?
plural_identifiers = [{ project: project_name }]

next_identifiers = []
Expand Down Expand Up @@ -69,7 +69,7 @@
output = "Writing #{File.expand_path(output_folder)}/CloudFunction_#{i}.rb"
describe output do
# Prints pretty message when writing controls to files
its('length') { should be >= 0 }
its("length") { should be >= 0 }
end
i += 1
end
Expand Down
38 changes: 19 additions & 19 deletions generate/gen-controls/compute_autoscaler.rb
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
# frozen_string_literal: true

require 'yaml'
require 'logger'

title 'Test GCP google_compute_autoscaler resource.'
require "yaml"
require "logger"

title "Test GCP google_compute_autoscaler resource."
# rubocop:disable Metrics/BlockLength
control 'google_compute_autoscaler-1.0' do
control "google_compute_autoscaler-1.0" do
impact 1.0
title 'google_compute_autoscaler resource test'
title "google_compute_autoscaler resource test"

logger = Logger.new(STDOUT)
logger.level = Logger::WARN
logger.warn('Generating tests for google_compute_autoscaler')
logger.warn("Generating tests for google_compute_autoscaler")
filters = []
ignored_fields = []
output_folder = ENV['OUTPUT_PATH']
output_folder = ENV["OUTPUT_PATH"]

if output_folder.nil?
output_folder = File.join(File.dirname(__FILE__), '../../generated_tests')
output_folder = File.join(File.dirname(__FILE__), "../../generated_tests")
logger.warn("Undefined output folder path at variable OUTPUT_PATH. Defaulting to #{File.expand_path(output_folder)}")
end

Dir.mkdir(output_folder) unless File.exist?(output_folder)
template_path = File.join(File.dirname(__FILE__), '../../generated_test_template.erb')
config_folder = ENV['CNF_PATH']
logger.warn('Undefined configuration folder path at variable CNF_PATH. Ignoring configuration files')
template_path = File.join(File.dirname(__FILE__), "../../generated_test_template.erb")
config_folder = ENV["CNF_PATH"]
logger.warn("Undefined configuration folder path at variable CNF_PATH. Ignoring configuration files")
unless config_folder.nil?
file_name = File.join(config_folder, 'google_compute_autoscaler.yaml')
file_name = File.join(config_folder, "google_compute_autoscaler.yaml")
if File.file?(file_name)
config = YAML.load_file(file_name)
config_filters = config['filters']
config_filters = config["filters"]
config_filters.each do
# This is not currently implemented
logger.warn('Filters are not currently supported, ignoring')
logger.warn("Filters are not currently supported, ignoring")
end
config_ignored = config['ignore_fields']
config_ignored = config["ignore_fields"]
ignored_fields += config_ignored
end
end
project_name = ENV['GCP_PROJECT_NAME']
raise 'Undefined project name, please set the GCP_PROJECT_NAME variable' if project_name.nil?
project_name = ENV["GCP_PROJECT_NAME"]
raise "Undefined project name, please set the GCP_PROJECT_NAME variable" if project_name.nil?
plural_identifiers = [{ project: project_name }]

next_identifiers = []
Expand Down Expand Up @@ -69,7 +69,7 @@
output = "Writing #{File.expand_path(output_folder)}/Autoscaler_#{i}.rb"
describe output do
# Prints pretty message when writing controls to files
its('length') { should be >= 0 }
its("length") { should be >= 0 }
end
i += 1
end
Expand Down
38 changes: 19 additions & 19 deletions generate/gen-controls/compute_backend_bucket.rb
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
# frozen_string_literal: true

require 'yaml'
require 'logger'

title 'Test GCP google_compute_backend_bucket resource.'
require "yaml"
require "logger"

title "Test GCP google_compute_backend_bucket resource."
# rubocop:disable Metrics/BlockLength
control 'google_compute_backend_bucket-1.0' do
control "google_compute_backend_bucket-1.0" do
impact 1.0
title 'google_compute_backend_bucket resource test'
title "google_compute_backend_bucket resource test"

logger = Logger.new(STDOUT)
logger.level = Logger::WARN
logger.warn('Generating tests for google_compute_backend_bucket')
logger.warn("Generating tests for google_compute_backend_bucket")
filters = []
ignored_fields = []
output_folder = ENV['OUTPUT_PATH']
output_folder = ENV["OUTPUT_PATH"]

if output_folder.nil?
output_folder = File.join(File.dirname(__FILE__), '../../generated_tests')
output_folder = File.join(File.dirname(__FILE__), "../../generated_tests")
logger.warn("Undefined output folder path at variable OUTPUT_PATH. Defaulting to #{File.expand_path(output_folder)}")
end

Dir.mkdir(output_folder) unless File.exist?(output_folder)
template_path = File.join(File.dirname(__FILE__), '../../generated_test_template.erb')
config_folder = ENV['CNF_PATH']
logger.warn('Undefined configuration folder path at variable CNF_PATH. Ignoring configuration files')
template_path = File.join(File.dirname(__FILE__), "../../generated_test_template.erb")
config_folder = ENV["CNF_PATH"]
logger.warn("Undefined configuration folder path at variable CNF_PATH. Ignoring configuration files")
unless config_folder.nil?
file_name = File.join(config_folder, 'google_compute_backend_bucket.yaml')
file_name = File.join(config_folder, "google_compute_backend_bucket.yaml")
if File.file?(file_name)
config = YAML.load_file(file_name)
config_filters = config['filters']
config_filters = config["filters"]
config_filters.each do
# This is not currently implemented
logger.warn('Filters are not currently supported, ignoring')
logger.warn("Filters are not currently supported, ignoring")
end
config_ignored = config['ignore_fields']
config_ignored = config["ignore_fields"]
ignored_fields += config_ignored
end
end
project_name = ENV['GCP_PROJECT_NAME']
raise 'Undefined project name, please set the GCP_PROJECT_NAME variable' if project_name.nil?
project_name = ENV["GCP_PROJECT_NAME"]
raise "Undefined project name, please set the GCP_PROJECT_NAME variable" if project_name.nil?
plural_identifiers = [{ project: project_name }]

all_identifiers = []
Expand All @@ -60,7 +60,7 @@
output = "Writing #{File.expand_path(output_folder)}/BackendBucket_#{i}.rb"
describe output do
# Prints pretty message when writing controls to files
its('length') { should be >= 0 }
its("length") { should be >= 0 }
end
i += 1
end
Expand Down
Loading