At least puppet-extlib has malformed metadata
422336
def get_version_req(dep)
      req = get_key_or_sym(dep, :version_requirement)
      req = get_key_or_sym(dep, :version_range) unless req
      req
    end
34377
def exec_hook(event_name, *args, &block)
      @hooks[event_name.to_s].map do |hook_name, callable|
        begin
          callable.call(*args, &block)
        rescue PuppetDebugger::Exception::Error, ::RuntimeError => e
          errors << e
          e
        end
      end.last
    end
20718
def fix_examples_data
      each_item do |ex|
        ex["name"] = ex["url"] unless ex["name"]

        unless ex["url"] =~ /^https?:\/\//
          ex["url"] = @opts.examples_base_url + ex["url"]
        end
        unless ex["icon"] =~ /^https?:\/\//
          ex["icon"] = @opts.examples_base_url + ex["icon"]
        end

        unless ex["title"]
          ex["title"] = ex["text"]
          ex.delete("text")
        end
        unless ex["description"]
          ex["description"] = ex["desc"]
          ex.delete("desc")
        end
      end
    end
131084
function processMeta (markdownContent) {
  let meta = {};
  let metaArr;
  let metaString;
  let metas;

  let yamlObject;

  switch (true) {
    case _metaRegex.test(markdownContent):
      metaArr = markdownContent.match(_metaRegex);
      metaString = metaArr ? metaArr[1].trim() : '';

      if (metaString) {
        metas = metaString.match(/(.*): (.*)/ig);
        metas.forEach(item => {
          const parts = item.split(': ');
          if (parts[0] && parts[1]) {
            meta[cleanString(parts[0], true)] = parts[1].trim();
          }
        });
      }
      break;

    case _metaRegexYaml.test(markdownContent):
      metaArr = markdownContent.match(_metaRegexYaml);
      metaString = metaArr ? metaArr[1].trim() : '';
      yamlObject = yaml.safeLoad(metaString);
      meta = cleanObjectStrings(yamlObject);
      break;

    default:
    // No meta information
  }

  return meta;
}
334946
def try_eval_metadata(metadata, name):
    """"""
    value = metadata[name]
    if not isinstance(value, (str, unicode)):
        return
    if (value.startswith('"') and value.endswith('"')) or (value.startswith("'") and value.endswith("'")):
        if name in ['active', 'magic_args', 'language']:
            metadata[name] = value[1:-1]
        return
    if value.startswith('c(') and value.endswith(')'):
        value = '[' + value[2:-1] + ']'
    elif value.startswith('list(') and value.endswith(')'):
        value = '[' + value[5:-1] + ']'
    try:
        metadata[name] = ast.literal_eval(value)
    except (SyntaxError, ValueError):
        return
1285687
def has_metadata(source, ext):
    """"""
    _MMD_LIB.has_metadata.argtypes = [ctypes.c_char_p, ctypes.c_int]
    _MMD_LIB.has_metadata.restype = ctypes.c_bool
    return _MMD_LIB.has_metadata(source.encode('utf-8'), ext)
890828
def validate_module_dir(dir)
      # first check to see if manifests directory even exists when path is nil
      if dir.nil?
        dir = '.'
      elsif dir.instance_of?(Array)
        puts 'Retrospec - an array of module paths is not supported at this time'.fatal
        raise Retrospec::Puppet::InvalidModulePathError
      end
      dir = File.expand_path(dir)
      manifest_dir = File.join(dir, 'manifests')
      if !File.exist?(manifest_dir)
        puts "No manifest directory in #{manifest_dir}, cannot validate this is a module".fatal
        raise Retrospec::Puppet::NoManifestDirError
      else
        files = Dir.glob("#{manifest_dir}/**/*.pp")
        warn "No puppet manifest files found at #{manifest_dir}".warning if files.length < 1
        # validate the manifest files, because if one files doesn't work it affects everything
        files.each do |file|
          begin
            parser.parse_file(file)
          rescue Puppet::ParseError
            puts "Manifest file: #{file} has parser errors, please fix and re-check using\n puppet parser validate #{file}".fatal
            raise Retrospec::Puppet::ParserError
          rescue SystemExit => e
            puts "Manifest file: #{file} has parser errors, please fix and re-check using\n puppet parser validate #{file}".fatal
            raise Retrospec::Puppet::ParserError
          end
        end
      end
      dir
    end
213371
def execute_export cmd, metadata
      metadata.store!
      result = ""

      # Execute Export command on the source DB server
      result = metadata.ssh.exec!(cmd)
      
      return result
    end
279705
def copy_metadata(src_path, dest_path, **options)
      stats = ::File.lstat(src_path)
      ::File.utime(stats.atime, stats.mtime, dest_path)
      chmod(dest_path, stats.mode, options)
    end
671060
def clean_meta(rst_content):
    """"""

    rst = rst_content.split('\n')
    for i, line in enumerate(rst):
        if line.startswith('#'):
            continue
        break
    return '\n'.join(rst[i:])
1277466
def check_puppetfile_content
      puppetfile_content = File.read("#{project_root}/puppet/steps/#{step_name}/Puppetfile").strip
      `rm "#{project_root}/puppet/steps/#{step_name}/Puppetfile"` if puppetfile_content.scan(/^\s*(mod\s*.+?)$/).flatten.empty?
    end
36133
def in_bolt_compiler
      r = Puppet::Pal.in_tmp_environment('bolt', modulepath: @modulepath, facts: {}) do |pal|
        pal.with_script_compiler do |compiler|
          alias_types(compiler)
          begin
            Puppet.override(yaml_plan_instantiator: Bolt::PAL::YamlPlan::Loader) do
              yield compiler
            end
          rescue Bolt::Error => e
            e
          rescue Puppet::PreformattedError => e
            PALError.from_preformatted_error(e)
          rescue StandardError => e
            PALError.from_preformatted_error(e)
          end
        end
      end

      # Plans may return PuppetError but nothing should be throwing them
      if r.is_a?(StandardError) && !r.is_a?(Bolt::PuppetError)
        raise r
      end
      r
    end
819379
def com_google_fonts_check_metadata_fontname_not_camel_cased(font_metadata):
  """"""
  import re
  if bool(re.match(r'([A-Z][a-z]+){2,}', font_metadata.name)):
    yield FAIL, ("METADATA.pb: '{}' is a CamelCased name."
                 " To solve this, simply use spaces"
                 " instead in the font name.").format(font_metadata.name)
  else:
    yield PASS, "Font name is not camel-cased."
1180638
def get_dependency_metadata():
    ''''''
    link = os.path.join(_api_url(), 'meta.txt')
    return _process_req_txt(requests.get(link)).split('\n')
648530
def _RunScript(self, metadata_key, metadata_script):
    
    process = subprocess.Popen(
        metadata_script, shell=True,
        executable=self.default_shell,
        stderr=subprocess.STDOUT, stdout=subprocess.PIPE)
    while True:
      for line in iter(process.stdout.readline, b''):
        message = line.decode('utf-8', 'replace').rstrip('\n')
        if message:
          self.logger.info('%s: %s', metadata_key, message)
      if process.poll() is not None:
        break
    self.logger.info('%s: Return code %s.', metadata_key, process.returncode)
281493
def update_with_missing(source_uri, missing_names)
      progress = ui.progress_reporter(missing_names.size,
          "Updating metadata for #{missing_names.size} gems from #{source_uri}")
      missing_names.each do |spec_name|
        gemspec = fetch_single_spec(source_uri, spec_name)
        if gemspec.nil? then
          ui.say "Failed to download spec #{spec_name} from #{source_uri}:\n" \
                   "\t#{@fetch_error.message}"
        else
          add_spec gemspec
          progress.updated spec_name
        end
        @fetch_error = nil
      end
      progress.done
      progress.count
    end
566483
void installPuppetModules( Instance instance )
	throws IOException, InterruptedException {

		// Load the modules names
		File instanceDirectory = InstanceHelpers.findInstanceDirectoryOnAgent( instance );
		File modulesFile = new File( instanceDirectory, "modules.properties" );
		if( ! modulesFile.exists())
			return;

		Properties props = Utils.readPropertiesFile( modulesFile );
		for( Map.Entry<Object,Object> entry : props.entrySet()) {

			List<String> commands = new ArrayList<> ();
			commands.add( "puppet" );
			commands.add( "module" );
			commands.add( "install" );

			String value = entry.getValue().toString();
			if( ! Utils.isEmptyOrWhitespaces( value )) {
				commands.add( "--version" );
				commands.add( value );
			}

			commands.add((String) entry.getKey());
			commands.add( "--target-dir" );
			commands.add( instanceDirectory.getAbsolutePath());

			String[] params = commands.toArray( new String[ 0 ]);
			this.logger.fine( "Module installation: " + Arrays.toString( params ));

			int exitCode = ProgramUtils.executeCommand( this.logger, commands, null, null, this.applicationName, this.scopedInstancePath);
			if( exitCode != 0 )
				throw new IOException( "Puppet modules could not be installed for " + instance + "." );
		}
	}