summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-11-11 16:29:00 +0100
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-11-11 16:29:00 +0100
commit98c954ee815823f27cf021b34684c2c3d5bb0917 (patch)
treed131262b7133c7ac5b86c70e84c2a5282ab393bb
parent6748dd2fd0b2cf694661e910c6c1bb6ac2be69a1 (diff)
downloadgitlab-ce-98c954ee815823f27cf021b34684c2c3d5bb0917.tar.gz
Add flay: tool to find duplicate codeflay
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r--.flayignore1
-rw-r--r--.gitlab-ci.yml8
-rw-r--r--Gemfile1
-rw-r--r--Gemfile.lock4
-rw-r--r--lib/tasks/flay.rake9
5 files changed, 23 insertions, 0 deletions
diff --git a/.flayignore b/.flayignore
new file mode 100644
index 00000000000..9c9875d4f9e
--- /dev/null
+++ b/.flayignore
@@ -0,0 +1 @@
+*.erb
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 062fda322a6..128faa07db8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -81,3 +81,11 @@ flog:
- ruby
- mysql
allow_failure: true
+
+flay:
+ script:
+ - bundle exec rake flay
+ tags:
+ - ruby
+ - mysql
+ allow_failure: true
diff --git a/Gemfile b/Gemfile
index 91a93215336..67aef0c3a8d 100644
--- a/Gemfile
+++ b/Gemfile
@@ -260,6 +260,7 @@ group :development, :test do
gem 'coveralls', '~> 0.8.2', require: false
gem 'simplecov', '~> 0.10.0', require: false
gem 'flog', require: false
+ gem 'flay', require: false
gem 'benchmark-ips', require: false
end
diff --git a/Gemfile.lock b/Gemfile.lock
index 0fc22829cfd..5f95637966e 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -194,6 +194,9 @@ GEM
ffi (1.9.10)
fission (0.5.0)
CFPropertyList (~> 2.2)
+ flay (2.6.1)
+ ruby_parser (~> 3.0)
+ sexp_processor (~> 4.0)
flog (4.3.2)
ruby_parser (~> 3.1, > 3.1.0)
sexp_processor (~> 4.4)
@@ -824,6 +827,7 @@ DEPENDENCIES
enumerize (~> 0.7.0)
factory_girl_rails (~> 4.3.0)
ffaker (~> 2.0.0)
+ flay
flog
fog (~> 1.25.0)
font-awesome-rails (~> 4.2)
diff --git a/lib/tasks/flay.rake b/lib/tasks/flay.rake
new file mode 100644
index 00000000000..5efffc2cdac
--- /dev/null
+++ b/lib/tasks/flay.rake
@@ -0,0 +1,9 @@
+desc 'Code duplication analyze via flay'
+task :flay do
+ output = %x(bundle exec flay app/ lib/gitlab/)
+
+ if output.include? "Similar code found"
+ puts output
+ exit 1
+ end
+end