chutney 3.12.3 → 3.13.0
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/.circleci/config.yml +1 -1
- data/config/chutney_defaults.yml +3 -0
- data/lib/chutney/linter/same_scenario.rb +13 -13
- data/lib/chutney/linter/too_short_tag.rb +22 -0
- data/lib/chutney/linter/use_background.rb +9 -3
- data/lib/chutney/version.rb +1 -1
- data/lib/chutney.rb +1 -0
- data/lib/config/locales/en.yml +2 -0
- data/usechutney.com.site/site/assets/robots.txt +2 -0
- data/usechutney.com.site/site/src/docs/rules/index.page.md +1 -0
- data/usechutney.com.site/site/src/docs/rules/too_short_tag.page.md +25 -0
- metadata +6 -4
- data/spec/chutney_mcp_spec.rb +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8f2cf6323ca7856c5f58637ddc7ea3a4dd74222099a0dcb0a9b0768d95569bb5
|
|
4
|
+
data.tar.gz: bae06f03776f2c4d0be16f2a5bbd2f142e0a1259822076801924e0c02ee11e09
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2c9461d317783650437e56da8bada9a15e3cf28974d6f28aec466c28b7fd066ec7eda520cfb2f419710c81b6f78ab94e8cb3aa403dcd28fa0f725d9aa03c19e6
|
|
7
|
+
data.tar.gz: 6e313a2aab39d318b2415c5d50e4df6a9ba373b4d00d07525dea132c3ea4d2610a5fea0469439d81d6cc6f513f6972a5a2356af35cbd647e76469981a6e86e71
|
data/.circleci/config.yml
CHANGED
data/config/chutney_defaults.yml
CHANGED
|
@@ -11,28 +11,28 @@ module Chutney
|
|
|
11
11
|
@dictionary ||= Hash.new { |hash, key| hash[key] = [] }
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
def lint
|
|
14
|
+
def lint # rubocop:disable Metrics/MethodLength
|
|
15
15
|
scenarios do |feature, scenario|
|
|
16
16
|
text = background ? background.steps.map(&:to_s).join("\n").concat("\n") : ''
|
|
17
17
|
text += scenario
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
.steps
|
|
19
|
+
.map { |step| "#{step.text} #{child_text(step)}" }
|
|
20
|
+
.join("\n") + example_text(scenario)
|
|
21
21
|
digest = Digest::SHA2.hexdigest(text)
|
|
22
22
|
SameScenario.dictionary[digest] << { scenario:, feature: }
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
SameScenario.dictionary.filter { |_k, v| v.size > 1 }
|
|
26
26
|
.each_value do |v|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
v[1...].each_with_index do |problem, index|
|
|
28
|
+
add_issue(I18n.t('linters.same_scenario',
|
|
29
|
+
feature: problem[:feature].name,
|
|
30
|
+
scenario: problem[:scenario].name,
|
|
31
|
+
original_feature: v.first[:feature].name,
|
|
32
|
+
original_scenario: v.first[:scenario].name),
|
|
33
|
+
problem[:feature], problem[:scenario], nil)
|
|
34
|
+
v.delete_at(index + 1)
|
|
35
|
+
end
|
|
36
36
|
end
|
|
37
37
|
end
|
|
38
38
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Chutney
|
|
4
|
+
# service class to lint for tags that are too short, such as @t
|
|
5
|
+
class TooShortTag < Linter
|
|
6
|
+
def lint
|
|
7
|
+
scenarios do |feature, scenario|
|
|
8
|
+
tags = tags_for(feature) + tags_for(scenario)
|
|
9
|
+
next unless tags.any? { |tag| tag.length < min_length }
|
|
10
|
+
|
|
11
|
+
add_issue(
|
|
12
|
+
I18n.t('linters.too_short_tag', min_length:, tags:),
|
|
13
|
+
feature
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def min_length
|
|
19
|
+
configuration['MinLength']&.to_i || 2
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -30,13 +30,19 @@ module Chutney
|
|
|
30
30
|
result
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
-
def expanded_steps(&
|
|
33
|
+
def expanded_steps(&)
|
|
34
34
|
scenarios do |_feature, scenario|
|
|
35
35
|
next unless scenario.steps
|
|
36
36
|
|
|
37
37
|
prototypes = [render_step(scenario.steps.first)]
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
|
|
39
|
+
# only expand further if this is a Scenario Outline and we are dealing
|
|
40
|
+
# with a Given step with substitutions
|
|
41
|
+
if scenario.is_a?(CukeModeler::Outline) && prototypes.any? { |prototype| prototype =~ /<.*>/ }
|
|
42
|
+
prototypes = expand_examples(scenario.examples, prototypes)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
prototypes.each(&)
|
|
40
46
|
end
|
|
41
47
|
end
|
|
42
48
|
|
data/lib/chutney/version.rb
CHANGED
data/lib/chutney.rb
CHANGED
|
@@ -40,6 +40,7 @@ require 'chutney/linter/too_long_step'
|
|
|
40
40
|
require 'chutney/linter/too_many_different_tags'
|
|
41
41
|
require 'chutney/linter/too_many_steps'
|
|
42
42
|
require 'chutney/linter/too_many_tags'
|
|
43
|
+
require 'chutney/linter/too_short_tag'
|
|
43
44
|
require 'chutney/linter/unique_scenario_names'
|
|
44
45
|
require 'chutney/linter/unknown_variable'
|
|
45
46
|
require 'chutney/linter/unused_variable'
|
data/lib/config/locales/en.yml
CHANGED
|
@@ -108,6 +108,8 @@ en:
|
|
|
108
108
|
There are too many steps in this feature. There are %{count} and the maximum is %{max}.
|
|
109
109
|
too_many_tags: >-
|
|
110
110
|
There are too many tags in this feature. There are %{count} and the maximum is %{max}.
|
|
111
|
+
too_short_tag: >-
|
|
112
|
+
Your tag is too short: %{tags}. The minimum length of a tag is %{min_length}. Tags should have meaning.
|
|
111
113
|
unique_scenario_names: >-
|
|
112
114
|
The scenario name '%{name}' is duplicated, first used at line %{line}, column %{column}.
|
|
113
115
|
unknown_variable: >-
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
* [Too Many Different Tags](/docs/rules/too-many-different-tags)
|
|
37
37
|
* [Too Many Steps](/docs/rules/too-many-steps)
|
|
38
38
|
* [Too Many Tags](/docs/rules/too-many-tags)
|
|
39
|
+
* [Too Short Tag](/docs/rules/too_short_tag)
|
|
39
40
|
* [Unique Scenario Names](/docs/rules/unique-scenario-names)
|
|
40
41
|
* [Unknown Variable](/docs/rules/unknown-variable)
|
|
41
42
|
* [Unused Variable](/docs/rules/unused-variable)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Too Short Tag
|
|
2
|
+
|
|
3
|
+
If you have used a tag that is too short, you have probably done it while locally testing. This is a bad practice because it makes your tests harder to read and maintain.
|
|
4
|
+
|
|
5
|
+
It is much better to use tags that relate to the test, such as a ticket number to connect the development work you are testing
|
|
6
|
+
|
|
7
|
+
## Bad
|
|
8
|
+
|
|
9
|
+
```gherkin
|
|
10
|
+
@t
|
|
11
|
+
Scenario: Log in with valid credentials
|
|
12
|
+
Given I have visited the website
|
|
13
|
+
When I log in with "user1" and "pass1"
|
|
14
|
+
Then I will see my account
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Good
|
|
18
|
+
|
|
19
|
+
```gherkin
|
|
20
|
+
@QE-0001
|
|
21
|
+
Scenario: Log in with valid credentials
|
|
22
|
+
Given I have visited the website
|
|
23
|
+
When I log in with "user1" and "pass1"
|
|
24
|
+
Then I will see my account
|
|
25
|
+
```
|
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.
|
|
4
|
+
version: 3.13.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nigel Brookes-Thomas
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
- John Gluck
|
|
11
11
|
bindir: exe
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2026-
|
|
13
|
+
date: 2026-03-06 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: amatch
|
|
@@ -212,6 +212,7 @@ files:
|
|
|
212
212
|
- lib/chutney/linter/too_many_different_tags.rb
|
|
213
213
|
- lib/chutney/linter/too_many_steps.rb
|
|
214
214
|
- lib/chutney/linter/too_many_tags.rb
|
|
215
|
+
- lib/chutney/linter/too_short_tag.rb
|
|
215
216
|
- lib/chutney/linter/unique_scenario_names.rb
|
|
216
217
|
- lib/chutney/linter/unknown_variable.rb
|
|
217
218
|
- lib/chutney/linter/unused_variable.rb
|
|
@@ -223,7 +224,6 @@ files:
|
|
|
223
224
|
- lib/chutney/lsp/server.rb
|
|
224
225
|
- lib/chutney/version.rb
|
|
225
226
|
- lib/config/locales/en.yml
|
|
226
|
-
- spec/chutney_mcp_spec.rb
|
|
227
227
|
- spec/chutney_spec.rb
|
|
228
228
|
- spec/spec_helper.rb
|
|
229
229
|
- usechutney.com.site/.gitignore
|
|
@@ -235,6 +235,7 @@ files:
|
|
|
235
235
|
- usechutney.com.site/site/assets/favicons/favicon.ico
|
|
236
236
|
- usechutney.com.site/site/assets/favicons/site.webmanifest
|
|
237
237
|
- usechutney.com.site/site/assets/mr_pickle.png
|
|
238
|
+
- usechutney.com.site/site/assets/robots.txt
|
|
238
239
|
- usechutney.com.site/site/assets/styles.css
|
|
239
240
|
- usechutney.com.site/site/src/about.page.md
|
|
240
241
|
- usechutney.com.site/site/src/docs/configuration.page.md
|
|
@@ -280,6 +281,7 @@ files:
|
|
|
280
281
|
- usechutney.com.site/site/src/docs/rules/too-many-different-tags.page.md
|
|
281
282
|
- usechutney.com.site/site/src/docs/rules/too-many-steps.page.md
|
|
282
283
|
- usechutney.com.site/site/src/docs/rules/too-many-tags.page.md
|
|
284
|
+
- usechutney.com.site/site/src/docs/rules/too_short_tag.page.md
|
|
283
285
|
- usechutney.com.site/site/src/docs/rules/unique-scenario-names.page.md
|
|
284
286
|
- usechutney.com.site/site/src/docs/rules/unknown-variable.page.md
|
|
285
287
|
- usechutney.com.site/site/src/docs/rules/unused-variable.page.md
|
|
@@ -311,7 +313,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
311
313
|
- !ruby/object:Gem::Version
|
|
312
314
|
version: '0'
|
|
313
315
|
requirements: []
|
|
314
|
-
rubygems_version: 4.0.
|
|
316
|
+
rubygems_version: 4.0.3
|
|
315
317
|
specification_version: 4
|
|
316
318
|
summary: A linter for multi-lingual Gherkin
|
|
317
319
|
test_files: []
|
data/spec/chutney_mcp_spec.rb
DELETED
|
File without changes
|