File path: /jruby-1.4.0/src/org/jruby/RubyFileTest.java | File path: /jruby-1.4.0/src/org/jruby/RubyFileTest.java | |||
Method name: RubyBoolean file_p(IRubyObject, IRubyObject)
|
Method name: IRubyObject readable_p(IRubyObject, IRubyObject)
|
|||
Number of AST nodes: 6 | Number of AST nodes: 6 | |||
1 | Ruby runtime = recv.getRuntime();↵ | 1 | Ruby runtime = recv.getRuntime();↵ | |
2 | ZipEntry entry = file_in_archive(filename);↵ | 2 | ZipEntry entry = file_in_archive(filename);↵ | |
3 | if (entry != null) {↵ | 3 | if (entry != null) {↵ | |
4 | return entry.isDirectory() ?↵ | 4 | return entry.isDirectory() ?↵ | |
5 | recv.getRuntime().getFalse() :↵ | 5 | recv.getRuntime().getFalse() :↵ | |
6 | recv.getRuntime().getTrue();↵ | 6 | recv.getRuntime().getTrue();↵ | |
7 | }↵ | 7 | }↵ | |
8 | JRubyFile file = file(filename);↵ | 8 | JRubyFile file = file(filename);↵ | |
9 | return runtime.newBoolean(file.exists() && file.isFile()); | 9 | return runtime.newBoolean(file.exists() && file.canRead()); | |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.1 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 20 |
Number of mapped statements | 6 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 1.6 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Ruby runtime = recv.getRuntime(); | 1 | Ruby runtime = recv.getRuntime(); | |||||||||||||
2 | ZipEntry entry = file_in_archive(filename); | 2 | ZipEntry entry = file_in_archive(filename); | |||||||||||||
3 | if (entry != null) | 3 | if (entry != null) | |||||||||||||
4 | return entry.isDirectory() ? recv.getRuntime().getFalse() : recv.getRuntime().getTrue(); | 4 | return entry.isDirectory() ? recv.getRuntime().getFalse() : recv.getRuntime().getTrue(); | |||||||||||||
5 | JRubyFile file = file(filename); | 5 | JRubyFile file = file(filename); | |||||||||||||
6 | return runtime.newBoolean(file.exists() && file.isFile()); |
| 6 | return runtime.newBoolean(file.exists() && file.canRead()); |
Row | Violation |
---|---|
1 | Expression file.isFile() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression file.canRead() cannot be parameterized, because it has dependencies to/from statements that will be extracted |