<commit_before>package au.com.dius.pact.provider.maven

import au.com.dius.pact.provider.ProviderUtils
import au.com.dius.pact.provider.ProviderVerifier
import org.apache.maven.plugin.AbstractMojo
import org.apache.maven.plugin.MojoExecutionException
import org.apache.maven.plugin.MojoFailureException
import org.apache.maven.plugins.annotations.Mojo
import org.apache.maven.plugins.annotations.Parameter
import org.apache.maven.plugins.annotations.ResolutionScope
import org.fusesource.jansi.AnsiConsole

/**
 * Pact Verify Maven Plugin
 */
@Mojo(name = 'verify', requiresDependencyResolution = ResolutionScope.TEST)
class PactProviderMojo extends AbstractMojo {

  @Parameter(defaultValue = '${project.testClasspathElements}', required = true)
  private List<String> classpathElements

  @Parameter
  private List<Provider> serviceProviders

  @Parameter
  @SuppressWarnings('PrivateFieldCouldBeFinal')
  private Map<String, String> configuration = [:]

  @Parameter(required = true, defaultValue = '${project.version}')
  private String projectVersion

  @Override
  void execute() throws MojoExecutionException, MojoFailureException {
    AnsiConsole.systemInstall()

    Map failures = [:]
    ProviderVerifier verifier = new ProviderVerifier()
    verifier.projectHasProperty = { this.propertyDefined(it) }
    verifier.projectGetProperty =  { this.property(it) }
    verifier.pactLoadFailureMessage = { consumer ->
      "You must specify the pactfile to execute for consumer '${consumer.name}' (use <pactFile> or <pactUrl>)"
    }
    verifier.isBuildSpecificTask = { false }
    verifier.providerVersion = { projectVersion }

    verifier.projectClasspath = {
      List<URL> urls = []
      for (element in classpathElements) {
        urls.add(new File(element).toURI().toURL())
      }
      urls as URL[]
    }

    serviceProviders.each { provider ->
      List consumers = []
      consumers.addAll(provider.consumers)
      if (provider.pactFileDirectory != null) {
          consumers.addAll(loadPactFiles(provider, provider.pactFileDirectory))<commit_msg>Fix codenarc voilation<commit_after>package au.com.dius.pact.provider.maven

import au.com.dius.pact.provider.ProviderUtils
import au.com.dius.pact.provider.ProviderVerifier
import org.apache.maven.plugin.AbstractMojo
import org.apache.maven.plugin.MojoExecutionException
import org.apache.maven.plugin.MojoFailureException
import org.apache.maven.plugins.annotations.Mojo
import org.apache.maven.plugins.annotations.Parameter
import org.apache.maven.plugins.annotations.ResolutionScope
import org.fusesource.jansi.AnsiConsole

/**
 * Pact Verify Maven Plugin
 */
@Mojo(name = 'verify', requiresDependencyResolution = ResolutionScope.TEST)
class PactProviderMojo extends AbstractMojo {

  @Parameter(defaultValue = '${project.testClasspathElements}', required = true)
  private List<String> classpathElements

  @Parameter
  private List<Provider> serviceProviders

  @Parameter
  @SuppressWarnings('PrivateFieldCouldBeFinal')
  private Map<String, String> configuration = [:]

  @Parameter(required = true, defaultValue = '${project.version}')
  private String projectVersion

  @Override
  void execute() throws MojoExecutionException, MojoFailureException {
    AnsiConsole.systemInstall()

    Map failures = [:]
    ProviderVerifier verifier = new ProviderVerifier().with {
      projectHasProperty = { this.propertyDefined(it) }
      projectGetProperty = { this.property(it) }
      pactLoadFailureMessage = { consumer ->
        "You must specify the pactfile to execute for consumer '${consumer.name}' (use <pactFile> or <pactUrl>)"
      }
      isBuildSpecificTask = { false }
      providerVersion = { projectVersion }

      projectClasspath = {
        List<URL> urls = []
        for (element in classpathElements) {
          urls.add(new File(element).toURI().toURL())
        }
        urls as URL[]
      }
    }

    serviceProviders.each { provider ->
      List consumers = []
      consumers.addAll(provider.consumers)
      if (provider.pactFileDirectory != null) {
          consumers.addAll(loadPactFiles(provider, provider.pactFileDirectory))
{'fraction_non_alphanumeric': 0.10209992758870384, 'fraction_numerical': 0.0, 'mean_word_length': 4.252217997465146, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 19, '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': '2567006', 'n_tokens_mistral': 1208, 'n_tokens_neox': 1171, 'n_words': 231}