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 +4 -4
 - data/.gitignore +1 -0
 - data/Rakefile +1 -1
 - data/chutney.gemspec +2 -2
 - data/config/chutney_defaults.yml +4 -0
 - data/docs/usage/configuration.md +1 -1
 - data/docs/usage/rules.md +4 -0
 - data/exe/chutney +7 -0
 - data/lib/chutney/linter/avoid_splat_steps_in_background.rb +16 -0
 - data/lib/chutney/linter/avoid_splat_steps_in_scenarios.rb +12 -0
 - data/lib/chutney/version.rb +1 -1
 - data/lib/chutney.rb +2 -0
 - data/lib/config/locales/en.yml +4 -0
 - data/spec/spec_helper.rb +4 -4
 - metadata +8 -6
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 6725cb1d8360b6cf746da8362a04e4e1e1795ee21d70876d39ff08e230ffd0dd
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: ad0cc926afdacbdcd8853866073102f0796f0cd3338b02f5ff5bdc69060c2724
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: a36c2f5da40c1672b77dbbc836a4db6cccf7f445547303aae8e85392ab7b84daba918c8d0343eb73c4683f42c0fce03ebbaf4500a2690878a1fe4fdb5fe0385a
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 5a51f02edf59cee68d71855263cdc7692d6132c8eddeb5f97f8d1e3d0512a08e1533457f6545abf6f737dada8c36f81a83d29d6cea15a8c6f4c198a51a7c5728
         
     | 
    
        data/.gitignore
    CHANGED
    
    
    
        data/Rakefile
    CHANGED
    
    
    
        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. 
     | 
| 
      
 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. 
     | 
| 
      
 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'
         
     | 
    
        data/config/chutney_defaults.yml
    CHANGED
    
    
    
        data/docs/usage/configuration.md
    CHANGED
    
    | 
         @@ -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/ 
     | 
| 
      
 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
         
     | 
    
        data/lib/chutney/version.rb
    CHANGED
    
    
    
        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'
         
     | 
    
        data/lib/config/locales/en.yml
    CHANGED
    
    | 
         @@ -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. 
     | 
| 
      
 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- 
     | 
| 
      
 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. 
     | 
| 
      
 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. 
     | 
| 
      
 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. 
     | 
| 
      
 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. 
     | 
| 
      
 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
         
     |