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

Engine: Fixing lint problems #3457

Closed
wants to merge 1 commit 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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 10 additions & 19 deletions app/controllers/katello/api/v1/systems_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -324,25 +324,16 @@ def report # rubocop:disable MethodLength

system_report = Util::ReportTable.new(
:data => data,
:column_names => ["name",
"uuid",
"location",
"organization",
"environment",
"created_at",
"updated_at",
"compliance_color",
"compliant_until",
"custom_info"
],
:transforms => lambda { |r|
r.organization = r.organization.name
r.environment = r.environment.name
r.created_at = r.created_at.to_s
r.updated_at = r.updated_at.to_s
r.compliant_until = r.compliant_until.to_s
r.custom_info = r.custom_info.collect { |info| info.to_s }.join(", ")
}
:column_names => %w(name uuid location organization environment created_at updated_at
compliance_color compliant_until custom_info),
:transforms => (lambda do |r|
r.organization = r.organization.name
r.environment = r.environment.name
r.created_at = r.created_at.to_s
r.updated_at = r.updated_at.to_s
r.compliant_until = r.compliant_until.to_s
r.custom_info = r.custom_info.collect { |info| info.to_s }.join(", ")
end)
)
respond_to do |format|
format.text { render :text => system_report.as(:text) }
Expand Down
10 changes: 5 additions & 5 deletions app/lib/katello/util/report_table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def initialize(params)
self.data = params[:data]
self.renamed_columns = {}
self.column_hash = {}
column_names.each{ |name| column_hash[name] = {:name=>name}}
column_names.each{ |name| column_hash[name] = {:name => name}}
end

def rename_column(original, new)
Expand All @@ -33,9 +33,9 @@ def rename_column(original, new)

def as(type)
if type == :csv
as_csv(transform_data())
as_csv(transform_data)
elsif type == :text
as_text(transform_data())
as_text(transform_data)
end
end

Expand Down Expand Up @@ -84,9 +84,9 @@ def text_separator(size)

def pad(string, max_size)
new_spaces = max_size - string.size
left = new_spaces/2.to_i
left = new_spaces / 2.to_i
right = new_spaces - left
(" "*left) + string + (" "*right)
(" " * left) + string + (" " * right)
end

def as_csv(transformed_data)
Expand Down
2 changes: 1 addition & 1 deletion app/models/katello/system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def rollback_on_create
Tire.index('katello_system').refresh
end

def reportable_data(options={})
def reportable_data(options = {})
hash = self.as_json(options.slice(:only, :except))
if options[:methods]
options[:methods].each{ |method| hash[method] = self.send(method) }
Expand Down