def METHOD_NAME(req_file, dependencies, errors, check_name=None):
    for line in stream_file_lines(req_file):
        line = line.strip()
        if not line or line.startswith('#'):
            continue
        try:
            req = Requirement(line)
        except InvalidRequirement as e:
            errors.append(f'File `{os.path.basename(req_file)}` has an invalid dependency: `{line}`\n{e}')
            continue
        project = dependencies[normalize_project_name(req.name)]
        dependency = get_normalized_dependency(req)
        set_project_dependency(project, dependency, check_name)