gherkin_language 0.1.0 → 0.1.1

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: d845d6ef0a078c47dca82dbf52e8f3c2ec582315
4
- data.tar.gz: 58d2b113ee3fc79522e71923e8b05dac5b861878
3
+ metadata.gz: 7a590ba82c3ddcfadb69cdb406e9f748ffde3ab8
4
+ data.tar.gz: 9e1b9775fdff0c5da5189c3a5f6ba39f165e19e1
5
5
  SHA512:
6
- metadata.gz: 0672226fa52098d827610ad1fec13b641e58fbf2aa08c87369c794f26393e75d11c80aa6f58653e066860e0e41207dac7ece6fb34aba0012deca52574eff21a9
7
- data.tar.gz: 6f4949dd6382fe18c24f582d9e1f0ab0d79f9375ff1d31b973ec53ef0db8c900b8e1cc2c55cc91b8a295099c52df37a1269c770d2df1fe43f6ec12b4132aa2db
6
+ metadata.gz: 7fa9d18fbde5d760c308a421a81c6e865738797d8f979bcaa39d557c96ee7174cd89840e0597ddd940dc502dc6f13442ed478404338caff28dd4e70d6c6a4d28
7
+ data.tar.gz: a787411778379f5b51cc50119d2ac86f8efef1b32ac97591879700f761657e78502219419e170523eeed3efb16690da9e064f1fa6bc4ccf3d272e64b4dcf6acd
@@ -0,0 +1,13 @@
1
+ FROM ruby
2
+ MAINTAINER think@hotmail.de
3
+
4
+ # TODO: activate --ngram
5
+ RUN \
6
+ apt-get update && \
7
+ apt-get install -y unzip default-jre && \
8
+ gem install gherkin_language --no-format-exec && \
9
+ echo "Feature: Empty" > /tmp/empty.feature && \
10
+ gherkin_language /tmp/empty.feature && \
11
+ rm /tmp/empty.feature
12
+
13
+ CMD gherkin_language
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
  gem 'aruba'
3
- gem 'gherkin'
3
+ gem 'gherkin', '=2.12.2'
4
4
  gem 'gherkin_lint'
5
5
  gem 'gherkin_format'
6
6
  gem 'rake'
data/README.md CHANGED
@@ -25,6 +25,8 @@ To ignore specific rules, mention them with an `--ignore RULE`. This allows to b
25
25
 
26
26
  To check for confused words, based on ngrams, add `--ngram`. Please note, that it requires much disk space and time.
27
27
 
28
+ Get a readability report using `--readability`. It indicates, which files are not good readable.
29
+
28
30
 
29
31
  Glossary
30
32
  --------
data/Rakefile CHANGED
@@ -18,7 +18,7 @@ task test: :cucumber
18
18
 
19
19
  desc 'Publishes the Gem'
20
20
  task push: :build do
21
- sh 'gem push gherkin_language-0.0.9.gem'
21
+ sh 'gem push gherkin_language-0.1.1.gem'
22
22
  end
23
23
 
24
24
  desc 'Checks ruby style'
@@ -27,7 +27,9 @@ task :rubocop do
27
27
  end
28
28
 
29
29
  task :cucumber do
30
- sh 'cucumber'
30
+ options = %w()
31
+ options.push '--tags ~@slow' unless ENV['slow']
32
+ sh "cucumber #{options * ' '}"
31
33
  end
32
34
 
33
35
  task :lint do
@@ -1,3 +1,4 @@
1
+ @slow
1
2
  Feature: Confused Words
2
3
  As a Business Analyst
3
4
  I want to be informed for confused words
@@ -34,6 +35,7 @@ Feature: Confused Words
34
35
  Context: Given I do not now where it is when execute then pass
35
36
  Replacements: know
36
37
  References: test.feature
38
+
37
39
  """
38
40
 
39
41
  Scenario: Accept non confused words
@@ -12,7 +12,7 @@ Feature: Readability
12
12
  no_cache = true
13
13
  ngrams = false
14
14
  language = GherkinLanguage.new(no_cache, ngrams)
15
- language.determine_readability_by_file %w(default.feature unreadable.feature)
15
+ language.determine_readability_by_file %w(default.feature test.feature)
16
16
  exit language.report
17
17
 
18
18
  """
@@ -25,8 +25,8 @@ Feature: Readability
25
25
  Then pass
26
26
  """
27
27
 
28
- Scenario: Sort by readability
29
- Given a file named "unreadable.feature" with:
28
+ Scenario: Sort poor readable
29
+ Given a file named "test.feature" with:
30
30
  """
31
31
  Feature: Unreadable busting complexity check
32
32
  Scenario: nonsense and unreadable
@@ -40,8 +40,28 @@ Feature: Readability
40
40
  Readability. Sorted from best to worst readable feature
41
41
 
42
42
  119: default.feature
43
- 30: unreadable.feature
43
+ 30: test.feature
44
44
 
45
45
  2 files analyzed. Average readability is 74
46
46
 
47
47
  """
48
+
49
+ Scenario: Sort highly readable
50
+ Given a file named "test.feature" with:
51
+ """
52
+ Feature: Test
53
+ Scenario: Test
54
+ When execute
55
+ Then test
56
+ """
57
+ When I run `ruby readability.rb`
58
+ Then it should pass with exactly:
59
+ """
60
+ Readability. Sorted from best to worst readable feature
61
+
62
+ 120: test.feature
63
+ 119: default.feature
64
+
65
+ 2 files analyzed. Average readability is 120
66
+
67
+ """
@@ -1,5 +1,5 @@
1
1
  require 'aruba/cucumber'
2
2
 
3
3
  Before do
4
- @aruba_timeout_seconds = 1000 # external java process, give it some time
4
+ @aruba_timeout_seconds = 1000 # external java process, give it some time
5
5
  end
@@ -26,26 +26,15 @@ Feature: Tag
26
26
  Then it should pass with exactly:
27
27
  """
28
28
  <S>
29
- [[[/null]
30
- "["/``]
31
- Test[Test/NNP]
32
- "["/'']
33
- ,[,/,,O]
34
- "["/``,O]
35
- Tag[tag/NN:UN,tag/VB,tag/VBP]
36
- "["/'']
37
- ,[,/,,O]
38
- "["/``,O]
39
- Given[Given/NNP,B-VP]
29
+ [[[/null]"["/``]Test[Test/NNP]"["/''],[,/,,O]
30
+ "["/``,O]Tag[tag/NN:UN,tag/VB,tag/VBP]"["/''],[,/,,O]
31
+ "["/``,O]Given[Given/NNP,B-VP]
40
32
  a[a/DT,B-NP-singular]
41
33
  test[test/JJ,test/NN,test/VB,test/VBP,E-NP-singular]
42
34
  when[when/WRB,B-ADVP]
43
35
  execute[execute/VB,execute/VBP,B-VP]
44
36
  then[then/JJ,then/NN,then/RB,I-VP]
45
- pass[pass/JJ,pass/NN,pass/VB,pass/VBP,I-VP]
46
- "["/'',B-ADVP]
47
- ]
48
- [</S>,O]
37
+ pass[pass/JJ,pass/NN,pass/VB,pass/VBP,I-VP]"["/'',B-ADVP]][</S>,O]
49
38
 
50
39
 
51
40
  """
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'gherkin_language'
3
- s.version = '0.1.0'
4
- s.date = '2015-10-11'
3
+ s.version = '0.1.1'
4
+ s.date = '2016-01-17'
5
5
  s.summary = 'Gherkin Language'
6
6
  s.description = 'Check language and readability of Gherkin Files'
7
7
  s.authors = ['Stefan Rohe']
@@ -1,4 +1,6 @@
1
1
  # encoding: utf-8
2
+ gem 'gherkin', '2.12.2'
3
+
2
4
  require 'gherkin/formatter/json_formatter'
3
5
  require 'gherkin/parser/parser'
4
6
  require 'gherkin_language/error'
@@ -66,7 +68,7 @@ class GherkinLanguage
66
68
 
67
69
  total_words = 0
68
70
  total_syllabels = 0
69
- Syllables.new(sentences.join '\n').to_h.each do |_word, syllabels|
71
+ Syllables.new(sentences.join('\n')).to_h.each do |_word, syllabels|
70
72
  total_words += 1
71
73
  total_syllabels += syllabels
72
74
  end
@@ -76,7 +78,7 @@ class GherkinLanguage
76
78
  def accepted?(sentence)
77
79
  return false if @accepted_paragraphs.nil?
78
80
  key = :without_glossary
79
- key = hash(File.read '.glossary') if File.exist? '.glossary'
81
+ key = hash(File.read('.glossary')) if File.exist? '.glossary'
80
82
 
81
83
  return false unless @accepted_paragraphs.key? key
82
84
  @accepted_paragraphs[key].include? hash sentence
@@ -147,7 +149,7 @@ class GherkinLanguage
147
149
  @references.each do |sentence, _refs|
148
150
  next if used_refs.include? sentence
149
151
  key = :without_glossary
150
- key = hash(File.read '.glossary') if File.exist? '.glossary'
152
+ key = hash(File.read('.glossary')) if File.exist? '.glossary'
151
153
 
152
154
  @accepted_paragraphs[key] = Set.new [] unless @accepted_paragraphs.key? key
153
155
  @accepted_paragraphs[key].add hash sentence
@@ -16,10 +16,10 @@ require 'digest'
16
16
  class LanguageToolProcess
17
17
  attr_accessor :errors, :unknown_words
18
18
 
19
- VERSION = 'LanguageTool-3.1'
20
- URL = "https://www.languagetool.org/download/#{VERSION}.zip"
21
- NGRAM_VERSION = 'ngrams-en-20150817'
22
- NGRAM_URL = "https://languagetool.org/download/ngram-data/#{NGRAM_VERSION}.zip"
19
+ VERSION = 'LanguageTool-3.1'.freeze
20
+ URL = "https://www.languagetool.org/download/#{VERSION}.zip".freeze
21
+ NGRAM_VERSION = 'ngrams-en-20150817'.freeze
22
+ NGRAM_URL = "https://languagetool.org/download/ngram-data/#{NGRAM_VERSION}.zip".freeze
23
23
 
24
24
  def initialize(ngrams = false)
25
25
  path = Dir.tmpdir
@@ -77,9 +77,9 @@ class LanguageToolProcess
77
77
  end
78
78
  p.close
79
79
  end
80
- output.gsub!(' ', "\n")
81
- output.gsub!(']', "]\n")
82
- output.gsub!("\n\n", "\n")
80
+ output.tr!(' ', "\n")
81
+ output.tr!(']', "]\n")
82
+ output.tr!("\n\n", "\n")
83
83
  output
84
84
  end
85
85
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gherkin_language
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
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 00:00:00.000000000 Z
11
+ date: 2016-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gherkin
@@ -75,6 +75,7 @@ extra_rdoc_files: []
75
75
  files:
76
76
  - ".rubocop.yml"
77
77
  - ".travis.yml"
78
+ - Dockerfile
78
79
  - Gemfile
79
80
  - Guardfile
80
81
  - LICENSE
@@ -115,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
116
  version: '0'
116
117
  requirements: []
117
118
  rubyforge_project:
118
- rubygems_version: 2.2.3
119
+ rubygems_version: 2.2.5
119
120
  signing_key:
120
121
  specification_version: 4
121
122
  summary: Gherkin Language