class DefaultProjectArtifactFactory implements ProjectArtifactFactory {
    private final ArtifactFactory artifactFactory;

    @Inject
    public DefaultProjectArtifactFactory(ArtifactFactory artifactFactory) {
        this.artifactFactory = artifactFactory;
    }

    @Override
    public Set<Artifact> createArtifacts(MavenProject project) throws InvalidDependencyVersionException {
        return createArtifacts(artifactFactory, project.getDependencies(), null, null, project);
    }

    public static Set<Artifact> createArtifacts(
            ArtifactFactory artifactFactory,
            List<Dependency> dependencies,
            String inheritedScope,
            ArtifactFilter dependencyFilter,
            MavenProject project)
            throws InvalidDependencyVersionException {
        Set<Artifact> artifacts = new LinkedHashSet<>();

        for (Dependency d : dependencies) {
            Artifact dependencyArtifact;
            try {
                dependencyArtifact = createDependencyArtifact(artifactFactory, d, inheritedScope, dependencyFilter);
            } catch (InvalidVersionSpecificationException e) {
                throw new InvalidDependencyVersionException(project.getId(), d, project.getFile(), e);
            }

            if (dependencyArtifact != null) {
                artifacts.add(dependencyArtifact);
            }
        }

        return artifacts;
    }

    private static Artifact createDependencyArtifact(
            ArtifactFactory factory, Dependency dependency, String inheritedScope, ArtifactFilter inheritedFilter)
            throws InvalidVersionSpecificationException {
        String effectiveScope = getEffectiveScope(dependency.getScope(), inheritedScope);

        if (effectiveScope == null) {
            return null;
        }

        VersionRange versionRange = VersionRange.createFromVersionSpec(dependency.getVersion());

        Artifact dependencyArtifact = factory.createDependencyArtifact(
                dependency.getGroupId(),
                dependency.getArtifactId(),
                versionRange,
                dependency.getType(),
                dependency.getClassifier(),
                effectiveScope,
                dependency.isOptional());

        if (inheritedFilter != null && !inheritedFilter.include(dependencyArtifact)) {
            return null;
        }

        if (Artifact.SCOPE_SYSTEM.equals(effectiveScope)) {
            dependencyArtifact.setFile(new File(dependency.getSystemPath()));
        }

        dependencyArtifact.setDependencyFilter(createDependencyFilter(dependency, inheritedFilter));

        return dependencyArtifact;
    }

    private static String getEffectiveScope(String originalScope, String inheritedScope) {<FILL_FUNCTION_BODY>}

    private static ArtifactFilter createDependencyFilter(Dependency dependency, ArtifactFilter inheritedFilter) {
        ArtifactFilter effectiveFilter = inheritedFilter;

        if (!dependency.getExclusions().isEmpty()) {
            effectiveFilter = new ExclusionArtifactFilter(dependency.getExclusions());

            if (inheritedFilter != null) {
                effectiveFilter = new AndArtifactFilter(Arrays.asList(inheritedFilter, effectiveFilter));
            }
        }

        return effectiveFilter;
    }
}

        String effectiveScope = Artifact.SCOPE_RUNTIME;

        if (originalScope == null) {
            originalScope = Artifact.SCOPE_COMPILE;
        }

        if (inheritedScope == null) {
            // direct dependency retains its scope
            effectiveScope = originalScope;
        } else if (Artifact.SCOPE_TEST.equals(originalScope) || Artifact.SCOPE_PROVIDED.equals(originalScope)) {
            // test and provided are not transitive, so exclude them
            effectiveScope = null;
        } else if (Artifact.SCOPE_SYSTEM.equals(originalScope)) {
            // system scope come through unchanged...
            effectiveScope = Artifact.SCOPE_SYSTEM;
        } else if (Artifact.SCOPE_COMPILE.equals(originalScope) && Artifact.SCOPE_COMPILE.equals(inheritedScope)) {
            // added to retain compile scope. Remove if you want compile inherited as runtime
            effectiveScope = Artifact.SCOPE_COMPILE;
        } else if (Artifact.SCOPE_TEST.equals(inheritedScope)) {
            effectiveScope = Artifact.SCOPE_TEST;
        } else if (Artifact.SCOPE_PROVIDED.equals(inheritedScope)) {
            effectiveScope = Artifact.SCOPE_PROVIDED;
        }

        return effectiveScope;
    
<no_super_class>