chutney 3.1.0 → 3.2.1
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 -0
- data/Rakefile +1 -1
- data/chutney.gemspec +4 -4
- data/config/cucumber.yml +1 -1
- data/lib/chutney/linter.rb +10 -10
- data/lib/chutney/locator.rb +46 -0
- data/lib/chutney/version.rb +1 -1
- data/lib/chutney.rb +3 -0
- metadata +19 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc456f7ef0c0788108026c08c161d0883fdf046b87d3851901eb3cabf80bbde3
|
4
|
+
data.tar.gz: fdd038b05c9650b1a785175f633397eb5bb00640ae82d9169f04f43e45c5fa42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 423221898076fd513aa1dd07eb7778660b89ee615f814dca871b08cc700f1080190f37c72440cba8a4d6524ecc9ac6cb5b656d1983a8eae1e1bfac4a13805a38
|
7
|
+
data.tar.gz: feea3300f389e31739e184f60e6226ab3586f438da71ccfcfaa9edc355d673059e2a06469ded959c718ef4b6dd7c2f2c14ae9a6e36fa8614839a58e91044b873
|
data/.rubocop.yml
CHANGED
data/Rakefile
CHANGED
data/chutney.gemspec
CHANGED
@@ -50,19 +50,19 @@ Gem::Specification.new do |spec|
|
|
50
50
|
|
51
51
|
spec.add_runtime_dependency 'amatch', '~> 0.4.0'
|
52
52
|
spec.add_runtime_dependency 'cuke_modeler', '~> 3.3'
|
53
|
-
spec.add_runtime_dependency 'i18n', '
|
53
|
+
spec.add_runtime_dependency 'i18n', '>= 1.8.2', '< 1.12.0'
|
54
54
|
spec.add_runtime_dependency 'pastel', '~> 0.7'
|
55
55
|
spec.add_runtime_dependency 'tty-pie', '~> 0.3'
|
56
56
|
|
57
57
|
|
58
58
|
spec.add_development_dependency 'coveralls', '~> 0.8'
|
59
|
-
spec.add_development_dependency 'cucumber', '
|
59
|
+
spec.add_development_dependency 'cucumber', '>= 7.0'
|
60
60
|
spec.add_development_dependency 'pry-byebug', '~> 3.0'
|
61
61
|
spec.add_development_dependency 'rake', '~> 13.0'
|
62
62
|
spec.add_development_dependency 'rerun', '~> 0.13'
|
63
63
|
spec.add_development_dependency 'rspec-expectations', '~> 3.0'
|
64
|
-
spec.add_development_dependency 'rubocop', '~> 1.
|
64
|
+
spec.add_development_dependency 'rubocop', '~> 1.31.2'
|
65
65
|
spec.add_development_dependency 'rspec', '~> 3.8'
|
66
66
|
|
67
|
-
spec.required_ruby_version = '
|
67
|
+
spec.required_ruby_version = '>= 2.6'
|
68
68
|
end
|
data/config/cucumber.yml
CHANGED
@@ -1 +1 @@
|
|
1
|
-
default: --publish-quiet
|
1
|
+
default: --publish-quiet
|
data/lib/chutney/linter.rb
CHANGED
@@ -66,7 +66,14 @@ module Chutney
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def dialect
|
69
|
-
@content.feature&.parsing_data
|
69
|
+
parsing_data = @content.feature&.parsing_data
|
70
|
+
if !parsing_data.nil? && parsing_data.respond_to?(:language)
|
71
|
+
parsing_data.language
|
72
|
+
elsif parsing_data
|
73
|
+
parsing_data[:language]
|
74
|
+
else
|
75
|
+
raise UnsupportedCucumberError, 'This version of cucumber is unsupported (langauge detection)'
|
76
|
+
end
|
70
77
|
end
|
71
78
|
|
72
79
|
def tags_for(element)
|
@@ -79,19 +86,12 @@ module Chutney
|
|
79
86
|
gherkin_type: type(feature, scenario, item),
|
80
87
|
location: location(feature, scenario, item),
|
81
88
|
feature: feature&.name,
|
82
|
-
scenario: scenario&.name
|
83
|
-
step: item&.parsing_data&.dig(:name)
|
89
|
+
scenario: scenario&.name
|
84
90
|
).to_h
|
85
91
|
end
|
86
92
|
|
87
93
|
def location(feature, scenario, step)
|
88
|
-
|
89
|
-
step.parsing_data[:location]
|
90
|
-
elsif scenario
|
91
|
-
scenario.parsing_data.dig(:scenario, :location) || scenario.parsing_data.dig(:background, :location)
|
92
|
-
else
|
93
|
-
feature ? feature.parsing_data[:location] : { line: 0, column: 0 }
|
94
|
-
end
|
94
|
+
Locator.locate(feature, scenario, step)
|
95
95
|
end
|
96
96
|
|
97
97
|
def type(_feature, scenario, step)
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Chutney
|
4
|
+
# Utility module to assist in locating the source of parts of a gherkin specification
|
5
|
+
module Locator
|
6
|
+
module_function
|
7
|
+
|
8
|
+
def locate(feature, scenario, step)
|
9
|
+
if step
|
10
|
+
locate_step(step)
|
11
|
+
elsif scenario
|
12
|
+
locate_scenario(scenario)
|
13
|
+
elsif feature
|
14
|
+
locate_feature(feature)
|
15
|
+
else
|
16
|
+
feature
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def locate_step(step)
|
21
|
+
return step.parsing_data.location.to_h if step.parsing_data.respond_to?(:location)
|
22
|
+
return step.parsing_data[:location] if step.parsing_data.is_a?(Hash)
|
23
|
+
|
24
|
+
raise UnsupportedCucumberError, 'This version of cucumber is unsupported (step location)'
|
25
|
+
end
|
26
|
+
|
27
|
+
def locate_scenario(scenario)
|
28
|
+
parsing_data = scenario.parsing_data
|
29
|
+
|
30
|
+
if parsing_data.is_a?(Hash)
|
31
|
+
parsing_data.dig(:scenario, :location) || parsing_data.dig(:background, :location)
|
32
|
+
elsif parsing_data.respond_to?(:scenario)
|
33
|
+
(parsing_data.scenario || parsing_data.background).location.to_h
|
34
|
+
else
|
35
|
+
raise UnsupportedCucumberError, 'This version of cucumber is unsupported (scenario location)'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def locate_feature(feature)
|
40
|
+
return feature.parsing_data.location.to_h if feature.parsing_data.respond_to?(:location)
|
41
|
+
return feature.parsing_data[:location] if feature.parsing_data.is_a?(Hash)
|
42
|
+
|
43
|
+
raise UnsupportedCucumberError, 'This version of cucumber is unsupported (feature location)'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/lib/chutney/version.rb
CHANGED
data/lib/chutney.rb
CHANGED
@@ -37,6 +37,7 @@ require 'chutney/linter/unknown_variable'
|
|
37
37
|
require 'chutney/linter/unused_variable'
|
38
38
|
require 'chutney/linter/use_background'
|
39
39
|
require 'chutney/linter/use_outline'
|
40
|
+
require 'chutney/locator'
|
40
41
|
require 'chutney/version'
|
41
42
|
|
42
43
|
require 'cuke_modeler'
|
@@ -48,6 +49,8 @@ require 'set'
|
|
48
49
|
require 'yaml'
|
49
50
|
|
50
51
|
module Chutney
|
52
|
+
class UnsupportedCucumberError < StandardError; end
|
53
|
+
|
51
54
|
# gherkin linter
|
52
55
|
class ChutneyLint
|
53
56
|
extend Forwardable
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chutney
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1
|
4
|
+
version: 3.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nigel Brookes-Thomas
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: exe
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2022-07-12 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: amatch
|
@@ -45,16 +45,22 @@ dependencies:
|
|
45
45
|
name: i18n
|
46
46
|
requirement: !ruby/object:Gem::Requirement
|
47
47
|
requirements:
|
48
|
-
- - "
|
48
|
+
- - ">="
|
49
49
|
- !ruby/object:Gem::Version
|
50
50
|
version: 1.8.2
|
51
|
+
- - "<"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 1.12.0
|
51
54
|
type: :runtime
|
52
55
|
prerelease: false
|
53
56
|
version_requirements: !ruby/object:Gem::Requirement
|
54
57
|
requirements:
|
55
|
-
- - "
|
58
|
+
- - ">="
|
56
59
|
- !ruby/object:Gem::Version
|
57
60
|
version: 1.8.2
|
61
|
+
- - "<"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: 1.12.0
|
58
64
|
- !ruby/object:Gem::Dependency
|
59
65
|
name: pastel
|
60
66
|
requirement: !ruby/object:Gem::Requirement
|
@@ -101,16 +107,16 @@ dependencies:
|
|
101
107
|
name: cucumber
|
102
108
|
requirement: !ruby/object:Gem::Requirement
|
103
109
|
requirements:
|
104
|
-
- - "
|
110
|
+
- - ">="
|
105
111
|
- !ruby/object:Gem::Version
|
106
|
-
version: '
|
112
|
+
version: '7.0'
|
107
113
|
type: :development
|
108
114
|
prerelease: false
|
109
115
|
version_requirements: !ruby/object:Gem::Requirement
|
110
116
|
requirements:
|
111
|
-
- - "
|
117
|
+
- - ">="
|
112
118
|
- !ruby/object:Gem::Version
|
113
|
-
version: '
|
119
|
+
version: '7.0'
|
114
120
|
- !ruby/object:Gem::Dependency
|
115
121
|
name: pry-byebug
|
116
122
|
requirement: !ruby/object:Gem::Requirement
|
@@ -173,14 +179,14 @@ dependencies:
|
|
173
179
|
requirements:
|
174
180
|
- - "~>"
|
175
181
|
- !ruby/object:Gem::Version
|
176
|
-
version: 1.
|
182
|
+
version: 1.31.2
|
177
183
|
type: :development
|
178
184
|
prerelease: false
|
179
185
|
version_requirements: !ruby/object:Gem::Requirement
|
180
186
|
requirements:
|
181
187
|
- - "~>"
|
182
188
|
- !ruby/object:Gem::Version
|
183
|
-
version: 1.
|
189
|
+
version: 1.31.2
|
184
190
|
- !ruby/object:Gem::Dependency
|
185
191
|
name: rspec
|
186
192
|
requirement: !ruby/object:Gem::Requirement
|
@@ -277,6 +283,7 @@ files:
|
|
277
283
|
- lib/chutney/linter/unused_variable.rb
|
278
284
|
- lib/chutney/linter/use_background.rb
|
279
285
|
- lib/chutney/linter/use_outline.rb
|
286
|
+
- lib/chutney/locator.rb
|
280
287
|
- lib/chutney/version.rb
|
281
288
|
- lib/config/locales/en.yml
|
282
289
|
- spec/chutney_spec.rb
|
@@ -294,7 +301,7 @@ require_paths:
|
|
294
301
|
- lib
|
295
302
|
required_ruby_version: !ruby/object:Gem::Requirement
|
296
303
|
requirements:
|
297
|
-
- - "
|
304
|
+
- - ">="
|
298
305
|
- !ruby/object:Gem::Version
|
299
306
|
version: '2.6'
|
300
307
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
@@ -303,7 +310,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
303
310
|
- !ruby/object:Gem::Version
|
304
311
|
version: '0'
|
305
312
|
requirements: []
|
306
|
-
rubygems_version: 3.
|
313
|
+
rubygems_version: 3.3.7
|
307
314
|
signing_key:
|
308
315
|
specification_version: 4
|
309
316
|
summary: A linter for multi-lingual Gherkin
|