<commit_before>/*
 * Copyright 2012 Red Hat, Inc.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.commonjava.maven.plugin.unsigner;

import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.Mojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.plugin.logging.SystemStreamLog;
import org.apache.maven.project.MavenProject;

import java.io.File;

/**
 * @goal unsign
 * @phase package
 */
public class UnsignGoal
    implements Mojo
{

    private Log log;

    /**
     * @parameter default-value="${project}"
     * @readonly
     */
    private MavenProject project;

    /**
     * {@inheritDoc}
     * @see org.apache.maven.plugin.Mojo#execute()
     */
    public void execute()
        throws MojoExecutionException, MojoFailureException
    {
        final Artifact artifact = project.getArtifact();
        final File src = artifact.getFile();
        new Unsigner().unsign( src );
    }

    /**
     * {@inheritDoc}
     * @see org.apache.maven.plugin.Mojo#setLog(org.apache.maven.plugin.logging.Log)
     */
    public void setLog( final Log log )
    {
        this.log = log;
    }

    /**
     * {@inheritDoc}
     * @see org.apache.maven.plugin.Mojo#getLog()
     */
    public synchronized Log getLog()
    {
        if ( log == null )
        {
            log = new SystemStreamLog();
        }

        return log;
    }
}
<commit_msg>adding flags for controlling execution a little better<commit_after>/*
 * Copyright 2012 Red Hat, Inc.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.commonjava.maven.plugin.unsigner;

import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.Mojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.plugin.logging.SystemStreamLog;
import org.apache.maven.project.MavenProject;

import java.io.File;
import java.util.List;

/**
 * @goal unsign
 * @phase package
 */
public class UnsignGoal
    implements Mojo
{

    private Log log;

    /**
     * @parameter default-value="${project}"
     * @readonly
     */
    private MavenProject project;

    /**
     * @parameter default-value="false" expression="${unsigner.skip}"
     */
    private boolean skip;

    /**
     * @parameter default-value="false" expression="${unsigner.processAttachments}"
     */
    private boolean skipAttachments;

    /**
     * {@inheritDoc}
     * @see org.apache.maven.plugin.Mojo#execute()
     */
    public void execute()
        throws MojoExecutionException, MojoFailureException
    {
        if ( skip )
        {
            getLog().info( "Skipping unsigner per configuration." );
            return;
        }

        final Unsigner unsigner = new Unsigner();

        int unsigned = 0;
        if ( "jar".equals( project.getPackaging() ) )
        {
            final Artifact artifact = project.getArtifact();
            final File src = artifact.getFile();
            unsigner.unsign( src );
            unsigned++;
        }

        final List<Artifact> attached = project.getAttachedArtifacts();
        if ( !skipAttachments && attached != null )
        {
            for ( final Artifact attachment : attached )
            {
                if ( "jar".equals( attachment.getType() ) )
                {
                    final File src = attachment.getFile();
                    unsigner.unsign( src );
                    unsigned++;
                }
            }
        }

        getLog().info( "Unsigned " + unsigned + " jars." );
    }

    /**
     * {@inheritDoc}
     * @see org.apache.maven.plugin.Mojo#setLog(org.apache.maven.plugin.logging.Log)
     */
    public void setLog( final Log log )
    {
        this.log = log;
    }

    /**
     * {@inheritDoc}
     * @see org.apache.maven.plugin.Mojo#getLog()
     */
    public synchronized Log getLog()
    {
        if ( log == null )
        {
            log = new SystemStreamLog();
        }

        return log;
    }
}

{'fraction_non_alphanumeric': 0.11072664359861592, 'fraction_numerical': 0.0032679738562091504, 'mean_word_length': 2.3502897617514487, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6100752', 'n_tokens_mistral': 1521, 'n_tokens_neox': 1440, 'n_words': 399}