<commit_before>/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.xwiki.tool.enforcer;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
import org.apache.maven.enforcer.rule.api.EnforcerRuleHelper;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.DependencyManagement;
import org.apache.maven.model.Model;

/**
 * Performs checks on the version specified for dependencies in pom.xml files.
 *
 * For example if we're in XWiki Rendering and there's a dependency on some XWiki Commons module we might want to
 * ensure that it uses a variable (such as {@code ${commons.version}}) and not {@code ${project.version}}. To achieve
 * this you would use:
 *
 * <code><pre>
 *   &lt;rules&gt;
 *     &lt;validateDependencyVersion implementation="org.xwiki.tool.enforcer.ValidateDependencyVersion"&gt;
 *       &lt;versionCheck&gt;
 *         &lt;groupIdPrefix&gt;org.xwiki.commons&lt;/groupIdPrefix&gt;
 *         &lt;allowedVersionRegex&gt;\$\{project.version\}|[^$].*&lt;/allowedVersionRegex&gt;
 *       &lt;/versionCheck&gt;
 *     &lt;/validateDependencyVersion&gt;
 *   &lt;/rules&gt;
 * </pre></code>
 *
 * @version $Id$
 * @since 4.5RC1
 */
public class ValidateDependencyVersion extends AbstractPomCheck
{
    /**
     * List of checks to execute; they are configured in the pom.xml.
     */
    private List<VersionCheck> checks = new ArrayList<VersionCheck>();

    /**
     * Add a new dependency version check. Called automatically by the Maven framework when the following construct
     * is defined in a pom.xml file:
     *
     * <code><pre>
     *   &lt;versionCheck&gt;
     *     &lt;groupIdPrefix&gt;org.xwiki.commons&lt;/groupIdPrefix&gt;
     *     &lt;allowedVersionRegex&gt;.*&lt;/allowedVersionRegex&gt;
     *   &lt;/versionCheck&gt;
     * </pre></code>
     *
     * @param versionCheck the check to add
     */
    public void addVersionCheck(VersionCheck versionCheck)
    {
        this.checks.add(versionCheck);
    }<commit_msg>[Misc] Fix javadoc noticed by java8 which is now stricter by default (a good thing!)<commit_after>/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.xwiki.tool.enforcer;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
import org.apache.maven.enforcer.rule.api.EnforcerRuleHelper;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.DependencyManagement;
import org.apache.maven.model.Model;

/**
 * Performs checks on the version specified for dependencies in pom.xml files.
 *
 * For example if we're in XWiki Rendering and there's a dependency on some XWiki Commons module we might want to
 * ensure that it uses a variable (such as {@code ${commons.version}}) and not {@code ${project.version}}. To achieve
 * this you would use:
 *
 * <pre>{@code
 *   <rules>
 *     <validateDependencyVersion implementation="org.xwiki.tool.enforcer.ValidateDependencyVersion">
 *       <versionCheck>
 *         <groupIdPrefix>org.xwiki.commons</groupIdPrefix>
 *         <allowedVersionRegex>\$\{project.version\}|[^$].*</allowedVersionRegex>
 *       </versionCheck>
 *     </validateDependencyVersion>
 *   </rules>
 * }</pre>
 *
 * @version $Id$
 * @since 4.5RC1
 */
public class ValidateDependencyVersion extends AbstractPomCheck
{
    /**
     * List of checks to execute; they are configured in the pom.xml.
     */
    private List<VersionCheck> checks = new ArrayList<VersionCheck>();

    /**
     * Add a new dependency version check. Called automatically by the Maven framework when the following construct
     * is defined in a pom.xml file:
     *
     * <pre>{@code
     *   <versionCheck>
     *     <groupIdPrefix>org.xwiki.commons</groupIdPrefix>
     *     <allowedVersionRegex>.*</allowedVersionRegex>
     *   </versionCheck>
     * }</pre>
     *
     * @param versionCheck the check to add
     */
    public void addVersionCheck(VersionCheck versionCheck)
    {
        this.checks.add(versionCheck);
    }
{'fraction_non_alphanumeric': 0.10262934690415607, 'fraction_numerical': 0.0055979643765903305, 'mean_word_length': 3.617071260767424, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 6}, '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': '3757712', 'n_tokens_mistral': 1691, 'n_tokens_neox': 1635, 'n_words': 578}