chutney 3.14.0 → 3.15.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/config/chutney_defaults.yml +2 -2
- data/lib/chutney/linter/avoid_mutually_exclusive_tags.rb +56 -0
- data/lib/chutney/linter/avoid_tags.rb +16 -16
- data/lib/chutney/version.rb +1 -1
- data/lib/chutney.rb +1 -0
- data/lib/config/locales/en.yml +3 -1
- data/usechutney.com.site/site/src/docs/rules/avoid-mutually-exclusive-tags.page.md +69 -0
- data/usechutney.com.site/site/src/docs/rules/{avoid-tags.md → avoid-tags.page.md} +1 -0
- data/usechutney.com.site/site/src/docs/rules/index.page.md +1 -0
- metadata +5 -14
- data/docs/.keep +0 -0
- data/docs/_config.yml +0 -8
- data/docs/credits.md +0 -15
- data/docs/index.md +0 -24
- data/docs/installation.md +0 -21
- data/docs/logo.png +0 -0
- data/docs/usage/configuration.md +0 -12
- data/docs/usage/index.md +0 -16
- data/docs/usage/output.md +0 -26
- data/docs/usage/rules.md +0 -90
- data/docs/usage/selective_enablement.md +0 -14
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e73618c6f81cbfab1e5928582ac4123976b85f8e81e325258a53842e60c8b3a0
|
|
4
|
+
data.tar.gz: 8cafe000236c2508a6aabf52c29abcba07cc073305e4a65773c61bea660025aa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 246eee2cb29c53d2542cb8791be4c8720ae5847d1633b8b5500ed68fc80ce4e3109638055f547c6693aebf6f25c2da232d704fbcfa1007da1b9a64b2d5388bc8
|
|
7
|
+
data.tar.gz: 32c89a884eae22053fd85dbdcb74f8500a0cf2d7a1a62d6a801d69af6a5fae6e8068eeee0370bfa482e363a2a968beb9e6bfcdfd88207f660a9d4cc20151df94
|
data/config/chutney_defaults.yml
CHANGED
|
@@ -2,10 +2,10 @@ AvoidColonsAtStartOfNames:
|
|
|
2
2
|
Enabled: true
|
|
3
3
|
AvoidCommaInTags:
|
|
4
4
|
Enabled: true
|
|
5
|
-
AvoidOutlineForSingleExample:
|
|
6
|
-
Enabled: true
|
|
7
5
|
AvoidFullStop:
|
|
8
6
|
Enabled: true
|
|
7
|
+
AvoidOutlineForSingleExample:
|
|
8
|
+
Enabled: true
|
|
9
9
|
AvoidScripting:
|
|
10
10
|
Enabled: true
|
|
11
11
|
AvoidSplatStepsInBackground:
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Chutney
|
|
4
|
+
# service class to lint for avoiding mutually exclusive tags
|
|
5
|
+
class AvoidMutuallyExclusiveTags < Linter
|
|
6
|
+
def lint
|
|
7
|
+
return if feature.nil?
|
|
8
|
+
|
|
9
|
+
feature_tags = tags_for(feature)
|
|
10
|
+
scenarios do |_feature, scenario|
|
|
11
|
+
scenario_tags = tags_for(scenario)
|
|
12
|
+
# use [nil] for plain scenarios so the loop runs once with no example tags
|
|
13
|
+
examples_blocks = scenario.respond_to?(:examples) ? scenario.examples : [nil]
|
|
14
|
+
|
|
15
|
+
tag_groups.each do |group|
|
|
16
|
+
check_group(group, feature_tags, scenario, scenario_tags, examples_blocks)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def check_group(group, feature_tags, scenario, scenario_tags, examples_blocks)
|
|
24
|
+
# seed seen_tags with any exclusive tags already present at feature/scenario level
|
|
25
|
+
seen_tags = (feature_tags + scenario_tags) & group
|
|
26
|
+
reported_scenario = (scenario_tags & group).any? ? scenario : nil
|
|
27
|
+
reported_examples = nil
|
|
28
|
+
|
|
29
|
+
# accumulate exclusive tags across each "Examples:" block, tracking the last element with a group tag
|
|
30
|
+
examples_blocks.each do |examples|
|
|
31
|
+
example_tags = examples ? tags_for(examples) : []
|
|
32
|
+
seen_tags += example_tags & group
|
|
33
|
+
if example_tags.intersect?(group)
|
|
34
|
+
reported_examples = examples
|
|
35
|
+
reported_scenario = scenario
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
return if seen_tags.length < 2
|
|
40
|
+
|
|
41
|
+
# report at the deepest location: examples > scenario > feature
|
|
42
|
+
formatted = seen_tags.map { |t| "@#{t}" }.join(', ')
|
|
43
|
+
add_issue(
|
|
44
|
+
I18n.t('linters.avoid_mutually_exclusive_tags', tags: formatted),
|
|
45
|
+
feature,
|
|
46
|
+
reported_scenario,
|
|
47
|
+
reported_examples
|
|
48
|
+
)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def tag_groups
|
|
52
|
+
groups = configuration['TagGroups'] || []
|
|
53
|
+
groups.is_a?(Array) ? groups : []
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -6,31 +6,31 @@ module Chutney
|
|
|
6
6
|
def lint
|
|
7
7
|
return if feature.nil?
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
feature_tags_to_avoid_found = feature_tags & tags_to_avoid
|
|
11
|
-
|
|
12
|
-
unless feature_tags_to_avoid_found.empty?
|
|
13
|
-
feature_tags_to_avoid_found = feature_tags_to_avoid_found.map { |tag| tag.prepend('@') }
|
|
14
|
-
add_issue(I18n.t('linters.avoid_tags', tags: feature_tags_to_avoid_found.join(', ')), feature)
|
|
15
|
-
end
|
|
9
|
+
check_tags(feature, feature)
|
|
16
10
|
|
|
17
11
|
scenarios do |_feature, scenario|
|
|
18
|
-
|
|
19
|
-
scenario_tags_to_avoid_found = scenario_tags & tags_to_avoid
|
|
12
|
+
check_tags(scenario, feature, scenario)
|
|
20
13
|
|
|
21
|
-
unless
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
next unless scenario.respond_to?(:examples)
|
|
15
|
+
|
|
16
|
+
scenario.examples.each do |examples|
|
|
17
|
+
check_tags(examples, feature, scenario, examples)
|
|
24
18
|
end
|
|
25
19
|
end
|
|
26
20
|
end
|
|
27
21
|
|
|
28
|
-
|
|
29
|
-
tags_to_avoid = configuration['Tags'] || []
|
|
22
|
+
private
|
|
30
23
|
|
|
31
|
-
|
|
24
|
+
def check_tags(element, *location)
|
|
25
|
+
found = tags_for(element) & tags_to_avoid
|
|
26
|
+
return if found.empty?
|
|
32
27
|
|
|
33
|
-
|
|
28
|
+
add_issue(I18n.t('linters.avoid_tags', tags: found.map { |t| "@#{t}" }.join(', ')), *location)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def tags_to_avoid
|
|
32
|
+
tags = configuration['Tags'] || []
|
|
33
|
+
tags.is_a?(Array) ? tags : []
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
end
|
data/lib/chutney/version.rb
CHANGED
data/lib/chutney.rb
CHANGED
|
@@ -7,6 +7,7 @@ require 'chutney/linter'
|
|
|
7
7
|
require 'chutney/linter/avoid_colons_at_start_of_names'
|
|
8
8
|
require 'chutney/linter/avoid_comma_in_tags'
|
|
9
9
|
require 'chutney/linter/avoid_full_stop'
|
|
10
|
+
require 'chutney/linter/avoid_mutually_exclusive_tags'
|
|
10
11
|
require 'chutney/linter/avoid_outline_for_single_example'
|
|
11
12
|
require 'chutney/linter/avoid_scripting'
|
|
12
13
|
require 'chutney/linter/avoid_splat_steps_in_background'
|
data/lib/config/locales/en.yml
CHANGED
|
@@ -9,6 +9,8 @@ en:
|
|
|
9
9
|
Avoid using commas in tags. Tags should be separated by spaces.
|
|
10
10
|
avoid_full_stop: >- # https://en.wikipedia.org/wiki/Full_stop
|
|
11
11
|
Avoid using a full-stop in steps so that it is easier to re-use them.
|
|
12
|
+
avoid_mutually_exclusive_tags: >-
|
|
13
|
+
The following mutually exclusive tags are not allowed to be used together: %{tags}
|
|
12
14
|
avoid_outline_for_single_example: >-
|
|
13
15
|
Avoid using Scenario Outlines when you only have a single example.
|
|
14
16
|
Use a Scenario instead.
|
|
@@ -20,7 +22,7 @@ en:
|
|
|
20
22
|
avoid_splat_steps_in_scenarios: >-
|
|
21
23
|
The Scenario contains a splat step. It should only contain named steps.
|
|
22
24
|
avoid_tags: >-
|
|
23
|
-
The following tags are not allowed: %{tags}
|
|
25
|
+
The following tags are not allowed: %{tags}
|
|
24
26
|
avoid_typographers_quotes: >-
|
|
25
27
|
You are using typographers quotation marks (curly quotes).
|
|
26
28
|
Make sure you intend to use this character and not a neutral quote
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Avoid Mutually Exclusive Tags
|
|
2
|
+
|
|
3
|
+
Some tags are mutually exclusive by nature — they represent states or configurations that cannot coexist. For example, `@mobile` and `@desktop`, or `@en` and `@fr`.
|
|
4
|
+
|
|
5
|
+
AvoidMutuallyExclusiveTags warns you when tags from the same mutually exclusive group appear together across a feature, scenario, or examples block.
|
|
6
|
+
|
|
7
|
+
## Configuration
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
AvoidMutuallyExclusiveTags:
|
|
11
|
+
Enabled: true
|
|
12
|
+
TagGroups:
|
|
13
|
+
- - mobile
|
|
14
|
+
- desktop
|
|
15
|
+
- - en
|
|
16
|
+
- fr
|
|
17
|
+
- de
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Each entry in `TagGroups` is a list of tags that are mutually exclusive with each other. Any two or more tags from the same group appearing together will raise an issue.
|
|
21
|
+
|
|
22
|
+
## Bad
|
|
23
|
+
|
|
24
|
+
```gherkin
|
|
25
|
+
@mobile @desktop
|
|
26
|
+
Scenario: View the homepage
|
|
27
|
+
Given I have visited the website
|
|
28
|
+
When I view the homepage
|
|
29
|
+
Then I see the welcome message
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
```gherkin
|
|
33
|
+
@mobile
|
|
34
|
+
Feature: View the homepage
|
|
35
|
+
@desktop
|
|
36
|
+
Scenario: See the welcome message
|
|
37
|
+
Given I have visited the website
|
|
38
|
+
When I view the homepage
|
|
39
|
+
Then I see the welcome message
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
```gherkin
|
|
43
|
+
@mobile
|
|
44
|
+
Feature: View the homepage
|
|
45
|
+
Scenario Outline: See the welcome message in <language>
|
|
46
|
+
Given I have visited the website
|
|
47
|
+
When I view the homepage
|
|
48
|
+
Then I see the welcome message in <language>
|
|
49
|
+
@desktop
|
|
50
|
+
Examples:
|
|
51
|
+
| language |
|
|
52
|
+
| English |
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Good
|
|
56
|
+
|
|
57
|
+
```gherkin
|
|
58
|
+
@mobile
|
|
59
|
+
Scenario: View the homepage on mobile
|
|
60
|
+
Given I have visited the website
|
|
61
|
+
When I view the homepage
|
|
62
|
+
Then I see the welcome message
|
|
63
|
+
|
|
64
|
+
@desktop
|
|
65
|
+
Scenario: View the homepage on desktop
|
|
66
|
+
Given I have visited the website
|
|
67
|
+
When I view the homepage
|
|
68
|
+
Then I see the welcome message
|
|
69
|
+
```
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# Avoid Tags
|
|
2
2
|
|
|
3
3
|
Sometimes you just need a tag for you... maybe to filter your scenarios for focused testing?... or maybe you've got some fancy after hook to help with debugging?
|
|
4
|
+
|
|
4
5
|
Whatever the reason, you probably didn't mean to commit that to source.
|
|
5
6
|
|
|
6
7
|
AvoidTags helps prevent the accidental commit of tags by warning you if you have any tags in your feature file which match a configurable list of tags to avoid.
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* [Avoid Scripting](/docs/rules/avoid-scripting)
|
|
8
8
|
* [Avoid Splat Steps in Background](/docs/rules/avoid-splat-steps-in-background)
|
|
9
9
|
* [Avoid Splat Steps in Scenarios](/docs/rules/avoid-splat-steps-in-scenarios)
|
|
10
|
+
* [Avoid Tags](/docs/rules/avoid-tags)
|
|
10
11
|
* [Avoid Typographers' Quotes](/docs/rules/avoid-typographers-quotes)
|
|
11
12
|
* [Background Does More Than Setup](/docs/rules/background-does-more-than-setup)
|
|
12
13
|
* [Background Requires Multiple Scenarios](/docs/rules/background-requires-multiple-scenarios)
|
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.15.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-07-20 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: amatch
|
|
@@ -149,17 +149,6 @@ files:
|
|
|
149
149
|
- chutney.gemspec
|
|
150
150
|
- config/chutney_defaults.yml
|
|
151
151
|
- config/cucumber.yml
|
|
152
|
-
- docs/.keep
|
|
153
|
-
- docs/_config.yml
|
|
154
|
-
- docs/credits.md
|
|
155
|
-
- docs/index.md
|
|
156
|
-
- docs/installation.md
|
|
157
|
-
- docs/logo.png
|
|
158
|
-
- docs/usage/configuration.md
|
|
159
|
-
- docs/usage/index.md
|
|
160
|
-
- docs/usage/output.md
|
|
161
|
-
- docs/usage/rules.md
|
|
162
|
-
- docs/usage/selective_enablement.md
|
|
163
152
|
- examples/emoji.feature
|
|
164
153
|
- exe/chutney
|
|
165
154
|
- exe/chutney-lsp
|
|
@@ -179,6 +168,7 @@ files:
|
|
|
179
168
|
- lib/chutney/linter/avoid_colons_at_start_of_names.rb
|
|
180
169
|
- lib/chutney/linter/avoid_comma_in_tags.rb
|
|
181
170
|
- lib/chutney/linter/avoid_full_stop.rb
|
|
171
|
+
- lib/chutney/linter/avoid_mutually_exclusive_tags.rb
|
|
182
172
|
- lib/chutney/linter/avoid_outline_for_single_example.rb
|
|
183
173
|
- lib/chutney/linter/avoid_scripting.rb
|
|
184
174
|
- lib/chutney/linter/avoid_splat_steps_in_background.rb
|
|
@@ -248,11 +238,12 @@ files:
|
|
|
248
238
|
- usechutney.com.site/site/src/docs/rules/avoid-colons-at-start-of-names.page.md
|
|
249
239
|
- usechutney.com.site/site/src/docs/rules/avoid-comma-in-tags.page.md
|
|
250
240
|
- usechutney.com.site/site/src/docs/rules/avoid-full-stops.page.md
|
|
241
|
+
- usechutney.com.site/site/src/docs/rules/avoid-mutually-exclusive-tags.page.md
|
|
251
242
|
- usechutney.com.site/site/src/docs/rules/avoid-outline-for-single-example.page.md
|
|
252
243
|
- usechutney.com.site/site/src/docs/rules/avoid-scripting.page.md
|
|
253
244
|
- usechutney.com.site/site/src/docs/rules/avoid-splat-steps-in-background.page.md
|
|
254
245
|
- usechutney.com.site/site/src/docs/rules/avoid-splat-steps-in-scenarios.page.md
|
|
255
|
-
- usechutney.com.site/site/src/docs/rules/avoid-tags.md
|
|
246
|
+
- usechutney.com.site/site/src/docs/rules/avoid-tags.page.md
|
|
256
247
|
- usechutney.com.site/site/src/docs/rules/avoid-typographers-quotes.page.md
|
|
257
248
|
- usechutney.com.site/site/src/docs/rules/background-does-more-than-setup.page.md
|
|
258
249
|
- usechutney.com.site/site/src/docs/rules/background-requires-multiple-scenarios.page.md
|
data/docs/.keep
DELETED
|
File without changes
|
data/docs/_config.yml
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
remote_theme: pmarsceill/just-the-docs
|
|
2
|
-
logo: "https://raw.githubusercontent.com/BillyRuffian/chutney/master/docs/logo.png"
|
|
3
|
-
title: Chutney
|
|
4
|
-
description: A linter for Gherkin
|
|
5
|
-
aux_links:
|
|
6
|
-
"Chutney on GitHub":
|
|
7
|
-
- "https://github.com/BillyRuffian/chutney"
|
|
8
|
-
footer_content: "Copyright © 2019-2020 Nigel Brookes-Thomas. Distributed by an <a href=\"https://github.com/BillyRuffian/chutney/blob/master/LICENSE.txt\">MIT license.</a>"
|
data/docs/credits.md
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
layout: default
|
|
3
|
-
title: Credits
|
|
4
|
-
nav_order: 4
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Credits
|
|
8
|
-
|
|
9
|
-
This linter started life as a fork of the abandoned [gherkin_lint](https://github.com/funkwerk/gherkin_lint) and very great deal of credit for the linting rules goes to the original author(s) of that project.
|
|
10
|
-
|
|
11
|
-
I've dusted it off and brought it up to date with Cucumber 3 and improved the internals.
|
|
12
|
-
|
|
13
|
-
# Logo
|
|
14
|
-
|
|
15
|
-
Pickle jar image by [OpenClipart-Vectors](https://pixabay.com/users/OpenClipart-Vectors-30363/?utm_source=link-attribution&utm_medium=referral&utm_campaign=image&utm_content=576536) from [Pixabay](https://pixabay.com/?utm_source=link-attribution&utm_medium=referral&utm_campaign=image&utm_content=576536).
|
data/docs/index.md
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
layout: default
|
|
3
|
-
title: Home
|
|
4
|
-
nav_order: 1
|
|
5
|
-
permalink: /
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# These docs are deprecated
|
|
9
|
-
## Please visit [usechutney.com](https://www.usechutney.com/) for the latest documentation
|
|
10
|
-
|
|
11
|
-
# Best practice for Cucumber
|
|
12
|
-
{: .fs-9 }
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
Chutney tastes your Cumber feature files and lets you know if they're tasty or nasty.
|
|
16
|
-
{: .fs-6 .fw-300 }
|
|
17
|
-
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
You're trying to follow TDD or ATDD principles, you're writing executable specifications in gherkin using Cucumber, you're trying to do *the right thing* but are you doing *the thing right*?
|
|
21
|
-
|
|
22
|
-
Cucumber itself is an awesome tool which bridges with gap between business language, software development language and the language of testers. With all these folks interested, it's easy to write problematic and hard to maintain features. Chutney tries to help with that by having a common set of quality rules for your feature files.
|
|
23
|
-
|
|
24
|
-
Chutney is able to lint feature files in any spoken language supported by Cucumber.
|
data/docs/installation.md
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
layout: default
|
|
3
|
-
title: Installing
|
|
4
|
-
nav_order: 2
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Installing
|
|
8
|
-
|
|
9
|
-
Add this line to your application's Gemfile:
|
|
10
|
-
|
|
11
|
-
```ruby
|
|
12
|
-
gem 'chutney', require: false
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
And then execute:
|
|
16
|
-
|
|
17
|
-
$ bundle
|
|
18
|
-
|
|
19
|
-
Or install it yourself as:
|
|
20
|
-
|
|
21
|
-
$ gem install chutney
|
data/docs/logo.png
DELETED
|
Binary file
|
data/docs/usage/configuration.md
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
layout: default
|
|
3
|
-
title: Configuration
|
|
4
|
-
parent: Usage
|
|
5
|
-
nav_order: 3
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Configuration
|
|
9
|
-
|
|
10
|
-
Chutney looks for a configuration file in the current directory called `config/.chutney.yml`. This configuration mostly switches on individual linters globally, but a few have addition parameters which can be configured (e.g. the maximum characters in a step).
|
|
11
|
-
|
|
12
|
-
A default configuration can be found [here](https://github.com/BillyRuffian/chutney/blob/master/config/chutney_defaults.yml).
|
data/docs/usage/index.md
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
layout: default
|
|
3
|
-
title: Usage
|
|
4
|
-
nav_order: 3
|
|
5
|
-
has_children: true
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Usage
|
|
9
|
-
|
|
10
|
-
Chutney expects to be able to find your Cucumber `.feature` files. By default, it will look for a folder called `features` in the current directory and will dig through all subfolders to find features.
|
|
11
|
-
|
|
12
|
-
You can give Chutney a path (using Ruby's globbing rules) or a single file if you want.
|
|
13
|
-
|
|
14
|
-
```
|
|
15
|
-
chutney '<wild_card_path>' #default is `features/**/*.feature`
|
|
16
|
-
```
|
data/docs/usage/output.md
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
layout: default
|
|
3
|
-
title: Output & Exit Codes
|
|
4
|
-
parent: Usage
|
|
5
|
-
nav_order: 1
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Output
|
|
9
|
-
|
|
10
|
-
Chutney ships with a few formatters, the default being the Rainbow Formatter (it has coloured terminal output). Others included are the Pie Formatter which presents a textual pie chart of all the violations, and a JSON Formatter which, as is sounds, dumps the result as a JSON string.
|
|
11
|
-
|
|
12
|
-
You can specify one or formatters with the `-f` flag. For instance...
|
|
13
|
-
|
|
14
|
-
```
|
|
15
|
-
chutney -f RainbowFormatter -f PieFormatter -f JSONFormatter
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Building Your Own Formatters
|
|
19
|
-
|
|
20
|
-
Chutney expects formatters to be namespaced to the `Chutney` module and respond to `results=(results_hash)` and `format`. There is a parent class `Chutney::Formatter` which provides a few utility methods you might find useful.
|
|
21
|
-
|
|
22
|
-
Take a look a the JSONFormatter as the most minimal implementation -- it just calls `to_json` on the hash it is given.
|
|
23
|
-
|
|
24
|
-
## Exit Codes
|
|
25
|
-
|
|
26
|
-
Using the command line, Chutney returns 0 if no violations are found, 1 if one or more are found.
|
data/docs/usage/rules.md
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
layout: default
|
|
3
|
-
title: Rules
|
|
4
|
-
parent: Usage
|
|
5
|
-
nav_order: 2
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Linting Rules
|
|
9
|
-
|
|
10
|
-
Chutney enforces its rules with the linters. These are:
|
|
11
|
-
|
|
12
|
-
[AvoidFullStop](https://github.com/BillyRuffian/chutney/blob/master/features/avoid_full_stop.feature): Don't have a full stop (period) at the end of step because it makes step reuse really hard.
|
|
13
|
-
|
|
14
|
-
[AvoidOutlineForSingleExample](https://github.com/BillyRuffian/chutney/blob/master/features/avoid_outline_for_single_example.feature): If you only have a single example in your example table, use a plain-old scenario instead.
|
|
15
|
-
|
|
16
|
-
[AvoidScripting](https://github.com/BillyRuffian/chutney/blob/master/features/avoid_scripting.feature): You have a lot of steps, are you sure you're not scripting the scenario when you should be specifying the behaviour of the system?
|
|
17
|
-
|
|
18
|
-
[AvoidSplatStepsInBackground](https://github.com/BillyRuffian/chutney/blob/master/features/avoid_splat_steps_in_background.feature): The Background contains a splat step. It should only contain named steps.
|
|
19
|
-
|
|
20
|
-
[AvoidSplatStepsInScenarios](https://github.com/BillyRuffian/chutney/blob/master/features/avoid_splat_steps_in_scenarios.feature): The Scenario contains a splat step. It should only contain named steps.
|
|
21
|
-
|
|
22
|
-
[AvoidTags](https://github.com/BillyRuffian/chutney/blob/master/features/avoid_tags.feature): The Feature file contains tags to avoid.
|
|
23
|
-
|
|
24
|
-
[AvoidTypographersQuotes](https://github.com/BillyRuffian/chutney/blob/master/features/avoid_typographers_quotes.feature): Cutting and pasting from Word documents? Is that pasting in curly-quotes instead of neutral ones you would type on a keyboard? Are you sure that's what you want?
|
|
25
|
-
|
|
26
|
-
[BackgroundDoesMoreThanSetup](https://github.com/BillyRuffian/chutney/blob/master/features/background_does_more_than_setup.feature): Background in feature files should only do setup activity and so they should only contain `Given` steps.
|
|
27
|
-
|
|
28
|
-
[BackgroundRequiresMultipleScenarios](https://github.com/BillyRuffian/chutney/blob/master/features/background_requires_multiple_scenarios.feature): If you only have one scenario, don't bother having a Background section.
|
|
29
|
-
|
|
30
|
-
[BadScenarioName](https://github.com/BillyRuffian/chutney/blob/master/features/bad_scenario_name.feature): You should avoid using words like 'test' or 'check' in your scenario names, instead you should define the behaviour of your system.
|
|
31
|
-
|
|
32
|
-
[EmptyFeatureFile](https://github.com/BillyRuffian/chutney/blob/master/features/empty_feature_file.feature): The feature should have content and should avoid committing empty features to repositories.
|
|
33
|
-
|
|
34
|
-
[FileNameDiffersFeatureName](https://github.com/BillyRuffian/chutney/blob/master/features/file_name_differs_feature_name.feature): The feature should have a name that follows the file name.
|
|
35
|
-
|
|
36
|
-
[GivensAfterBackground](https://github.com/BillyRuffian/chutney/blob/master/features/givens_after_background.feature): If you have a Background section and your scenario needs more preconditions then it should start immediately with an `And` step and not another `Given`.
|
|
37
|
-
|
|
38
|
-
[InconsistentQuoting](https://github.com/BillyRuffian/chutney/blob/master/features/inconsistent_quoting.feature): Use either single quotation marks *or* double quotation marks around parameters but don't use a mix of the two styles.
|
|
39
|
-
|
|
40
|
-
[InvalidFileName](https://github.com/BillyRuffian/chutney/blob/master/features/invalid_file_name.feature): Make sure your file name is in snake case, not mixed case or with spaces.
|
|
41
|
-
|
|
42
|
-
[InvalidStepFlow](https://github.com/BillyRuffian/chutney/blob/master/features/invalid_step_flow.feature): Your scenarios should follow Given → When → Then, in that order.
|
|
43
|
-
|
|
44
|
-
[MissingExampleName](https://github.com/BillyRuffian/chutney/blob/master/features/missing_example_name.feature): If you have more than one example table in your scenario, they should each be given unique names.
|
|
45
|
-
|
|
46
|
-
[MissingExampleTable](https://github.com/BillyRuffian/chutney/blob/master/features/missing_example_table.feature): You are missing an example table. You should have at least one example table when using Scenario outlines.
|
|
47
|
-
|
|
48
|
-
[MissingFeatureDescription](https://github.com/BillyRuffian/chutney/blob/master/features/missing_feature_description.feature): Your feature should have a value statement. These are usually in the form 'As a... I want.. So that...'.
|
|
49
|
-
|
|
50
|
-
[MissingFeatureName](https://github.com/BillyRuffian/chutney/blob/master/features/missing_feature_name.feature): You should give your features a descriptive name.
|
|
51
|
-
|
|
52
|
-
[MissingScenarioName](https://github.com/BillyRuffian/chutney/blob/master/features/missing_scenario_name.feature): You should name your scenarios and scenario outlines.
|
|
53
|
-
|
|
54
|
-
[MissingScenarioOutline](https://github.com/BillyRuffian/chutney/blob/master/features/missing_scenario_outline.feature): You should use Scenario Outline instead of Scenario when there is an Examples table to indicate that this scenario will be run multiple times with different data.
|
|
55
|
-
|
|
56
|
-
[MissingTestAction](https://github.com/BillyRuffian/chutney/blob/master/features/missing_test_action.feature): You don't have an action (a `When` step) in your scenario.
|
|
57
|
-
|
|
58
|
-
[MissingVerification](https://github.com/BillyRuffian/chutney/blob/master/features/missing_verification.feature): You don't have a verification step (a `Then` step) in your scenario.
|
|
59
|
-
|
|
60
|
-
[RequiredTagsStartWith](https://github.com/BillyRuffian/chutney/blob/master/features/required_tags_starts_with.feature): Chutney can enforce a configurable naming prefix for your tags.
|
|
61
|
-
|
|
62
|
-
[SameSecenario](https://github.com/BillyRuffian/chutney/blob/master/features/same_scenario.feature): Makes sure you don't acidentally duplicate the actions of your scenario. *Since v3.11.0*
|
|
63
|
-
|
|
64
|
-
[SameTagForDifferentCase](https://github.com/BillyRuffian/chutney/blob/master/features/same_tag_different_case.feature): Don't mix the case of tags which have already appeared. Cucumber tags are case sensitive. *Since 3.1.0*
|
|
65
|
-
|
|
66
|
-
[SameTagForAllScenarios](https://github.com/BillyRuffian/chutney/blob/master/features/same_tag_for_all_scenarios.feature): You have the same tag for all you scenarios; move the tag to the feature level instead.
|
|
67
|
-
|
|
68
|
-
[ScenarioNamesMatch](https://github.com/BillyRuffian/chutney/blob/master/features/scenario_names_match.feature): Chutney can enforce a naming convention for your scenario names.
|
|
69
|
-
|
|
70
|
-
[TagUsedMultipleTimes](https://github.com/BillyRuffian/chutney/blob/master/features/tag_used_multiple_times.feature): Chutney can warn if you have used a tag a lot with a feature.
|
|
71
|
-
|
|
72
|
-
[TooClumsy](https://github.com/BillyRuffian/chutney/blob/master/features/too_clumsy.feature): This is a very long scenario. Consider writing it more concisely.
|
|
73
|
-
|
|
74
|
-
[TooLongStep](https://github.com/BillyRuffian/chutney/blob/master/features/too_long_step.feature): This is a very long step. Consider writing it more concisely.
|
|
75
|
-
|
|
76
|
-
[TooManyDifferentTags](https://github.com/BillyRuffian/chutney/blob/master/features/too_many_different_tags.feature): This feature has a lot of different tags.
|
|
77
|
-
|
|
78
|
-
[TooManySteps](https://github.com/BillyRuffian/chutney/blob/master/features/too_many_steps.feature): This feature has a lot of steps. Consider writing it more concisely.
|
|
79
|
-
|
|
80
|
-
[TooManyTags](https://github.com/BillyRuffian/chutney/blob/master/features/too_many_tags.feature): There are a lot of tags in this feature.
|
|
81
|
-
|
|
82
|
-
[UniqueScenarioNames](https://github.com/BillyRuffian/chutney/blob/master/features/unique_scenario_names.feature): You have duplicated a scenario name when they should be unique.
|
|
83
|
-
|
|
84
|
-
[UnknownVariable](https://github.com/BillyRuffian/chutney/blob/master/features/unknown_variable.feature): You are referencing a variable which doesn't appear to be defined. This is a source of subtle errors.
|
|
85
|
-
|
|
86
|
-
[UnusedVariable](https://github.com/BillyRuffian/chutney/blob/master/features/unused_variable.feature): You have a variable which you are not using.
|
|
87
|
-
|
|
88
|
-
[UseBackground](https://github.com/BillyRuffian/chutney/blob/master/features/use_background.feature): You have a setup setup used in all of your scenarios. Move it to a Background section.
|
|
89
|
-
|
|
90
|
-
[UseOutline](https://github.com/BillyRuffian/chutney/blob/master/features/use_outline.feature): You have very similar scenarios. You should consider if they should be combined into a Scenario Outline.
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
layout: default
|
|
3
|
-
title: Selectively Disabling Rules
|
|
4
|
-
parent: Usage
|
|
5
|
-
nav_order: 4
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Selectively Disabling Rules
|
|
9
|
-
|
|
10
|
-
Sometimes you want to be able to disable linting rules for just one specific file or one specific scenario.
|
|
11
|
-
|
|
12
|
-
To do this, use the tag format `@disable<Linter Name>`. For example `@disableTooLongStep`.
|
|
13
|
-
|
|
14
|
-
If used at the feature level, the linter will be deactivated for the whole file, used at the scenario level, only that one scenario will be excused.
|