Skip to content

Commit

Permalink
Coderabbitai review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
zzaakiirr committed Jan 21, 2025
1 parent 5fb652b commit ae23469
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/core/terraform_config/policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def target_query_spec_terms_tf(spec)
end

def validate_term!(term)
return unless (%i[property rel tag] & term.keys).count > 1
return if (%i[property rel tag] & term.keys).count == 1

raise ArgumentError,
"Each term in `target_query.spec.terms` must contain exactly one of the following attributes: " \
Expand Down
4 changes: 2 additions & 2 deletions lib/core/terraform_config/secret.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ def prepare_data(type:, data:)
end

def validate_required_data_keys!(type:, data:)
required = REQUIRED_DATA_KEYS[type]
missing_keys = required - data.keys
required_keys = REQUIRED_DATA_KEYS[type] || []
missing_keys = required_keys - data.keys
raise ArgumentError, "Missing required data keys for #{type}: #{missing_keys.join(', ')}" if missing_keys.any?
end

Expand Down
2 changes: 1 addition & 1 deletion lib/core/terraform_config/workload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def container_args(container) # rubocop:disable Metrics/MethodLength
post_start: container.dig(:lifecycle, :post_start, :exec, :command),
pre_stop: container.dig(:lifecycle, :pre_stop, :exec, :command),
inherit_env: container.fetch(:inherit_env, nil),
envs: ("local.#{container_name}_envs" if container[:env]),
envs: ("local.#{container_name}_envs" if container[:env]&.any?),
ports: container.fetch(:ports, nil),
readiness_probe: container.fetch(:readiness_probe, nil)&.slice(*LIVENESS_PROBE_KEYS),
liveness_probe: container.fetch(:liveness_probe, nil)&.slice(*LIVENESS_PROBE_KEYS),
Expand Down
4 changes: 3 additions & 1 deletion spec/command/terraform/generate_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@
let(:template_dir) { "non-existing-folder" }

before do
allow_any_instance_of(TemplateParser).to receive(:template_dir).and_return(template_dir) # rubocop:disable RSpec/AnyInstance
template_parser = instance_double(TemplateParser)
allow(TemplateParser).to receive(:new).and_return(template_parser)
allow(template_parser).to receive(:template_dir).and_return(template_dir)
end

it_behaves_like "generates terraform config files" do
Expand Down

0 comments on commit ae23469

Please sign in to comment.