Skip to content

Commit

Permalink
Refs #18520 - fix rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
iNecas committed Apr 27, 2017
1 parent 8b86a77 commit 38ea7f5
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 17 deletions.
3 changes: 2 additions & 1 deletion Gemfile
Expand Up @@ -3,7 +3,8 @@ source "https://rubygems.org"
# Declare your gem's dependencies in tasks.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec

gemspec :name => 'foreman-tasks'

# Declare any dependencies that are still in development here instead of in
# your gemspec. These might include edge Rails or gems from your path or
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/foreman_tasks/foreman_tasks_helper.rb
Expand Up @@ -116,7 +116,7 @@ def future_mode_fieldset(f, triggering)
tags = []
tags << text_f(f, :start_at_raw, :label => _('Start at'), :placeholder => 'YYYY-mm-dd HH:MM')
tags << text_f(f, :start_before_raw, :label => _('Start before'), :placeholder => 'YYYY-mm-dd HH:MM',
:label_help => _('Indicates that the action should be cancelled if it cannot be started before this time.'))
:label_help => _('Indicates that the action should be cancelled if it cannot be started before this time.'))
content_tag(:fieldset, nil, :id => 'trigger_mode_future', :class => "trigger_mode_form #{'hidden' unless triggering.future?}") do
tags.join.html_safe
end
Expand Down
1 change: 0 additions & 1 deletion app/lib/actions/bulk_action.rb
@@ -1,6 +1,5 @@
module Actions
class BulkAction < Actions::ActionWithSubPlans

include Dynflow::Action::WithBulkSubPlans

# == Parameters:
Expand Down
14 changes: 7 additions & 7 deletions app/models/foreman_tasks/concerns/action_triggering.rb
Expand Up @@ -108,13 +108,13 @@ def dynflow_task_wrap(method)
@_dynflow_task_wrapped = true

@_dynflow_hook_action = case method
when :save
new_record? ? create_action : update_action
when :destroy
destroy_action
else
raise 'unexpected method'
end
when :save
new_record? ? create_action : update_action
when :destroy
destroy_action
else
raise 'unexpected method'
end
ensure_not_in_transaction! if @_dynflow_hook_action
yield.tap do |result|
execute_planned_action if result
Expand Down
8 changes: 4 additions & 4 deletions app/models/foreman_tasks/task.rb
Expand Up @@ -38,10 +38,10 @@ class Task < ActiveRecord::Base
scoped_search :on => :parent_task_id, :complete_value => true
scoped_search :relation => :locks, :on => :resource_type, :complete_value => true, :rename => 'resource_type', :ext_method => :search_by_generic_resource
scoped_search :relation => :locks, :on => :resource_id, :complete_value => false, :rename => 'resource_id', :ext_method => :search_by_generic_resource
scoped_search :relation => :owners,
:on => :id,
:complete_value => true,
:rename => 'owner.id',
scoped_search :relation => :owners,
:on => :id,
:complete_value => true,
:rename => 'owner.id',
:ext_method => :search_by_owner,
:validator => ->(value) { ScopedSearch::Validators::INTEGER.call(value) || value == 'current_user' }
scoped_search :relation => :owners, :on => :login, :complete_value => true, :rename => 'owner.login', :ext_method => :search_by_owner
Expand Down
1 change: 1 addition & 0 deletions lib/foreman_tasks/dynflow/daemon.rb
Expand Up @@ -19,6 +19,7 @@ def run(foreman_root = Dir.pwd)
end

# run the executor as a daemon
# rubocop:disable Metrics/MethodLength
def run_background(command = 'start', options = {})
default_options = { foreman_root: Dir.pwd,
process_name: 'dynflow_executor',
Expand Down
6 changes: 3 additions & 3 deletions lib/foreman_tasks/tasks/test.rake
Expand Up @@ -16,9 +16,9 @@ namespace :foreman_tasks do
begin
require 'rubocop/rake_task'
RuboCop::RakeTask.new(:rubocop_foreman_tasks) do |task|
task.patterns = ["#{ForemanTasks::Engine.root}/app/**/*.rb",
"#{ForemanTasks::Engine.root}/lib/**/*.rb",
"#{ForemanTasks::Engine.root}/test/**/*.rb"]
task.patterns = ["#{ForemanTasks::Engine.root}/app/**/*.rb",
"#{ForemanTasks::Engine.root}/lib/**/*.rb",
"#{ForemanTasks::Engine.root}/test/**/*.rb"]
end
rescue
puts 'Rubocop not loaded.'
Expand Down
1 change: 1 addition & 0 deletions test/unit/task_test.rb
Expand Up @@ -99,6 +99,7 @@ class TasksTest < ActiveSupport::TestCase
end

it 'calculates the progress report correctly when using batch planning' do
# rubocop:disable Style/RedundantSelf - not redundant, as otherwise it conflicts with local variable
result_base = self.result_base.merge(:success => 1, :error => 1, :total => 25)
fake_action = OpenStruct.new(:total_count => 25)
task.stubs(:main_action).returns(fake_action)
Expand Down

0 comments on commit 38ea7f5

Please sign in to comment.