chutney 3.2.1 → 3.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc456f7ef0c0788108026c08c161d0883fdf046b87d3851901eb3cabf80bbde3
4
- data.tar.gz: fdd038b05c9650b1a785175f633397eb5bb00640ae82d9169f04f43e45c5fa42
3
+ metadata.gz: 6725cb1d8360b6cf746da8362a04e4e1e1795ee21d70876d39ff08e230ffd0dd
4
+ data.tar.gz: ad0cc926afdacbdcd8853866073102f0796f0cd3338b02f5ff5bdc69060c2724
5
5
  SHA512:
6
- metadata.gz: 423221898076fd513aa1dd07eb7778660b89ee615f814dca871b08cc700f1080190f37c72440cba8a4d6524ecc9ac6cb5b656d1983a8eae1e1bfac4a13805a38
7
- data.tar.gz: feea3300f389e31739e184f60e6226ab3586f438da71ccfcfaa9edc355d673059e2a06469ded959c718ef4b6dd7c2f2c14ae9a6e36fa8614839a58e91044b873
6
+ metadata.gz: a36c2f5da40c1672b77dbbc836a4db6cccf7f445547303aae8e85392ab7b84daba918c8d0343eb73c4683f42c0fce03ebbaf4500a2690878a1fe4fdb5fe0385a
7
+ data.tar.gz: 5a51f02edf59cee68d71855263cdc7692d6132c8eddeb5f97f8d1e3d0512a08e1533457f6545abf6f737dada8c36f81a83d29d6cea15a8c6f4c198a51a7c5728
data/.gitignore CHANGED
@@ -10,6 +10,7 @@
10
10
  Gemfile.lock
11
11
  # rspec failure tracking
12
12
  .rspec_status
13
+ .idea/
13
14
 
14
15
  .DS_Store
15
16
 
data/Rakefile CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'rake/testtask'
4
4
 
5
- task default: :build
5
+ task default: :test
6
6
 
7
7
  desc 'Builds the Gem.'
8
8
  task build: :format
data/chutney.gemspec CHANGED
@@ -50,7 +50,7 @@ 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', '>= 1.8.2', '< 1.12.0'
53
+ spec.add_runtime_dependency 'i18n', '>= 1.8.2', '< 1.13.0'
54
54
  spec.add_runtime_dependency 'pastel', '~> 0.7'
55
55
  spec.add_runtime_dependency 'tty-pie', '~> 0.3'
56
56
 
@@ -61,7 +61,7 @@ Gem::Specification.new do |spec|
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.31.2'
64
+ spec.add_development_dependency 'rubocop', '~> 1.32.0'
65
65
  spec.add_development_dependency 'rspec', '~> 3.8'
66
66
 
67
67
  spec.required_ruby_version = '>= 2.6'
@@ -4,6 +4,10 @@ AvoidFullStop:
4
4
  Enabled: true
5
5
  AvoidScripting:
6
6
  Enabled: true
7
+ AvoidSplatStepsInBackground:
8
+ Enabled: true
9
+ AvoidSplatStepsInScenarios:
10
+ Enabled: true
7
11
  AvoidTypographersQuotes:
8
12
  Enabled: true
9
13
  BackgroundDoesMoreThanSetup:
@@ -9,4 +9,4 @@ nav_order: 3
9
9
 
10
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/chutney.yml).
12
+ A default configuration can be found [here](https://github.com/BillyRuffian/chutney/blob/master/config/chutney_defaults.yml).
data/docs/usage/rules.md CHANGED
@@ -15,6 +15,10 @@ Chutney enforces its rules with the linters. These are:
15
15
 
16
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
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
+
18
22
  [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?
19
23
 
20
24
  [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.
data/exe/chutney CHANGED
@@ -10,6 +10,7 @@ require 'optparse'
10
10
 
11
11
  formatters = Set.new
12
12
 
13
+ # rubocop:disable Metrics/BlockLength
13
14
  OptionParser.new do |opts|
14
15
  opts.banner = 'Usage: chutney [files]'
15
16
  opts.on('-f',
@@ -20,6 +21,11 @@ OptionParser.new do |opts|
20
21
  formatters << formatter
21
22
  end
22
23
 
24
+ opts.on('-v', '--version', 'Display the version.') do
25
+ puts Chutney::VERSION
26
+ exit
27
+ end
28
+
23
29
  opts.on('-l',
24
30
  '--linters',
25
31
  'List the linter status by this configuration and exit') do
@@ -38,6 +44,7 @@ OptionParser.new do |opts|
38
44
  exit
39
45
  end
40
46
  end.parse!
47
+ # rubocop:enable Metrics/BlockLength
41
48
 
42
49
  formatters << 'RainbowFormatter' if formatters.empty?
43
50
 
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Chutney
4
+ # service class to lint for avoiding splats
5
+ class AvoidSplatStepsInBackground < Linter
6
+ def lint
7
+ background do |feature, background|
8
+ splat_steps = background&.steps&.select { |s| s.keyword == '*' }
9
+ # add_issue(I18n.t('linters.avoid_full_stop'), feature, child, step) if step.text.strip.end_with? '.'
10
+ if splat_steps && !splat_steps.empty?
11
+ add_issue(I18n.t('linters.avoid_splat_steps_in_background'), feature, background, splat_steps.first)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Chutney
4
+ # service class to lint for avoiding splats
5
+ class AvoidSplatStepsInScenarios < Linter
6
+ def lint
7
+ steps do |feature, child, step|
8
+ add_issue(I18n.t('linters.avoid_splat_steps_in_scenarios'), feature, child, step) if step.keyword == '*'
9
+ end
10
+ end
11
+ end
12
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Chutney
4
- VERSION = '3.2.1'
4
+ VERSION = '3.3.0'
5
5
  end
data/lib/chutney.rb CHANGED
@@ -7,6 +7,8 @@ require 'chutney/linter'
7
7
  require 'chutney/linter/avoid_full_stop'
8
8
  require 'chutney/linter/avoid_outline_for_single_example'
9
9
  require 'chutney/linter/avoid_scripting'
10
+ require 'chutney/linter/avoid_splat_steps_in_background'
11
+ require 'chutney/linter/avoid_splat_steps_in_scenarios'
10
12
  require 'chutney/linter/avoid_typographers_quotes'
11
13
  require 'chutney/linter/background_does_more_than_setup'
12
14
  require 'chutney/linter/background_requires_multiple_scenarios'
@@ -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_splat_steps_in_background: >-
15
+ The Background contains a splat step. It should only contain named steps.
16
+ avoid_splat_steps_in_scenarios: >-
17
+ The Scenario contains a splat step. It should only contain named steps.
14
18
  avoid_typographers_quotes: >-
15
19
  You are using typographers quotation marks (curly quotes).
16
20
  Make sure you intend to use this character and not a neutral quote
data/spec/spec_helper.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'simplecov'
4
- require 'coveralls'
5
- # Coveralls.wear!
6
- SimpleCov.start
3
+ # require 'simplecov'
4
+ # require 'coveralls'
5
+ # # Coveralls.wear!
6
+ # SimpleCov.start
7
7
 
8
8
  # This file was generated by the `rspec --init` command. Conventionally, all
9
9
  # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
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.2.1
4
+ version: 3.3.0
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: 2022-07-12 00:00:00.000000000 Z
14
+ date: 2022-08-26 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: amatch
@@ -50,7 +50,7 @@ dependencies:
50
50
  version: 1.8.2
51
51
  - - "<"
52
52
  - !ruby/object:Gem::Version
53
- version: 1.12.0
53
+ version: 1.13.0
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
@@ -60,7 +60,7 @@ dependencies:
60
60
  version: 1.8.2
61
61
  - - "<"
62
62
  - !ruby/object:Gem::Version
63
- version: 1.12.0
63
+ version: 1.13.0
64
64
  - !ruby/object:Gem::Dependency
65
65
  name: pastel
66
66
  requirement: !ruby/object:Gem::Requirement
@@ -179,14 +179,14 @@ dependencies:
179
179
  requirements:
180
180
  - - "~>"
181
181
  - !ruby/object:Gem::Version
182
- version: 1.31.2
182
+ version: 1.32.0
183
183
  type: :development
184
184
  prerelease: false
185
185
  version_requirements: !ruby/object:Gem::Requirement
186
186
  requirements:
187
187
  - - "~>"
188
188
  - !ruby/object:Gem::Version
189
- version: 1.31.2
189
+ version: 1.32.0
190
190
  - !ruby/object:Gem::Dependency
191
191
  name: rspec
192
192
  requirement: !ruby/object:Gem::Requirement
@@ -253,6 +253,8 @@ files:
253
253
  - lib/chutney/linter/avoid_full_stop.rb
254
254
  - lib/chutney/linter/avoid_outline_for_single_example.rb
255
255
  - lib/chutney/linter/avoid_scripting.rb
256
+ - lib/chutney/linter/avoid_splat_steps_in_background.rb
257
+ - lib/chutney/linter/avoid_splat_steps_in_scenarios.rb
256
258
  - lib/chutney/linter/avoid_typographers_quotes.rb
257
259
  - lib/chutney/linter/background_does_more_than_setup.rb
258
260
  - lib/chutney/linter/background_requires_multiple_scenarios.rb