gherkin_readability 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/Rakefile +1 -1
- data/bin/gherkin_readability +5 -1
- data/features/verbose.feature +33 -0
- data/gherkin_readability.gemspec +2 -2
- data/lib/gherkin_readability.rb +5 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2a2bae7e922dd999e348f414ef91d60cc699b58
|
4
|
+
data.tar.gz: 2ff9c0171ba577ae96f5ade5488e553151c63739
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34c7c8c147337464e42649f4fc96e3d42e836a6c999a573f99debab3cb0472cdc6265f0b88777f6abf17e97862020a549b556870e36821e0ee0185bbb5c0da8b
|
7
|
+
data.tar.gz: 417c5fe519fe83a79b134471dd5a963712fcbe1c9eaf97a9184f2d072118de086c6a3172afb72f3e9ed7d0dd5e9f43fe722240da66d4aefef3137d075c37b5dc
|
data/.rubocop.yml
CHANGED
data/Rakefile
CHANGED
data/bin/gherkin_readability
CHANGED
@@ -14,11 +14,15 @@ OptionParser.new do |opts|
|
|
14
14
|
opts.on('--above [THRESHOLD]', 'Selects just files above the threshold') do |threshold|
|
15
15
|
options[:above] = threshold.to_i
|
16
16
|
end
|
17
|
+
opts.on('--verbose', 'Verbose output') do |verbose|
|
18
|
+
options[:verbose] = verbose
|
19
|
+
end
|
17
20
|
end.parse!
|
18
21
|
|
19
22
|
readability = GherkinReadability.new
|
20
23
|
|
21
|
-
|
24
|
+
verbose = options.key?(:verbose) ? options[:verbose] : false
|
25
|
+
readability.analyze(ARGV, verbose)
|
22
26
|
|
23
27
|
readability.select_below! options[:below] if options.key? :below
|
24
28
|
readability.select_above! options[:above] if options.key? :above
|
@@ -0,0 +1,33 @@
|
|
1
|
+
Feature: Verbose
|
2
|
+
As a Business Analyst
|
3
|
+
I want to read verbose output
|
4
|
+
so that I know which scenarios are too complex
|
5
|
+
|
6
|
+
Scenario: Verbose output
|
7
|
+
Given a file named "readability.rb" with:
|
8
|
+
"""
|
9
|
+
$LOAD_PATH << '../../lib'
|
10
|
+
require 'gherkin_readability'
|
11
|
+
|
12
|
+
readability = GherkinReadability.new
|
13
|
+
|
14
|
+
verbose = true
|
15
|
+
readability.analyze %w(default.feature), verbose
|
16
|
+
|
17
|
+
"""
|
18
|
+
And a file named "default.feature" with:
|
19
|
+
"""
|
20
|
+
Feature: Default
|
21
|
+
Scenario: Tag
|
22
|
+
Given a test
|
23
|
+
When execute
|
24
|
+
Then pass
|
25
|
+
"""
|
26
|
+
When I run `ruby readability.rb`
|
27
|
+
Then it should pass with:
|
28
|
+
"""
|
29
|
+
37 - Default
|
30
|
+
121 - Tag
|
31
|
+
115 - Given a test when execute then pass
|
32
|
+
|
33
|
+
"""
|
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-11-
|
3
|
+
s.version = '0.0.3'
|
4
|
+
s.date = '2015-11-13'
|
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
@@ -12,15 +12,18 @@ require 'yaml'
|
|
12
12
|
require 'set'
|
13
13
|
require 'digest'
|
14
14
|
|
15
|
-
# gherkin
|
15
|
+
# gherkin readability
|
16
16
|
class GherkinReadability
|
17
17
|
def initialize
|
18
18
|
@readability_by_file = {}
|
19
19
|
end
|
20
20
|
|
21
|
-
def analyze(files)
|
21
|
+
def analyze(files, verbose = false)
|
22
22
|
files.each do |file|
|
23
23
|
sentences = extract_sentences parse(file)
|
24
|
+
sentences.each do |sentence|
|
25
|
+
puts "#{readability([sentence]).round} - #{sentence.tr("\n", ' ').strip}"
|
26
|
+
end if verbose
|
24
27
|
@readability_by_file[file] = readability sentences
|
25
28
|
end
|
26
29
|
end
|
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.3
|
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-11-
|
11
|
+
date: 2015-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gherkin
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- features/rate.feature
|
86
86
|
- features/summary.feature
|
87
87
|
- features/support/env.rb
|
88
|
+
- features/verbose.feature
|
88
89
|
- gherkin_readability.gemspec
|
89
90
|
- lib/gherkin_readability.rb
|
90
91
|
homepage: http://github.com/funkwerk/gherkin_readability/
|