code_clone_detector 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/exe/code_clone_detector +8 -5
- data/lib/code_clone_detector/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ab65aded7bc8d3835f3364910908bc2842b7adbcdbf724a2d6835535f082c83
|
4
|
+
data.tar.gz: 2791990994d331c73067c441d4568bb4844d4586eef86d477d84a27e1900b104
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e4770d27eec4474c97be3be51df16d1d522bf1c2704c5e4e574d40fb1c3c97c8967bf9e0091d8decbc9e7276cb5e7b4155079a63270a4ad73b0d227a162d029
|
7
|
+
data.tar.gz: 57ffa8eff124dcf4f44f04d8a362bad528032632399c997ca0863e6dcc998537b6761ddf822f4e465d76f53c27b99f6814bb380b41b1170f1fa0badb0a620b11
|
data/README.md
CHANGED
@@ -27,6 +27,11 @@ Execute as:
|
|
27
27
|
$ bundle exec code_clone_detector
|
28
28
|
|
29
29
|
You can detect the largest code clone.
|
30
|
+
|
31
|
+
if you want to execute it only for a specific folder, execute following:
|
32
|
+
|
33
|
+
$ bundle exec code_clone_detector app/
|
34
|
+
|
30
35
|
## Development
|
31
36
|
|
32
37
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/exe/code_clone_detector
CHANGED
@@ -3,13 +3,13 @@
|
|
3
3
|
|
4
4
|
require "code_clone_detector"
|
5
5
|
|
6
|
-
require
|
6
|
+
require "ripper"
|
7
7
|
|
8
8
|
code = []
|
9
9
|
|
10
|
-
Dir.glob(
|
11
|
-
if file_name.include?(
|
12
|
-
File.open(file_name,
|
10
|
+
Dir.glob("**/*") do |file_name|
|
11
|
+
if file_name.include?(".rb") && file_name.include?((ARGV[0]).to_s)
|
12
|
+
File.open(file_name, "r") do |file|
|
13
13
|
file_content = file.read
|
14
14
|
code.push([file_name.to_s, Ripper.lex(file_content)])
|
15
15
|
end
|
@@ -25,6 +25,7 @@ index1 = 0
|
|
25
25
|
index2 = 0
|
26
26
|
|
27
27
|
(0..code.size - 2).each do |a|
|
28
|
+
p "process has been completed.. #{a / code.size.to_f * 100}%"
|
28
29
|
(a + 1..code.size - 1).each do |b|
|
29
30
|
array = []
|
30
31
|
|
@@ -83,6 +84,8 @@ index2 = 0
|
|
83
84
|
end
|
84
85
|
end
|
85
86
|
|
87
|
+
puts "\n===================================\n\n"
|
88
|
+
|
86
89
|
file_1_name = code[index1][0]
|
87
90
|
file1 = code[index1][1]
|
88
91
|
file_2_name = code[index2][0]
|
@@ -93,7 +96,7 @@ code[index1][1][sy..ey].transpose[2].each do |i|
|
|
93
96
|
print i
|
94
97
|
end
|
95
98
|
|
96
|
-
puts
|
99
|
+
puts "===============================\n\n"
|
97
100
|
|
98
101
|
print "#{file_2_name}:"
|
99
102
|
print "#{file2[sx][0][0]},#{file2[sx][0][1]} ~ #{file2[ex][0][0]},#{file2[ex][0][1]}\n"
|