@Test public void testComputeFunctionLength() throws PMDException { final IFlexFile file = getTestFiles().get( "RadonDataGrid.as" ); final IParserNode dataGridAst = FileSetUtils.buildAst( file ); final IClass radonDataGrid = NodeFactory.createPackage( dataGridAst ).getClassNode(); assertEquals( 6, FunctionUtils.computeFunctionLength( file, radonDataGrid.getFunctions().get( 0 ).getBody() ) ); assertEquals( 9, FunctionUtils.computeFunctionLength( file, radonDataGrid.getFunctions().get( 1 ).getBody() ) ); assertEquals( 21, FunctionUtils.computeFunctionLength( file, radonDataGrid.getFunctions().get( 2 ).getBody() ) ); assertEquals( 16, FunctionUtils.computeFunctionLength( file, radonDataGrid.getFunctions().get( 3 ).getBody() ) ); assertEquals( 10, FunctionUtils.computeFunctionLength( file, radonDataGrid.getFunctions().get( 4 ).getBody() ) ); }
public static int computeFunctionLength( final IFlexFile currentFile, final IParserNode block ) { int lineNb = 1; final int firstLine = block.getChild( 0 ).getLine(); final int lastLine = block.getLastChild().getLine(); for ( int lineIndex = firstLine; lineIndex < lastLine; lineIndex++ ) { if ( FileUtils.isLineACorrectStatement( currentFile.getLineAt( lineIndex ) ) ) { lineNb++; } } return lineNb; }
FunctionUtils { public static int computeFunctionLength( final IFlexFile currentFile, final IParserNode block ) { int lineNb = 1; final int firstLine = block.getChild( 0 ).getLine(); final int lastLine = block.getLastChild().getLine(); for ( int lineIndex = firstLine; lineIndex < lastLine; lineIndex++ ) { if ( FileUtils.isLineACorrectStatement( currentFile.getLineAt( lineIndex ) ) ) { lineNb++; } } return lineNb; } }
FunctionUtils { public static int computeFunctionLength( final IFlexFile currentFile, final IParserNode block ) { int lineNb = 1; final int firstLine = block.getChild( 0 ).getLine(); final int lastLine = block.getLastChild().getLine(); for ( int lineIndex = firstLine; lineIndex < lastLine; lineIndex++ ) { if ( FileUtils.isLineACorrectStatement( currentFile.getLineAt( lineIndex ) ) ) { lineNb++; } } return lineNb; } private  FunctionUtils(); }
FunctionUtils { public static int computeFunctionLength( final IFlexFile currentFile, final IParserNode block ) { int lineNb = 1; final int firstLine = block.getChild( 0 ).getLine(); final int lastLine = block.getLastChild().getLine(); for ( int lineIndex = firstLine; lineIndex < lastLine; lineIndex++ ) { if ( FileUtils.isLineACorrectStatement( currentFile.getLineAt( lineIndex ) ) ) { lineNb++; } } return lineNb; } private  FunctionUtils(); static int computeFunctionLength( final IFlexFile currentFile,
                                            final IParserNode block ); }
FunctionUtils { public static int computeFunctionLength( final IFlexFile currentFile, final IParserNode block ) { int lineNb = 1; final int firstLine = block.getChild( 0 ).getLine(); final int lastLine = block.getLastChild().getLine(); for ( int lineIndex = firstLine; lineIndex < lastLine; lineIndex++ ) { if ( FileUtils.isLineACorrectStatement( currentFile.getLineAt( lineIndex ) ) ) { lineNb++; } } return lineNb; } private  FunctionUtils(); static int computeFunctionLength( final IFlexFile currentFile,
                                            final IParserNode block );  }