Skip to content

Commit

Permalink
Review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
zzaakiirr committed Oct 21, 2024
1 parent 66cb5b4 commit d4e6db4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
8 changes: 2 additions & 6 deletions lib/core/terraform_config/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ def initialize(config:, template:)
@template = template.deep_underscore_keys.deep_symbolize_keys
end

# rubocop:disable Metrics/MethodLength
def filename
def filename # rubocop:disable Metrics/MethodLength
case kind
when "gvc"
"gvc.tf"
Expand All @@ -24,7 +23,6 @@ def filename
raise "Unsupported template kind - #{kind}"
end
end
# rubocop:enable Metrics/MethodLength

def tf_config
method_name = :"#{kind}_config"
Expand All @@ -39,8 +37,7 @@ def kind
@kind ||= template[:kind]
end

# rubocop:disable Metrics/MethodLength
def gvc_config
def gvc_config # rubocop:disable Metrics/MethodLength
TerraformConfig::Gvc.new(
**template
.slice(:name, :description, :tags)
Expand All @@ -53,7 +50,6 @@ def gvc_config
)
)
end
# rubocop:enable Metrics/MethodLength

def identity_config
TerraformConfig::Identity.new(**template.slice(:name, :description, :tags).merge(gvc: gvc))
Expand Down
8 changes: 2 additions & 6 deletions lib/core/terraform_config/policy.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# frozen_string_literal: true

module TerraformConfig
# rubocop:disable Metrics/ClassLength
class Policy < Base
class Policy < Base # rubocop:disable Metrics/ClassLength
TARGET_KINDS = %w[
agent auditctx cloudaccount domain group gvc identity image ipset kubernetes location
org policy quota secret serviceaccount task user volumeset workload
Expand All @@ -12,8 +11,7 @@ class Policy < Base

attr_reader :name, :description, :tags, :target_kind, :gvc, :target, :target_links, :target_query, :bindings

# rubocop:disable Metrics/ParameterLists, Metrics/MethodLength
def initialize(
def initialize( # rubocop:disable Metrics/ParameterLists, Metrics/MethodLength
name:,
description: nil,
tags: nil,
Expand Down Expand Up @@ -42,7 +40,6 @@ def initialize(
@target_query = target_query&.deep_underscore_keys&.deep_symbolize_keys
@bindings = bindings&.map { |data| data.deep_underscore_keys.deep_symbolize_keys }
end
# rubocop:enable Metrics/ParameterLists, Metrics/MethodLength

def to_tf
block :resource, :cpln_policy, name do
Expand Down Expand Up @@ -143,5 +140,4 @@ def validate_term!(term)
"`property`, `rel`, or `tag`."
end
end
# rubocop:enable Metrics/ClassLength
end

0 comments on commit d4e6db4

Please sign in to comment.