rubocop:disable Metrics/ParameterLists
 rubocop:enable Metrics/ParameterLists
493808
def files
      return [] unless path.exist? && path.directory? && !includes.empty?

      Pathname.glob(%(#{path}/{#{includes.join ","}})).select(&:file?)
    end
1352864
def validate_required_params!(params, *required)
      required.flatten.each do |param|
        if !params.key?(param) || params[param].to_s.empty?
          raise ArgumentError, "Missing required parameter: #{param}."
        end
      end
    end
529757
def action_dispatch_params
      action_dispatch_params = env['action_dispatch.request.path_parameters'] || {}
      action_dispatch_params.inject({}) {|hash, (key, value)| hash[key.to_s] = value; hash }
    end
109976
def debug
      ::RSpec.configure do |config|
        config.add_setting :debugger_proc
        config.debugger_proc = ->(ex) do
          exception = ex.exception
          defined?(Pry) ? binding.pry : debugger # rubocop:disable Debugger
        end
        config.after(debug: true) do |ex|
          instance_exec(ex, &config.debugger_proc) if ex.exception
        end
      end
    end
1299527
def initialize_metal
      Rails::Rack::Metal.requested_metals = configuration.metals
      Rails::Rack::Metal.metal_paths = ["#{TRUSTY_CMS_ROOT}/app/metal"] # reset Rails default to TRUSTY_CMS_ROOT
      Rails::Rack::Metal.metal_paths += plugin_loader.engine_metal_paths
      Rails::Rack::Metal.metal_paths += extension_loader.paths(:metal)
      Rails::Rack::Metal.metal_paths.uniq!

      configuration.middleware.insert_before(
        :"ActionController::ParamsParser",
        Rails::Rack::Metal, :if => Rails::Rack::Metal.metals.any?)
    end
730287
def disable_performance_data(self):
        
        # todo: #783 create a dedicated brok for global parameters
        if self.my_conf.process_performance_data:
            self.my_conf.modified_attributes |= \
                DICT_MODATTR["MODATTR_PERFORMANCE_DATA_ENABLED"].value
            self.my_conf.process_performance_data = False
            self.my_conf.explode_global_conf()
            self.daemon.update_program_status()
353746
def run(*parameters)
      resource_name = @link_schema.resource_name
      name = @link_schema.name
      result = @client.send(resource_name).send(name, *parameters)
      result = result.to_a if result.instance_of?(Enumerator)
      if result && !result.instance_of?(String)
        result = MultiJson.dump(result, pretty: true)
      end
      @output.puts(result) unless result.nil?
    end
933638
def create
      params[:user].delete :admin if params[:user]

      # stack definition
      # will be selected from DB as Stack object
      stack = [
        'user1: !task:SearchResource',
        '  class: User',
        '  search_term: "1"',
        'usergroup1: !task:CreateResource',
        '  class: Usergroup',
        '  params:',
        '    name: zzz',
        '    user_ids:',
        '      !reference',
        '        object: user1',
        '        field: result.ids'
      ].join("\n")

      # parse the stack
      stack_definition = ForemanDeployments::StackParser.parse(stack)

      # configure with user input
      # stack_definition.tasks['user1'].configure('params' => params[:user])
      stack_definition.tasks['usergroup1'].configure({})

      # validate
      result = ForemanDeployments::Validation::Validator.validate(stack_definition)
      fail "Validation failed:\n #{result.messages}" unless result.valid?

      ForemanTasks.sync_task(Tasks::StackDeployAction, stack_definition)

      redirect_to foreman_tasks_tasks_path
    end
1239956
def execute
      args = ['rubocop'] + arguments
      todo = target_directory.join('.rubocop_todo.yml')

      replacements = []

      # if adding the .rb extension is enabled, remove the extension again from
      # any output so it matches the actual files names we are linting
      replacements << [/\.erb\.rb/, '.erb'] if rb_extension_enabled

      result = Dir.chdir(target_directory) do
        replacements.unshift([/^#{Regexp.quote(Dir.pwd)}/, current_directory.to_s])
        stdout, stderr, status = Open3.capture3(*args)

        munge_output(stdout, stderr, replacements)

        status.exitstatus
      end

      # copy the todo file back for the case where we've used --auto-gen-config
      FileUtils.cp(todo, current_directory) if todo.exist?

      result
    end
503981
def filter_params
      @_filter_params ||=
        case params[:filter]
        when Hash, ActionController::Parameters
          default_filters.each_with_object({}) do |field, hash|
            unformatted_field = @request.unformat_key(field)
            hash[unformatted_field] = params[:filter][field]
          end
        end
    end
620653
def show(params={})
      key = params.delete(:key)
      Zcloudjp::Client.get("/machines/#{machine.id}/metadata/#{key}", machine.request_options)
    end
6881
def index
      validate_arguments!

      plugins = ::Heroku::Plugin.list

      if plugins.length > 0
        styled_header("Installed Plugins")
        styled_array(plugins)
      end
      ::Heroku::JSPlugin.list
    end
642377
def watchable_args #:nodoc:
      files, dirs = config.watchable_files.dup, config.watchable_dirs.dup

      ActiveSupport::Dependencies.autoload_paths.each do |path|
        dirs[path.to_s] = [:rb]
      end

      [files, dirs]
    end
190545
def inspect
      attrs = [
        [ :repository, repository.name ],
        [ :model,      model           ],
        [ :fields,     fields          ],
        [ :links,      links           ],
        [ :conditions, conditions      ],
        [ :order,      order           ],
        [ :limit,      limit           ],
        [ :offset,     offset          ],
        [ :reload,     reload?         ],
        [ :unique,     unique?         ],
      ]

      "#<#{self.class.name} #{attrs.map { |key, value| "@#{key}=#{value.inspect}" }.join(' ')}>"
    end
1073355
def required_parameters
      required = {}
      @input_parameters.each_value { |v| required[v.name] = v if v.required? }
      required
    end
522078
def build_resource_hash
      @resource_hash = {}
      resources.each do |resource|
        @resource_hash[resource['type']] ||= {}

        title = normalized_title(resource['title'], resource['type'])
        @resource_hash[resource['type']][title] = resource

        if resource.key?('parameters')
          @resource_hash[resource['type']][resource['parameters']['alias']] = resource if resource['parameters'].key?('alias')
          @resource_hash[resource['type']][resource['parameters']['name']] = resource if resource['parameters'].key?('name')
        end
      end
    end
385253
def checkAndCreateParams(self, params):
        
        actual_params = self['parameters'].keys()
        for k, v in params.items():
            if k not in actual_params:
                self['parameters'].append({"name": k, "value": v})
        self.reload()
        return self['parameters'].keys() == params.keys()