Clover coverage report - PMD - 3.7 Coverage timestamp: Wed May 31 2006 09:25:59 EDT FRAMES NO FRAMES |

file stats: | LOC: | 85 |  | Methods: | 6
| NCLOC: | 41 |  | Classes: | 1

Source file | Conditionals | Statements | Methods | TOTAL
SourceFileSelector.java | 83.3% | 78.6% | 66.7% | 76.9% |

1 |  | package net.sourceforge.pmd;
2 |  |
3 |  | import java.io.File;
4 |  |
5 |  | /**
6 |  | * Filtering of wanted source files.
7 |  | *
8 |  | * @author Pieter_Van_Raemdonck - Application Engineers NV/SA - www.ae.be
9 |  | */
10 |  | public class SourceFileSelector {
11 |  |
12 |  | private boolean selectJavaFiles = true;
13 |  |
14 |  | // TODO: is false the wanted default option?
15 |  | private boolean selectJspFiles = false;
16 |  |
17 |  | /**
18 |  | * Check if a file with given fileName should be checked by PMD.
19 |  | *
20 |  | * @param fileName String
21 |  | * @return True if the file must be checked; false otherwise
22 |  | */
23 | 4 | public boolean isWantedFile(String fileName) {
24 | 4 | int lastDotIndex = fileName.lastIndexOf(".");
25 | 4 | if (lastDotIndex < 0) {
26 | 0 | return false;
27 |  | }
28 |  |
29 | 4 | String extensionUppercase = fileName.substring(1 + lastDotIndex)
30 |  | .toUpperCase();
31 |  |
32 | 4 | if (selectJavaFiles
33 |  | && extensionUppercase
34 |  | .equals(SourceFileConstants.JAVA_EXTENSION_UPPERCASE)) {
35 | 1 | return true;
36 |  | }
37 |  |
38 | 3 | if (selectJspFiles
39 |  | && (extensionUppercase
40 |  | .equals(SourceFileConstants.JSP_EXTENSION_UPPERCASE) || extensionUppercase
41 |  | .equals(SourceFileConstants.JSPX_EXTENSION_UPPERCASE))) {
42 | 1 | return true;
43 |  | }
44 |  |
45 | 2 | return false;
46 |  | }
47 |  |
48 |  | /**
49 |  | * Check if a given file should be checked by PMD.
50 |  | *
51 |  | * @param file The File
52 |  | * @return True if the file must be checked; false otherwise
53 |  | */
54 | 4 | public boolean isWantedFile(File file) {
55 | 4 | return isWantedFile(file.getAbsolutePath());
56 |  | }
57 |  |
58 |  | /**
59 |  | * @return Returns the selectJavaFiles.
60 |  | */
61 | 0 | public boolean isSelectJavaFiles() {
62 | 0 | return selectJavaFiles;
63 |  | }
64 |  |
65 |  | /**
66 |  | * @param selectJavaFiles The selectJavaFiles to set.
67 |  | */
68 | 1 | public void setSelectJavaFiles(boolean selectJavaFiles) {
69 | 1 | this.selectJavaFiles = selectJavaFiles;
70 |  | }
71 |  |
72 |  | /**
73 |  | * @return Returns the selectJspFiles.
74 |  | */
75 | 0 | public boolean isSelectJspFiles() {
76 | 0 | return selectJspFiles;
77 |  | }
78 |  |
79 |  | /**
80 |  | * @param selectJspFiles The selectJspFiles to set.
81 |  | */
82 | 1 | public void setSelectJspFiles(boolean selectJspFiles) {
83 | 1 | this.selectJspFiles = selectJspFiles;
84 |  | }
85 |  | }