Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tasks/flog.rake')
-rw-r--r--lib/tasks/flog.rake25
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