gherkin_readability 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/Rakefile +1 -1
- data/bin/gherkin_readability +11 -1
- data/features/rate.feature +1 -0
- data/features/summary.feature +1 -1
- data/gherkin_readability.gemspec +2 -2
- data/lib/gherkin_readability.rb +20 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f74dea223b57a5464602efa142839ab830801706
|
4
|
+
data.tar.gz: 6ba4a14b709b0a0ce74c05c4002f8155a198ff67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbdec8abcb32f2e3538c4596430f8aca8e6cc738b2425a7802a25cb7ea049215f7b7e5786f77c29c8f1e4af5d665b039bbfde5dd363f6b2b19635eaeb3ce464a
|
7
|
+
data.tar.gz: 05e43fc346538457d32fd745248ed766632b646d037ebc5ee1e1d6878d12e243eb29c3476d9a92f9bc8847ba6154ac316916d832c909a22d8f603d2356009733
|
data/.rubocop.yml
CHANGED
data/Rakefile
CHANGED
data/bin/gherkin_readability
CHANGED
@@ -8,10 +8,20 @@ OptionParser.new do |opts|
|
|
8
8
|
opts.on('--[no-]summary', 'Print summary') do |summary|
|
9
9
|
options[:summary] = summary
|
10
10
|
end
|
11
|
+
opts.on('--below [THRESHOLD]', 'Selects just files below the threshold') do |threshold|
|
12
|
+
options[:below] = threshold.to_i
|
13
|
+
end
|
14
|
+
opts.on('--above [THRESHOLD]', 'Selects just files above the threshold') do |threshold|
|
15
|
+
options[:above] = threshold.to_i
|
16
|
+
end
|
11
17
|
end.parse!
|
12
18
|
|
13
19
|
readability = GherkinReadability.new
|
14
20
|
|
15
21
|
readability.analyze ARGV
|
16
22
|
|
17
|
-
readability.
|
23
|
+
readability.select_below! options[:below] if options.key? :below
|
24
|
+
readability.select_above! options[:above] if options.key? :above
|
25
|
+
|
26
|
+
readability.report
|
27
|
+
readability.summary if options.key? :summary
|
data/features/rate.feature
CHANGED
data/features/summary.feature
CHANGED
data/gherkin_readability.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'gherkin_readability'
|
3
|
-
s.version = '0.0.
|
4
|
-
s.date = '2015-10
|
3
|
+
s.version = '0.0.2'
|
4
|
+
s.date = '2015-11-10'
|
5
5
|
s.summary = 'Gherkin Readability'
|
6
6
|
s.description = 'Check readability of Gherkin Files'
|
7
7
|
s.authors = ['Stefan Rohe']
|
data/lib/gherkin_readability.rb
CHANGED
@@ -23,12 +23,31 @@ class GherkinReadability
|
|
23
23
|
sentences = extract_sentences parse(file)
|
24
24
|
@readability_by_file[file] = readability sentences
|
25
25
|
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def select_below!(threshold)
|
29
|
+
filtered = {}
|
30
|
+
@readability_by_file.each do |file, rating|
|
31
|
+
filtered[file] = rating if rating <= threshold
|
32
|
+
end
|
33
|
+
@readability_by_file = filtered
|
34
|
+
end
|
35
|
+
|
36
|
+
def select_above!(threshold)
|
37
|
+
filtered = {}
|
38
|
+
@readability_by_file.each do |file, rating|
|
39
|
+
filtered[file] = rating if rating >= threshold
|
40
|
+
end
|
41
|
+
@readability_by_file = filtered
|
42
|
+
end
|
43
|
+
|
44
|
+
def report
|
26
45
|
@readability_by_file.sort { |lhs, rhs| lhs[1] <=> rhs[1] }.reverse_each do |file, rating|
|
27
46
|
puts "#{rating.round}: #{file}"
|
28
47
|
end
|
29
48
|
end
|
30
49
|
|
31
|
-
def
|
50
|
+
def summary
|
32
51
|
average_readability = 0
|
33
52
|
@readability_by_file.each do |_, rating|
|
34
53
|
average_readability += rating
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gherkin_readability
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Rohe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10
|
11
|
+
date: 2015-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gherkin
|
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
106
|
version: '0'
|
107
107
|
requirements: []
|
108
108
|
rubyforge_project:
|
109
|
-
rubygems_version: 2.2.
|
109
|
+
rubygems_version: 2.2.5
|
110
110
|
signing_key:
|
111
111
|
specification_version: 4
|
112
112
|
summary: Gherkin Readability
|