diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-11-11 15:29:19 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-11-11 15:29:19 +0000 |
commit | 7bca4cabc220c03a2bfb19a873421a764a3011d6 (patch) | |
tree | b9ce4cc975b825b633968119d8843295aa2c1db6 /lib | |
parent | dfd8ae8a8457e08f3e2da7732c59dbf70e541460 (diff) | |
parent | 6748dd2fd0b2cf694661e910c6c1bb6ac2be69a1 (diff) | |
download | gitlab-ce-7bca4cabc220c03a2bfb19a873421a764a3011d6.tar.gz |
Merge branch 'flog' into 'master'
Add method complexity check to CI
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
See merge request !1783
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tasks/flog.rake | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/tasks/flog.rake b/lib/tasks/flog.rake new file mode 100644 index 00000000000..3bfe999ae74 --- /dev/null +++ b/lib/tasks/flog.rake @@ -0,0 +1,25 @@ +desc 'Code complexity analyze via flog' +task :flog do + output = %x(bundle exec flog -m app/ lib/gitlab) + exit_code = 0 + minimum_score = 70 + output = output.lines + + # Skip total complexity score + output.shift + + # Skip some trash info + output.shift + + output.each do |line| + score, method = line.split(" ") + score = score.to_i + + if score > minimum_score + exit_code = 1 + puts "High complexity in #{method}. Score: #{score}" + end + end + + exit exit_code +end |