Twiddler Utils C0 Coverage Information - RCov

lib/twiddler/lint.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
lib/twiddler/lint.rb 59 48
93.22%
91.67%

Key

Code reported as executed by Ruby looks like this...and this: this line is also marked as covered.Lines considered as run by rcov, but not reported by Ruby, look like this,and this: these lines were inferred by rcov (using simple heuristics).Finally, here's a line marked as not executed.

Coverage Details

1 require 'twiddler/config'
2 
3 module Twiddler
4   module Lint
5     def self.check(config)
6       report = []
7       Rule::registered.each do |rule|
8         report << rule.new(config).check
9       end
10       report
11     end
12 
13     class Rule
14       class << self
15         def register
16           @@registered ||= []
17           @@registered << self
18         end
19 
20         def registered
21           @@registered || []
22         end
23       end
24 
25       def initialize(config)
26         @config = config
27       end
28 
29       def check()
30         return ""
31       end
32     end
33 
34     class MissingStrokes < Rule
35       register
36       def check()
37         all_strokes = []
38         @config.keytable.each do |key|
39           all_strokes << [key.code, ""]
40           all_strokes << [key.code, "shift"] if key.has_mod?("shift")
41         end
42 
43         @config.keyboard.each do |chord|
44           next unless chord.single?
45           all_strokes.delete(@config.keytable.normalized(chord[0]))
46         end
47 
48         if all_strokes.empty?
49           return "Missing: all normal keystrokes accounted for"
50         else
51           return "Config lacks strokes: #{all_strokes.map{|str| @config.keytable[*str]}.inspect}"
52         end
53       end
54       
55     end
56 
57 
58   end
59 end

Generated on Tue May 03 12:22:31 -0700 2011 with rcov 0.9.7.1