gherkin_readability 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f74dea223b57a5464602efa142839ab830801706
4
- data.tar.gz: 6ba4a14b709b0a0ce74c05c4002f8155a198ff67
3
+ metadata.gz: a2a2bae7e922dd999e348f414ef91d60cc699b58
4
+ data.tar.gz: 2ff9c0171ba577ae96f5ade5488e553151c63739
5
5
  SHA512:
6
- metadata.gz: bbdec8abcb32f2e3538c4596430f8aca8e6cc738b2425a7802a25cb7ea049215f7b7e5786f77c29c8f1e4af5d665b039bbfde5dd363f6b2b19635eaeb3ce464a
7
- data.tar.gz: 05e43fc346538457d32fd745248ed766632b646d037ebc5ee1e1d6878d12e243eb29c3476d9a92f9bc8847ba6154ac316916d832c909a22d8f603d2356009733
6
+ metadata.gz: 34c7c8c147337464e42649f4fc96e3d42e836a6c999a573f99debab3cb0472cdc6265f0b88777f6abf17e97862020a549b556870e36821e0ee0185bbb5c0da8b
7
+ data.tar.gz: 417c5fe519fe83a79b134471dd5a963712fcbe1c9eaf97a9184f2d072118de086c6a3172afb72f3e9ed7d0dd5e9f43fe722240da66d4aefef3137d075c37b5dc
data/.rubocop.yml CHANGED
@@ -13,7 +13,7 @@ Metrics/AbcSize:
13
13
  # Offense count: 1
14
14
  # Configuration parameters: CountComments.
15
15
  Metrics/ClassLength:
16
- Max: 137
16
+ Max: 140
17
17
 
18
18
  # Offense count: 8
19
19
  # Configuration parameters: AllowURI, URISchemes.
data/Rakefile CHANGED
@@ -12,7 +12,7 @@ task test: :cucumber
12
12
 
13
13
  desc 'Publishes the Gem'
14
14
  task push: :build do
15
- sh 'gem push gherkin_readability-0.0.2.gem'
15
+ sh 'gem push gherkin_readability-0.0.3.gem'
16
16
  end
17
17
 
18
18
  desc 'Checks ruby style'
@@ -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
- readability.analyze ARGV
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
+ """
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'gherkin_readability'
3
- s.version = '0.0.2'
4
- s.date = '2015-11-10'
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']
@@ -12,15 +12,18 @@ require 'yaml'
12
12
  require 'set'
13
13
  require 'digest'
14
14
 
15
- # gherkin utilities
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.2
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-10 00:00:00.000000000 Z
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/