rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
 rubocop:disable Metrics/MethodLength, Metrics/PerceivedComplexity
7830
def build
      base_iml = "#{@name}.iml"

      doc = REXML::Document.new
      doc.context[:attribute_quote] = :quote

      mod = doc.add_element 'module', 'type' => 'JAVA_MODULE', 'version' => '4'
      root = mod.add_element 'component', 'name' => 'NewModuleRootManager', 'inherit-compiler-output' => 'true'
      root.attributes['LANGUAGE_LEVEL'] = @lang_level if @lang_level
      root.add_element 'exclude-output'

      content = root.add_element 'content', 'url' => 'file://$MODULE_DIR$'

      srcs = @srcs || []
      srcs = [srcs] unless srcs.is_a? Array
      srcs.each do |src|
        src = { path: src } unless src.is_a? Hash
        is_test = src[:test]
        is_test = false if is_test.nil?
        type = src[:type] || :java
        path = src[:path]
        e = { 'url' => "file://$MODULE_DIR$/#{path}" }
        if type == :java
          e['isTestSource'] = is_test.to_s
        elsif %i(res resources).include?(type)
          e['type'] = is_test ? 'java-test-resource' : 'java-resource'
        else
          raise "unknown source type: #{type}"
        end
        content.add_element 'sourceFolder', e
      end

      excl = @exclude || []
      excl = [excl] unless excl.is_a? Array
      excl.each do |path|
        content.add_element 'excludeFolder', 'url' => "file://$MODULE_DIR$/#{path}"
      end

      root.add_element 'orderEntry', 'type' => 'inheritedJdk'
      root.add_element 'orderEntry', 'type' => 'sourceFolder', 'forTests' => 'false'

      mods = @mods || []
      mods = [mods] unless mods.is_a? Array
      mods.each do |m|
        m = { name: m } unless m.is_a? Hash
        name = m[:name]
        export = m[:export]
        export = true if export.nil?
        e = { 'type' => 'module', 'module-name' => name }
        e['exported'] = '' if export
        root.add_element 'orderEntry', e
      end

      cur_path = File.expand_path(File.dirname(base_iml))
      libs = @libs.map do |lib|
        next unless lib.src.end_with?('.jar', '.zip')

        jar_path = File.expand_path(lib.src)
        src_path = lib[:src]
        src_path = src_path.src unless src_path.nil?
        src_path = File.expand_path(src_path) unless src_path.nil?

        jar_path = Pathname.new(jar_path).relative_path_from(Pathname.new(cur_path)).to_s
        src_path = Pathname.new(src_path).relative_path_from(Pathname.new(cur_path)).to_s unless src_path.nil?

        { jar: jar_path, src: src_path, export: lib[:export] }
      end

      libs.compact!
      libs.sort! { |l1, l2| l1[:jar] <=> l2[:jar] }

      libs.each do |lib|
        jar_path = lib[:jar]
        src_path = lib[:src]

        e = { 'type' => 'module-library' }
        e['exported'] = '' if lib[:export]
        entry = root.add_element 'orderEntry', e
        lib = entry.add_element 'library', 'name' => Pathname.new(jar_path).basename
        lib.add_element('CLASSES').add_element('root', 'url' => "jar://$MODULE_DIR$/#{jar_path}!/")
        lib.add_element('JAVADOC')
        sources = lib.add_element('SOURCES')
        sources.add_element('root', 'url' => "jar://$MODULE_DIR$/#{src_path}!/") unless src_path.nil?
      end

      iml = job_path("#{@name}.iml")
      File.open(iml, 'w') do |f|
        f.puts '<?xml version="1.0" encoding="UTF-8"?>'
        REXML::Formatters::Pretty.new(2, true).write(doc, f)
      end
      FileUtils.cp(iml, base_iml)

      iml
    end
1210266
def method_missing(name, *args, **config, &block)
      if respond_to_missing?(name)
        config[:type] = name
        on(*args, config, &block)
      else
        super
      end
    end
119181
def method_missing(method, *args, &block)
      if method.to_s =~ UNIT_LIST_REGEX

        if $2 || $4 || $6
          conditions = []

          conditions << "unit.is_#{$2}_unit?"     if $2
          conditions << "!unit.is_prefixed_unit?" if $4
          conditions << "unit.is_#{$6}_unit?"     if $6

          units = Unit.units.values.select { |unit| instance_eval(conditions.join(" && ")) }
        else
          units = Unit.units.values
        end

        return_format = ( $8 ? $8.to_sym : nil )
        units.map(&return_format).to_a
        
      elsif unit = Unit.for(method)

        return unit
      else

        super
      end
    end
499256
def method_missing(method, *args, &block)
      name = method.to_s
      if respond_to_missing? name
        @bases[name]
      else
        super(method, *args, &block)
      end
    end
45923
def result
      @task = 'rubocop'
      @path = discover_path

      return unless temp_config(@task) && path_exists?(@path)

      rubo = `rubocop #{@path} --require #{reporter_path('rubocop')} --config #{temp_config(@task)} --format RuboCop::Formatter::MaximusRuboFormatter #{'-R' if is_rails?}`

      @output[:files_inspected] ||= files_inspected('rb', ' ')
      refine rubo
    end
173060
def method_missing name, *values, &block
      return @_confs.send( name, *values, &block ) if @_confs.respond_to? name     # @_confs methods are highest priority
    end
899783
def method_missing(method, *args, &block)
      method = method.to_sym
      if @modules.keys.include?(method)
        @modules[method]
      elsif available_modules.include?(method)
        @dummy_module
      else
        process_command method, *args
      end
    end
469133
def adapt_example!(parsed_example, gathered_comments)
      # Saving off the original data
      parsed_example['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_example))

      # Removing parsed data for child elements in order to avoid duplicating data
      parsed_example['cuke_modeler_parsing_data']['tags'] = nil
      parsed_example['cuke_modeler_parsing_data']['rows'] = nil

      if parsed_example['comments']
        parsed_example['cuke_modeler_parsing_data']['comments'] = nil
        gathered_comments.concat(parsed_example['comments'])
      end

      parsed_example['rows'].each do |row|
        adapt_table_row!(row, gathered_comments)
      end

      if parsed_example['tags']
        parsed_example['tags'].each do |tag|
          adapt_tag!(tag)
        end
      end
    end
1130190
def bad_params?(params, required, optional = nil)
    required.each {|r|
      next if params[r]
      reply.json(400, error: 'invalid_request', error_description: "no #{r} in request")
      return true
    }
    return false unless optional
    params.each {|k, v|
      next if required.include?(k) || optional.include?(k)
      reply.json(400, error: 'invalid_request', error_description: "#{k} not allowed")
      return true
    }
    false
  end
575066
def method_missing(meth, *args, &block)
      @namespace = meth.to_s
      @message   = (args.first.to_s == 'debug') ? nil : args.first.to_s
      self.send :output!
    end
328062
def load
      if loaded? || limit_value.nil?
        super
      else
        @values[:limit] = limit_value + 1
        # FIXME: this could be removed when we're dropping AR 4 support
        @arel.limit = @values[:limit] if @arel && (Integer === @arel.limit)
        super
        @values[:limit] = limit_value - 1
        # FIXME: this could be removed when we're dropping AR 4 support
        @arel.limit = @values[:limit] if @arel && (Integer === @arel.limit)

        if @records.any?
          @records = @records.dup if (frozen = @records.frozen?)
          @_has_next = !!@records.delete_at(limit_value)
          @records.freeze if frozen
        end

        self
      end
    end
1226109
def method_missing(method)
      method = method.to_s
      raise NoMethodError, "No such method: #{method}" unless @args.keys.include? method
      @args[method]
    end
35528
def <<(patch)
      known_patch = @patches[patch.name]
      if known_patch.nil?
        @patches[patch.name] = patch
      elsif patch.content != known_patch.content
        raise ContradictionError, [known_patch, patch]
      end
    end
966171
def errors
      found_errors = @record.all('[data-error-for]')
      error_list = ActiveModel::Errors.new(self)
      found_errors.each do | error |
        attribute = error['data-error-for']
        message = error.text
        error_list.add(attribute, message)
      end
      error_list
    end
414756
def method_missing(method_name, *args, &block)
      if observer.respond_to?(method_name.to_sym)
        observer.public_send(method_name.to_sym, *args, &block)
      elsif env.aliases.include?(method_name.to_sym)
        env.send(:target, *args, &block)
      else
        super
      end
    end
1058425
def params
      {}.
      merge!(measurable_params).
      merge!(custom_dimensions).
      merge!(custom_metrics).
      reject {|_,v| v.nil?}
    end
738331
def method_missing(method_name, *args, &_block)
      args = args.first if args.size == 1
      @events[method_name] = args
    end