chutney 2.0.0 → 2.1.0

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
  SHA256:
3
- metadata.gz: 967bc92b45b3c91b5b2ed37a85ece49c49396cd8dcf3ff3c4c84de2f3a796ae9
4
- data.tar.gz: 1e841bd73bde6d32fc437dc6663c499296c2eb1614441298117d74ab17f4ac05
3
+ metadata.gz: 9b678f90aea391f8707bda58ec5e2f6caf9b5d1f1bf5b1503c6862d4023d5f18
4
+ data.tar.gz: ecb2e762fa06c882869ff007e80261137816f431a78c07257d2f140e8f8f6f78
5
5
  SHA512:
6
- metadata.gz: 2118af0253237df26adb959a9b293492dcc7a699937c291c5c38d0d39128531dc7f08a62a300ca6f3b7f697454eb8c7370d739fc0bb1a9aa6655ca55e964d79e
7
- data.tar.gz: b0be880b1fdc7d833db386b713f8c0d98e038b3a6946faaa3b41e8bc32ebe31da16e1104b0d00a51d8ebab5c031b29c7c5367e67fe0c856a1e0b650c5f390533
6
+ metadata.gz: 5f1f5c793a5d0080320606d56471f8ebcb7b0c3ceedca3e5e492eb877d1f0582aef997cd686c9e4782afeff407fb0346a0acbee288bca7306b39f2d8dc951540
7
+ data.tar.gz: 362d6bf5c6a1cb8c14a005534259e0ad5592df046a6dc3f747562b0b1875ee22e19b2076ff60873ca54967e2bd2188513566c36d0433ccd1c886fbc73b5c71ab
data/.rufo ADDED
@@ -0,0 +1 @@
1
+ quote_style :single
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
16
16
  spec.description = 'A linter for your Cucumber features. ' \
17
17
  'It supports any spoken language Cucumber v3 supports.'
18
18
 
19
- spec.homepage = 'https://billyruffian.github.io/faker_maker/'
19
+ spec.homepage = 'https://billyruffian.github.io/chutney/'
20
20
  spec.license = 'MIT'
21
21
 
22
22
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
@@ -51,10 +51,11 @@ Gem::Specification.new do |spec|
51
51
 
52
52
  spec.add_development_dependency 'coveralls', '~> 0.8'
53
53
  spec.add_development_dependency 'cucumber', '~> 3.0'
54
+ spec.add_development_dependency 'pry-byebug', '~> 3.0'
54
55
  spec.add_development_dependency 'rake', '~> 13.0'
55
56
  spec.add_development_dependency 'rerun', '~> 0.13'
56
57
  spec.add_development_dependency 'rspec-expectations', '~> 3.0'
57
- spec.add_development_dependency 'rubocop', '~> 0.79.0'
58
+ spec.add_development_dependency 'rubocop', '~> 0.85.1'
58
59
  spec.add_development_dependency 'rspec', '~> 3.8'
59
60
 
60
61
  end
@@ -4,6 +4,8 @@ AvoidFullStop:
4
4
  Enabled: true
5
5
  AvoidScripting:
6
6
  Enabled: true
7
+ AvoidTypographersQuotes:
8
+ Enabled: true
7
9
  BackgroundDoesMoreThanSetup:
8
10
  Enabled: true
9
11
  BackgroundRequiresMultipleScenarios:
@@ -5,7 +5,7 @@ nav_order: 1
5
5
  permalink: /
6
6
  ---
7
7
 
8
- # Best practice for your Cucumber feature files
8
+ # Best practice for Cucumber
9
9
  {: .fs-9 }
10
10
 
11
11
 
@@ -18,4 +18,4 @@ You're trying to follow TDD or ATDD principles, you're writing executable specif
18
18
 
19
19
  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.
20
20
 
21
- Chutney is able to lint feature files in any spoken language supported by Cucumber 3.
21
+ Chutney is able to lint feature files in any spoken language supported by Cucumber 3.
@@ -9,7 +9,7 @@ nav_order: 2
9
9
  Add this line to your application's Gemfile:
10
10
 
11
11
  ```ruby
12
- gem 'faker_maker', require: false
12
+ gem 'chutney', require: false
13
13
  ```
14
14
 
15
15
  And then execute:
@@ -18,4 +18,4 @@ And then execute:
18
18
 
19
19
  Or install it yourself as:
20
20
 
21
- $ gem install chutney
21
+ $ gem install chutney
Binary file
@@ -7,6 +7,6 @@ nav_order: 3
7
7
 
8
8
  # Configuration
9
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).
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
11
 
12
- A default configuration can be found [here](https://github.com/BillyRuffian/chutney/blob/master/config/default.yml).
12
+ A default configuration can be found [here](https://github.com/BillyRuffian/chutney/blob/master/config/chutney.yml).
@@ -9,92 +9,92 @@ nav_order: 2
9
9
 
10
10
  Chutney enforces its rules with the linters. These are:
11
11
 
12
- AvoidFullStop
12
+ [AvoidFullStop](https://github.com/BillyRuffian/chutney/blob/master/features/avoid_full_stop.feature)
13
13
  : Don't have a full stop (period) at the end of step because it makes step reuse really hard.
14
14
 
15
- AvoidOutlineForSingleExample
15
+ [AvoidOutlineForSingleExample](https://github.com/BillyRuffian/chutney/blob/master/features/avoid_outline_for_single_example.feature)
16
16
  : If you only have a single example in your example table, use a plain-old scenario instead.
17
17
 
18
- AvoidScripting
18
+ [AvoidScripting](https://github.com/BillyRuffian/chutney/blob/master/features/avoid_scripting.feature)
19
19
  : 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?
20
20
 
21
- BackgroundDoesMoreThanSetup
21
+ [BackgroundDoesMoreThanSetup](https://github.com/BillyRuffian/chutney/blob/master/features/background_does_more_than_setup.feature)
22
22
  : Background in feature files should only do setup activity and so they should only contain `Given` steps.
23
23
 
24
- BackgroundRequiresMultipleScenarios
24
+ [BackgroundRequiresMultipleScenarios](https://github.com/BillyRuffian/chutney/blob/master/features/background_requires_multiple_scenarios.feature)
25
25
  : If you only have one scenario, don't bother having a Background section.
26
26
 
27
- BadScenarioName
27
+ [BadScenarioName](https://github.com/BillyRuffian/chutney/blob/master/features/bad_scenario_name.feature)
28
28
  : You should avoid using words like 'test' or 'check' in your scenario names, instead you should define the behaviour of your system.
29
29
 
30
- FileNameDiffersFeatureName
30
+ [FileNameDiffersFeatureName](https://github.com/BillyRuffian/chutney/blob/master/features/file_name_differs_feature_name.feature)
31
31
  : The feature should have a name that follows the file name.
32
32
 
33
- GivensAfterBackground
33
+ [GivensAfterBackground](https://github.com/BillyRuffian/chutney/blob/master/features/givens_after_background.feature)
34
34
  : 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`.
35
35
 
36
- InvalidFileName
36
+ [InvalidFileName](https://github.com/BillyRuffian/chutney/blob/master/features/invalid_file_name.feature)
37
37
  : Make sure your file name is in snake case, not mixed case or with spaces.
38
38
 
39
- InvalidStepFlow
39
+ [InvalidStepFlow](https://github.com/BillyRuffian/chutney/blob/master/features/invalid_step_flow.feature)
40
40
  : Your scenarios should follow Given → When → Then, in that order.
41
41
 
42
- MissingExampleName
42
+ [MissingExampleName](https://github.com/BillyRuffian/chutney/blob/master/features/missing_example_name.feature)
43
43
  : If you have more than one example table in your scenario, they should each be given unique names.
44
44
 
45
- MissingFeatureDescription
45
+ [MissingFeatureDescription](https://github.com/BillyRuffian/chutney/blob/master/features/missing_feature_description.feature)
46
46
  : Your feature should have a value statement. These are usually in the form 'As a... I want.. So that...'.
47
47
 
48
- MissingFeatureName
48
+ [MissingFeatureName](https://github.com/BillyRuffian/chutney/blob/master/features/missing_feature_name.feature)
49
49
  : You should give your features a descriptive name.
50
50
 
51
- MissingScenarioName
51
+ [MissingScenarioName](https://github.com/BillyRuffian/chutney/blob/master/features/missing_scenario_name.feature)
52
52
  : You should name your scenarios and scenario outlines.
53
53
 
54
- MissingTestAction
54
+ [MissingTestAction](https://github.com/BillyRuffian/chutney/blob/master/features/missing_test_action.feature)
55
55
  : You don't have an action (a `When` step) in your scenario.
56
56
 
57
- MissingVerification
57
+ [MissingVerification](https://github.com/BillyRuffian/chutney/blob/master/features/missing_verification.feature)
58
58
  : You don't have a verification step (a `Then` step) in your scenario.
59
59
 
60
- RequiredTagsStartWith
60
+ [RequiredTagsStartWith](https://github.com/BillyRuffian/chutney/blob/master/features/required_tags_starts_with.feature)
61
61
  : Chutney can enforce a configurable naming prefix for your tags.
62
62
 
63
- SameTagForAllScenarios
63
+ [SameTagForAllScenarios](https://github.com/BillyRuffian/chutney/blob/master/features/same_tag_for_all_scenarios.feature)
64
64
  : You have the same tag for all you scenarios; move the tag to the feature level instead.
65
65
 
66
- ScenarioNamesMatch
66
+ [ScenarioNamesMatch](https://github.com/BillyRuffian/chutney/blob/master/features/scenario_names_match.feature)
67
67
  : Chutney can enforce a naming convention for your scenario names.
68
68
 
69
- TagUsedMultipleTimes
69
+ [TagUsedMultipleTimes](https://github.com/BillyRuffian/chutney/blob/master/features/tag_used_multiple_times.feature)
70
70
  : Chutney can warn if you have used a tag a lot with a feature.
71
71
 
72
- TooClumsy
72
+ [TooClumsy](https://github.com/BillyRuffian/chutney/blob/master/features/too_clumsy.feature)
73
73
  : This is a very long scenario. Consider writing it more concisely.
74
74
 
75
- TooLongStep
75
+ [TooLongStep](https://github.com/BillyRuffian/chutney/blob/master/features/too_long_step.feature)
76
76
  : This is a very long step. Consider writing it more concisely.
77
77
 
78
- TooManyDifferentTags
78
+ [TooManyDifferentTags](https://github.com/BillyRuffian/chutney/blob/master/features/too_many_different_tags.feature)
79
79
  : This feature has a lot of differnt tags.
80
80
 
81
- TooManySteps
81
+ [TooManySteps](https://github.com/BillyRuffian/chutney/blob/master/features/too_many_steps.feature)
82
82
  : This feature has a lot of steps. Consider writing it more concisely.
83
83
 
84
- TooManyTags
84
+ [TooManyTags](https://github.com/BillyRuffian/chutney/blob/master/features/too_many_tags.feature)
85
85
  : There are a lot of tags in this feature.
86
86
 
87
- UniqueScenarioNames
87
+ [UniqueScenarioNames](https://github.com/BillyRuffian/chutney/blob/master/features/unique_scenario_names.feature)
88
88
  : You have duplicated a scenario name when they should be unique.
89
89
 
90
- UnknownVariable
90
+ [UnknownVariable](https://github.com/BillyRuffian/chutney/blob/master/features/unknown_variable.feature)
91
91
  : You are referencing a variable which doesn't appear to be defined. This is a source of subtle errors.
92
92
 
93
- UnusedVariable
93
+ [UnusedVariable](https://github.com/BillyRuffian/chutney/blob/master/features/unused_variable.feature)
94
94
  : You have a variable which you are not using.
95
95
 
96
- UseBackground
96
+ [UseBackground](https://github.com/BillyRuffian/chutney/blob/master/features/use_background.feature)
97
97
  : You have a setup setup used in all of your scenarios. Move it to a Background section.
98
98
 
99
- UseOutline
99
+ [UseOutline](https://github.com/BillyRuffian/chutney/blob/master/features/use_outline.feature)
100
100
  : You have very similar scenarios. You should consider if they should be combined into a Scenario Outline.
@@ -0,0 +1,14 @@
1
+ # language: em
2
+
3
+ 📚: 🤯
4
+
5
+ As a 👹
6
+ I want to 🏃‍♂️ 🥒
7
+ So that 👁 don't 👀 a 🍆
8
+
9
+ 📕:
10
+ 😐 I am a 🐸
11
+ 🎬 I am 😘 by a 👸
12
+ 🎬 I am 😘 by a 👸
13
+ 🙏 I will ⏎ into a 🤴
14
+
@@ -4,6 +4,7 @@ require 'chutney/linter'
4
4
  require 'chutney/linter/avoid_full_stop'
5
5
  require 'chutney/linter/avoid_outline_for_single_example'
6
6
  require 'chutney/linter/avoid_scripting'
7
+ require 'chutney/linter/avoid_typographers_quotes'
7
8
  require 'chutney/linter/background_does_more_than_setup'
8
9
  require 'chutney/linter/background_requires_multiple_scenarios'
9
10
  require 'chutney/linter/bad_scenario_name'
@@ -21,7 +21,7 @@ module Chutney
21
21
  end
22
22
 
23
23
  def print_report(data)
24
- return unless data.empty?
24
+ return if data.empty?
25
25
 
26
26
  print TTY::Pie.new(data: data, radius: 8, legend: { format: '%<label>s %<name>s %<value>i' })
27
27
  puts
@@ -0,0 +1,37 @@
1
+ module Chutney
2
+ # service class to lint for avoid scripting
3
+ class AvoidTypographersQuotes < Linter
4
+ TYPOGRAPHER_QUOTES = ["\u201c", "\u201d", "\u2018", "\u2019"].map(&:encode)
5
+
6
+ def lint
7
+ scenarios do |_feature, scenario|
8
+ lint_steps(scenario[:steps])
9
+
10
+ example_count = scenario[:examples]&.length || 0
11
+ next unless example_count.positive?
12
+
13
+ lint_examples(scenario[:examples])
14
+ end
15
+ end
16
+
17
+ def lint_steps(steps)
18
+ steps.each do |step|
19
+ issue(step) if TYPOGRAPHER_QUOTES.any? { |tq| step[:text].include? tq }
20
+ end
21
+ end
22
+
23
+ def lint_examples(examples)
24
+ examples.each do |example|
25
+ example[:tableBody].each do |body|
26
+ body[:cells].each do |cell|
27
+ issue(cell) if TYPOGRAPHER_QUOTES.any? { |tq| cell[:value].include? tq }
28
+ end
29
+ end
30
+ end
31
+ end
32
+
33
+ def issue(location)
34
+ add_issue(I18n.t('linters.avoid_typographers_quotes'), location)
35
+ end
36
+ end
37
+ end
@@ -1,3 +1,3 @@
1
1
  module Chutney
2
- VERSION = '2.0.0'.freeze
2
+ VERSION = '2.1.0'.freeze
3
3
  end
@@ -11,6 +11,10 @@ en:
11
11
  avoid_scripting: >-
12
12
  You have %{count} When steps when you should only have one.
13
13
  Be careful not to add And steps following a When.
14
+ avoid_typographers_quotes: >-
15
+ You are using typographers quotation marks (curly quotes).
16
+ Make sure you intend to use this character and not a neutral quote
17
+ (straight quote) instead.
14
18
  background_does_more_than_setup: >-
15
19
  The Background does more than setup. It should only contain Given steps.
16
20
  background_requires_multiple_scenarios: >-
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chutney
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nigel Brookes-Thomas
8
8
  - Stefan Rohe
9
9
  - Nishtha Argawal
10
10
  - John Gluck
11
- autorequire:
11
+ autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2020-02-07 00:00:00.000000000 Z
14
+ date: 2020-07-17 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: amatch
@@ -111,6 +111,20 @@ dependencies:
111
111
  - - "~>"
112
112
  - !ruby/object:Gem::Version
113
113
  version: '3.0'
114
+ - !ruby/object:Gem::Dependency
115
+ name: pry-byebug
116
+ requirement: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - "~>"
119
+ - !ruby/object:Gem::Version
120
+ version: '3.0'
121
+ type: :development
122
+ prerelease: false
123
+ version_requirements: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - "~>"
126
+ - !ruby/object:Gem::Version
127
+ version: '3.0'
114
128
  - !ruby/object:Gem::Dependency
115
129
  name: rake
116
130
  requirement: !ruby/object:Gem::Requirement
@@ -159,14 +173,14 @@ dependencies:
159
173
  requirements:
160
174
  - - "~>"
161
175
  - !ruby/object:Gem::Version
162
- version: 0.79.0
176
+ version: 0.85.1
163
177
  type: :development
164
178
  prerelease: false
165
179
  version_requirements: !ruby/object:Gem::Requirement
166
180
  requirements:
167
181
  - - "~>"
168
182
  - !ruby/object:Gem::Version
169
- version: 0.79.0
183
+ version: 0.85.1
170
184
  - !ruby/object:Gem::Dependency
171
185
  name: rspec
172
186
  requirement: !ruby/object:Gem::Requirement
@@ -195,6 +209,7 @@ files:
195
209
  - ".gitignore"
196
210
  - ".rspec"
197
211
  - ".rubocop.yml"
212
+ - ".rufo"
198
213
  - Gemfile
199
214
  - LICENSE.txt
200
215
  - README.md
@@ -206,11 +221,13 @@ files:
206
221
  - docs/credits.md
207
222
  - docs/index.md
208
223
  - docs/installation.md
224
+ - docs/logo.png
209
225
  - docs/usage/configuration.md
210
226
  - docs/usage/index.md
211
227
  - docs/usage/output.md
212
228
  - docs/usage/rules.md
213
229
  - docs/usage/selective_enablement.md
230
+ - examples/emoji.feature
214
231
  - exe/chutney
215
232
  - img/chutney.svg
216
233
  - img/formatters.png
@@ -226,6 +243,7 @@ files:
226
243
  - lib/chutney/linter/avoid_full_stop.rb
227
244
  - lib/chutney/linter/avoid_outline_for_single_example.rb
228
245
  - lib/chutney/linter/avoid_scripting.rb
246
+ - lib/chutney/linter/avoid_typographers_quotes.rb
229
247
  - lib/chutney/linter/background_does_more_than_setup.rb
230
248
  - lib/chutney/linter/background_requires_multiple_scenarios.rb
231
249
  - lib/chutney/linter/bad_scenario_name.rb
@@ -257,14 +275,14 @@ files:
257
275
  - lib/config/locales/en.yml
258
276
  - spec/chutney_spec.rb
259
277
  - spec/spec_helper.rb
260
- homepage: https://billyruffian.github.io/faker_maker/
278
+ homepage: https://billyruffian.github.io/chutney/
261
279
  licenses:
262
280
  - MIT
263
281
  metadata:
264
- homepage_uri: https://billyruffian.github.io/faker_maker/
282
+ homepage_uri: https://billyruffian.github.io/chutney/
265
283
  source_code_uri: https://github.com/BillyRuffian/chutney
266
284
  changelog_uri: https://github.com/BillyRuffian/chutney/releases
267
- post_install_message:
285
+ post_install_message:
268
286
  rdoc_options: []
269
287
  require_paths:
270
288
  - lib
@@ -280,7 +298,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
280
298
  version: '0'
281
299
  requirements: []
282
300
  rubygems_version: 3.1.2
283
- signing_key:
301
+ signing_key:
284
302
  specification_version: 4
285
303
  summary: A linter for English language Gherkin
286
304
  test_files: []