Examples of CPD


Examples of net.sourceforge.pmd.cpd.CPD

   @Test
   @Ignore
   public void test119() throws IOException
   {
      final CPD cpd = new CPD( 25, new FlexLanguage() );

      cpd.add( new File( "src/test/resources/test/FlexPMD119.mxml" ) );
      cpd.go();

      final Iterator< Match > matchIterator = cpd.getMatches();
      final Match match = matchIterator.next();

      assertEquals( "The first mark is not correct",
                    41,
                    match.getFirstMark().getBeginLine() );
View Full Code Here

Examples of net.sourceforge.pmd.cpd.CPD

      }
   }

   private Iterator< Match > getMatchIterator() throws IOException
   {
      final CPD cpd = new CPD( 25, new FlexLanguage() );

      for ( final Entry< String, IFlexFile > includedFile : getTestFiles().entrySet() )
      {
         cpd.add( new File( includedFile.getValue().getFilePath() ) );
      }
      cpd.go();

      return cpd.getMatches();
   }
View Full Code Here

Examples of net.sourceforge.pmd.cpd.CPD

   @Override
   protected void executeReport( final Locale locale ) throws MavenReportException
   {
      new LoggerUtils().loadConfiguration();

      final CPD cpd = new CPD( minimumTokenCount, new FlexLanguage() );

      try
      {
         final Map< String, IFlexFile > files = FileUtils.computeFilesList( sourceDirectory,
                                                                            null,
                                                                            "",
                                                                            null );

         for ( final Entry< String, IFlexFile > fileEntry : files.entrySet() )
         {
            cpd.add( new File( fileEntry.getValue().getFilePath() ) ); // NOPMD
         }

         cpd.go();

         report( cpd );
      }
      catch ( final PMDException e )
      {
View Full Code Here

Examples of net.sourceforge.pmd.cpd.CPD

                                             sourceList );
         LOGGER.info( "Starting run, minimumTokenCount is "
               + parameters.getMinimumTokenCount() );

         LOGGER.info( "Tokenizing files" );
         final CPD cpd = new CPD( parameters.getMinimumTokenCount(), new FlexLanguage() );

         cpd.setEncoding( ENCODING );
         tokenizeFiles( cpd );

         LOGGER.info( "Starting to analyze code" );
         final long timeTaken = analyzeCode( cpd );
         LOGGER.info( "Done analyzing code; that took "
View Full Code Here

Examples of net.sourceforge.pmd.cpd.CPD

                    + minimumTokenCount,
              Project.MSG_INFO );

         log( "Tokenizing files",
              Project.MSG_INFO );
         final CPD cpd = new CPD( minimumTokenCount, new FlexLanguage() );
         cpd.setEncoding( encoding );
         tokenizeFiles( cpd );

         log( "Starting to analyze code",
              Project.MSG_INFO );
         final long timeTaken = analyzeCode( cpd );
View Full Code Here

Examples of net.sourceforge.pmd.cpd.CPD

            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

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

Examples of org.sonar.duplications.cpd.CPD

public class CPDFile2 {


  public void method1(){
    CPD cpd = new CPD(20, cpdLanguage);
    cpd.setEncoding(Charset.defaultCharset().name());
    cpd.setLoadSourceCodeSlices(false);
    cpd.add(FileUtils.toFile(CPD.class.getResource("/org/sonar/duplications/cpd/CPDTest/CPDFile1.java")));
    cpd.add(FileUtils.toFile(CPD.class.getResource("/org/sonar/duplications/cpd/CPDTest/CPDFile2.java")));
    cpd.go();

    List<Match> matches = getMatches(cpd);
    assertThat(matches.size(), is(1));

    org.sonar.duplications.cpd.Match match = matches.get(0);
View Full Code Here

Examples of org.sonar.duplications.cpd.CPD

    assertThat(match.getFirstMark().getBeginLine(), is(16));
    assertThat(match.getSourceCodeSlice(), is(nullValue()));
  }
 
  public void method1Duplicated(){
    CPD cpd = new CPD(20, cpdLanguage);
    cpd.setEncoding(Charset.defaultCharset().name());
    cpd.setLoadSourceCodeSlices(false);
    cpd.add(FileUtils.toFile(CPD.class.getResource("/org/sonar/duplications/cpd/CPDTest/CPDFile1.java")));
    cpd.add(FileUtils.toFile(CPD.class.getResource("/org/sonar/duplications/cpd/CPDTest/CPDFile2.java")));
    cpd.go();

    List<Match> matches = getMatches(cpd);
    assertThat(matches.size(), is(1));

    org.sonar.duplications.cpd.Match match = matches.get(0);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.