File: flog.rb

package info (click to toggle)
ruby-hoe 3.12.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 380 kB
  • ctags: 222
  • sloc: ruby: 1,929; makefile: 10
file content (38 lines) | stat: -rw-r--r-- 731 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
##
# Flog plugin for hoe.
#
# === Tasks Provided:
#
# flog::               Analyze code complexity.

module Hoe::Flog
  ##
  # Optional: flog threshold to determine threshold failure. [default: 1500-200]

  attr_accessor :flog_threshold

  ##
  # Optional: flog method to run to determine threshold. [default: :max_method]

  attr_accessor :flog_method

  ##
  # Initialize variables for plugin.

  def initialize_flog
    self.flog_method    ||= :max_method
    self.flog_threshold ||= 20 # 2x industry avg
  end

  ##
  # Define tasks for plugin.

  def define_flog_tasks
    begin
      require 'flog_task'
      FlogTask.new :flog, self.flog_threshold, nil, self.flog_method
    rescue LoadError
      # skip
    end
  end
end