Package net.sourceforge.pmd.cpd

Examples of net.sourceforge.pmd.cpd.CPD


        CPDConfiguration cpdConfiguration = new CPDConfiguration();
        cpdConfiguration.setMinimumTileSize( 100 );
        cpdConfiguration.setLanguage( new JavaLanguage() );
        cpdConfiguration.setEncoding( "UTF-8" );
        CPD tCpd = new MockCpd( cpdConfiguration, tList.iterator() );

        tCpd.go();
        mojo.writeNonHtml( tCpd );

        File tReport = new File( "target/test/unit/default-configuration/target/cpd.xml" );
        // parseDocument( new BufferedInputStream( new FileInputStream( report ) ) );
View Full Code Here


            CPDConfiguration cpdConfiguration = new CPDConfiguration();
            cpdConfiguration.setMinimumTileSize( minimumTokens );
            cpdConfiguration.setLanguage( new JavaLanguage( p ) );
            cpdConfiguration.setEncoding( encoding );

            cpd = new CPD( cpdConfiguration );

            for ( File file : filesToProcess.keySet() )
            {
                cpd.add( file );
            }
View Full Code Here

        List<Match> tList = new ArrayList<Match>();
        Match tMatch = new Match( 2, tFirstEntry, tSecondEntry );
        tMatch.setSourceCodeSlice( "// ----- ACCESSEURS  avec �l�ments -----" );
        tList.add( tMatch );

        CPD tCpd = new MockCpd( 100, new JavaLanguage(), tList.iterator() );

        tCpd.go();
        mojo.writeNonHtml( tCpd );

        File tReport = new File( "target/test/unit/default-configuration/target/cpd.xml" );
        // parseDocument( new BufferedInputStream( new FileInputStream( report ) ) );
View Full Code Here

            ClassLoader origLoader = Thread.currentThread().getContextClassLoader();
            try
            {
                Thread.currentThread().setContextClassLoader( this.getClass().getClassLoader() );

                CPD cpd = generateReport( locale );

                if ( !isHtml() )
                {
                    writeNonHtml( cpd );
                }
View Full Code Here

        }
        if ( ignoreIdentifiers )
        {
            p.setProperty( JavaTokenizer.IGNORE_IDENTIFIERS, "true" );
        }
        CPD cpd = new CPD( minimumTokens, new JavaLanguage( p ) );

        Map<File, PmdFileInfo> files = null;
        try
        {
            files = getFilesToProcess();

            if ( StringUtils.isNotEmpty( getSourceEncoding() ) )
            {
                cpd.setEncoding( getSourceEncoding() );

                // test encoding as CPD will convert exception into a RuntimeException
                WriterFactory.newWriter( new ByteArrayOutputStream(), getSourceEncoding() );
            }
            else if ( !files.isEmpty() )
            {
                getLog().warn(
                               "File encoding has not been set, using platform encoding "
                                   + WriterFactory.FILE_ENCODING + ", i.e. build is platform dependent!" );
            }

            for ( File file : files.keySet() )
            {
                cpd.add( file );
            }
        }
        catch ( UnsupportedEncodingException e )
        {
            throw new MavenReportException( "Encoding '" + getSourceEncoding() + "' is not supported.", e );
        }
        catch ( IOException e )
        {
            throw new MavenReportException( e.getMessage(), e );
        }
        cpd.go();

        CpdReportGenerator gen =
            new CpdReportGenerator( getSink(), files, getBundle( locale ), aggregate );
        gen.generate( cpd.getMatches() );

        return cpd;
    }
View Full Code Here

        Match tMatch = new Match( 2, tFirstEntry, tSecondEntry );
        tMatch.setSourceCodeSlice( "// ----- ACCESSEURS  avec �l�ments -----" );
        tList.add( tMatch );

        CPDConfiguration cpdConfiguration = new CPDConfiguration( 100, new JavaLanguage(), "UTF-8" );
        CPD tCpd = new MockCpd( cpdConfiguration, tList.iterator() );

        tCpd.go();
        mojo.writeNonHtml( tCpd );

        File tReport = new File( "target/test/unit/default-configuration/target/cpd.xml" );
        // parseDocument( new BufferedInputStream( new FileInputStream( report ) ) );
View Full Code Here

            }

            String encoding = determineEncoding( !filesToProcess.isEmpty() );

            CPDConfiguration cpdConfiguration = new CPDConfiguration( minimumTokens, new JavaLanguage( p ), encoding );
            cpd = new CPD( cpdConfiguration );

            for ( File file : filesToProcess.keySet() )
            {
                cpd.add( file );
            }
View Full Code Here

            ClassLoader origLoader = Thread.currentThread().getContextClassLoader();
            try
            {
                Thread.currentThread().setContextClassLoader( this.getClass().getClassLoader() );

                CPD cpd = generateReport( locale );

                if ( !isHtml() )
                {
                    writeNonHtml( cpd );
                }
View Full Code Here

        if ( ignoreIdentifiers )
        {
            p.setProperty( JavaTokenizer.IGNORE_IDENTIFIERS, "true" );
        }

        CPD cpd;
        Map<File, PmdFileInfo> files = null;

        try
        {
            files = getFilesToProcess();
            String encoding = determineEncoding( !files.isEmpty() );

            CPDConfiguration cpdConfiguration = new CPDConfiguration( minimumTokens, new JavaLanguage( p ), encoding );
            cpd = new CPD( cpdConfiguration );

            for ( File file : files.keySet() )
            {
                cpd.add( file );
            }
        }
        catch ( UnsupportedEncodingException e )
        {
            throw new MavenReportException( "Encoding '" + getSourceEncoding() + "' is not supported.", e );
        }
        catch ( IOException e )
        {
            throw new MavenReportException( e.getMessage(), e );
        }
        cpd.go();

        CpdReportGenerator gen = new CpdReportGenerator( getSink(), files, getBundle( locale ), aggregate );
        gen.generate( cpd.getMatches() );

        return cpd;
    }
View Full Code Here

        Match tMatch = new Match( 2, tFirstEntry, tSecondEntry );
        tMatch.setSourceCodeSlice( "// ----- ACCESSEURS  avec �l�ments -----" );
        tList.add( tMatch );

        CPDConfiguration cpdConfiguration = new CPDConfiguration( 100, new JavaLanguage(), "UTF-8" );
        CPD tCpd = new MockCpd( cpdConfiguration, tList.iterator() );

        tCpd.go();
        mojo.writeNonHtml( tCpd );

        File tReport = new File( "target/test/unit/default-configuration/target/cpd.xml" );
        // parseDocument( new BufferedInputStream( new FileInputStream( report ) ) );
View Full Code Here

TOP

Related Classes of net.sourceforge.pmd.cpd.CPD

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.