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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87e9b2ecf027cf72ba9121a39e61e698a08674dcdacf42e292c702261743bb3c
4
- data.tar.gz: f73a3684e1ff2d44cc94ce593d57efb4fc6ff20c98518a813479580fe2ab1ca9
3
+ metadata.gz: 4ab65aded7bc8d3835f3364910908bc2842b7adbcdbf724a2d6835535f082c83
4
+ data.tar.gz: 2791990994d331c73067c441d4568bb4844d4586eef86d477d84a27e1900b104
5
5
  SHA512:
6
- metadata.gz: b9ab1a7abf0694ca0ae98342c7a10185bc8c99eef97c2d6c5a78ef9140d5ec309e008b634f069fab377ddd67a5e8a778f7213402081f632c863d06fd66addbe7
7
- data.tar.gz: 92af0fb37811ac79953a809e7dfe41836eeaa015b274b75714d20ab55df4232bcf38931eb1466155bb4979179fd4846e9aa96e19f882fed75c6a67074320596f
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.
@@ -3,13 +3,13 @@
3
3
 
4
4
  require "code_clone_detector"
5
5
 
6
- require 'ripper'
6
+ require "ripper"
7
7
 
8
8
  code = []
9
9
 
10
- Dir.glob('**/*') do |file_name|
11
- if file_name.include?('.rb')
12
- File.open(file_name, 'r') do |file|
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 '===============================\n\n'
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"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CodeCloneDetector
4
- VERSION = "1.0.2"
4
+ VERSION = "1.1.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code_clone_detector
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - MK-nn