Package com.adobe.ac.pmd.files

Examples of com.adobe.ac.pmd.files.IFlexFile


   }

   @Test
   public void testBug233() throws PMDException
   {
      final IFlexFile file = getTestFiles().get( "bug.Duane.mxml" );
      final IParserNode ast = FileSetUtils.buildAst( file );
      final IClass classNode = NodeFactory.createPackage( ast ).getClassNode();
      final ClassMetrics classMetrics = ClassMetrics.create( "bug",
                                                             new File( file.getFilePath() ),
                                                             InternalFunctionMetrics.create( new ProjectMetrics(),
                                                                                             file.getFullyQualifiedName(),
                                                                                             classNode ),
                                                             classNode,
                                                             file,
                                                             1 );
View Full Code Here


   }

   @Test
   public void testToXmlString() throws PMDException
   {
      final IFlexFile file = getTestFiles().get( "RadonDataGrid.as" );
      final IParserNode ast = FileSetUtils.buildAst( file );
      final IClass classNode = NodeFactory.createPackage( ast ).getClassNode();
      final ClassMetrics classMetrics = ClassMetrics.create( "com.adobe.ac",
                                                             new File( file.getFilePath() ),
                                                             InternalFunctionMetrics.create( new ProjectMetrics(),
                                                                                             file.getFullyQualifiedName(),
                                                                                             classNode ),
                                                             classNode,
                                                             file,
                                                             0 );
View Full Code Here

   @Test
   @Ignore("This test requires test-data that was not donated to Apache")
   public void testToXmlStringWithMultiLineComments() throws PMDException
   {
      final IFlexFile file = getTestFiles().get( "bug.FlexPMD60.as" );
      final IParserNode ast = FileSetUtils.buildAst( file );
      final IClass classNode = NodeFactory.createPackage( ast ).getClassNode();
      final ClassMetrics classMetrics = ClassMetrics.create( "bug",
                                                             new File( file.getFilePath() ),
                                                             InternalFunctionMetrics.create( new ProjectMetrics(),
                                                                                             file.getFullyQualifiedName(),
                                                                                             classNode ),
                                                             classNode,
                                                             file,
                                                             0 );
View Full Code Here

   }

   private IFlexFile create( final File sourceFile,
                             final File sourceDirectory )
   {
      IFlexFile file;

      if ( sourceFile.getName().endsWith( ".as" ) )
      {
         file = new As3File( sourceFile, sourceDirectory );
      }
View Full Code Here

            for ( final File fileInPackage : classesInPackage )
            {
               IClass classNode = null;
               InternalFunctionMetrics functionMetrics = null;
               final IFlexFile file = com.adobe.ac.pmd.files.impl.FileUtils.create( fileInPackage,
                                                                                    getSourceDirectory() );
               if ( asts.containsKey( file.getFullyQualifiedName() )
                     && asts.get( file.getFullyQualifiedName() ).getClassNode() != null )
               {
                  classNode = asts.get( file.getFullyQualifiedName() ).getClassNode();
                  functionsInPackage += classNode.getFunctions().size();
                  functionMetrics = InternalFunctionMetrics.create( metrics,
                                                                    packageFullName,
                                                                    classNode );
                  asDocsInPackage += functionMetrics.getAsDocsInClass();
View Full Code Here

   {
      final List< IFlexViolation > violations = new ArrayList< IFlexViolation >();

      if ( isConcernedByTheCurrentFile() )
      {
         final IFlexFile currentFile = getCurrentFile();

         for ( int i = 1; i <= currentFile.getLinesNb(); i++ )
         {
            final String line = currentFile.getLineAt( i );

            if ( !line.trim().startsWith( "import" )
                  && line.length() > getThreshold() )
            {
               currentLineLength = line.length();
View Full Code Here

    */
   @Override
   protected final List< IFlexViolation > findViolationsInCurrentFile()
   {
      final List< IFlexViolation > violations = new ArrayList< IFlexViolation >();
      final IFlexFile currentFile = getCurrentFile();

      if ( currentFile.getLinesNb() == 1 )
      {
         addViolation( violations );
      }
      else if ( currentFile.getLinesNb() > 1 )
      {
         final String commentOpeningTag = currentFile.getCommentOpeningTag();
         final String firstLine = currentFile.getLineAt( 1 );
         final String secondLine = currentFile.getLineAt( 2 );

         if ( !firstLine.startsWith( commentOpeningTag )
               && !( currentFile instanceof IMxmlFile && secondLine.contains( commentOpeningTag ) )
               && !( currentFile instanceof IAs3File && firstLine.contains( currentFile.getSingleLineComment() ) ) )
         {
            addViolation( violations );
         }
      }

View Full Code Here

      final List< IFlexViolation > abstractRowDataViolations = new ArrayList< IFlexViolation >();

      assertEquals( "",
                    PmdEngineUtils.findFirstViolationError( violations ) );

      final IFlexFile abstractRowDataFlexFile = getTestFiles().get( "AbstractRowData.as" );

      abstractRowDataViolations.add( new Violation( new ViolationPosition( 0 ),
                                                    new ErrorRule(),
                                                    abstractRowDataFlexFile ) );
      abstractRowDataViolations.add( new Violation( new ViolationPosition( 0 ),
View Full Code Here

                                                                            TokenException
   {
      if ( !getIgnoreFiles().contains( resourcePath ) )
      {
         final IAS3Parser parser = new AS3Parser();
         final IFlexFile file = getTestFiles().get( resourcePath );

         IPackage rootNode = null;

         if ( file == null )
         {
            throw new IOException( resourcePath
                  + " is not found" );
         }
         if ( file instanceof IAs3File )
         {
            rootNode = NodeFactory.createPackage( parser.buildAst( file.getFilePath() ) );
         }
         else
         {
            rootNode = NodeFactory.createPackage( parser.buildAst( file.getFilePath(),
                                                                   ( ( IMxmlFile ) file ).getScriptBlock() ) );
         }
         return getRule().processFile( file,
                                       rootNode,
                                       getTestFiles() );
View Full Code Here

TOP

Related Classes of com.adobe.ac.pmd.files.IFlexFile

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.