<commit_before>package com.redhat.ceylon.compiler.typechecker.analyzer;

import com.redhat.ceylon.cmr.api.ArtifactContext;
import com.redhat.ceylon.compiler.typechecker.exceptions.LanguageModuleNotFoundException;
import com.redhat.ceylon.compiler.typechecker.model.Module;
import com.redhat.ceylon.compiler.typechecker.model.ModuleImport;

import java.util.LinkedList;

/**
 * @author <NAME> <<EMAIL>>
 */
public class ModuleHelper {
    private ModuleHelper() {}

    public static void buildErrorOnMissingArtifact(
            ArtifactContext artifactContext,
            Module module,
            ModuleImport moduleImport,
            LinkedList<Module> dependencyTree,
            Exception exceptionOnGetArtifact,
            ModuleManager moduleManager) {
        StringBuilder error = new StringBuilder("cannot find module ");
        if ( ArtifactContext.SRC.equals( artifactContext.getSuffix() ) ) {
            error.append("source ");
        }
        error.append("artifact ");
        error.append( artifactContext.toString() );
        if ( exceptionOnGetArtifact != null ) {
            error.append( "\ndue to connection error: " + exceptionOnGetArtifact.getMessage() );
        }
        //FIXME add list of repositories when ceylon/ceylon-module-resolver/issues/26 is fixed<commit_msg>Minor change due to API change in ArtifactContext (ceylon/ceylon-module-resolver#63)<commit_after>package com.redhat.ceylon.compiler.typechecker.analyzer;

import com.redhat.ceylon.cmr.api.ArtifactContext;
import com.redhat.ceylon.cmr.maven.AetherUtils;
import com.redhat.ceylon.compiler.typechecker.exceptions.LanguageModuleNotFoundException;
import com.redhat.ceylon.compiler.typechecker.model.Module;
import com.redhat.ceylon.compiler.typechecker.model.ModuleImport;

import java.util.LinkedList;

/**
 * @author <NAME> <<EMAIL>>
 */
public class ModuleHelper {
    private ModuleHelper() {}

    public static void buildErrorOnMissingArtifact(
            ArtifactContext artifactContext,
            Module module,
            ModuleImport moduleImport,
            LinkedList<Module> dependencyTree,
            Exception exceptionOnGetArtifact,
            ModuleManager moduleManager) {
        StringBuilder error = new StringBuilder("cannot find module ");
        if (AetherUtils.arrayContains(artifactContext.getSuffixes(), ArtifactContext.SRC)) {
            error.append("source ");
        }
        error.append("artifact ");
        error.append( artifactContext.toString() );
        if ( exceptionOnGetArtifact != null ) {
            error.append( "\ndue to connection error: " + exceptionOnGetArtifact.getMessage() );
        }
        //FIXME add list of repositories when ceylon/ceylon-module-resolver/issues/26 is fixed
{'fraction_non_alphanumeric': 0.09785376500545653, 'fraction_numerical': 0.0021826118588577663, 'mean_word_length': 3.283489096573209, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5218402', 'n_tokens_mistral': 750, 'n_tokens_neox': 730, 'n_words': 143}