cuke_linter 1.1.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +26 -1
- data/LICENSE.txt +1 -1
- data/README.md +3 -4
- data/cuke_linter.gemspec +20 -6
- data/exe/cuke_linter +1 -1
- data/lib/cuke_linter/default_linters.rb +1 -1
- data/lib/cuke_linter/linters/background_does_more_than_setup_linter.rb +0 -1
- data/lib/cuke_linter/linters/element_with_common_tags_linter.rb +0 -1
- data/lib/cuke_linter/linters/element_with_duplicate_tags_linter.rb +0 -1
- data/lib/cuke_linter/linters/element_with_too_many_tags_linter.rb +0 -1
- data/lib/cuke_linter/linters/example_without_name_linter.rb +0 -1
- data/lib/cuke_linter/linters/feature_file_with_invalid_name_linter.rb +0 -1
- data/lib/cuke_linter/linters/feature_file_with_mismatched_name_linter.rb +0 -1
- data/lib/cuke_linter/linters/feature_with_too_many_different_tags_linter.rb +0 -1
- data/lib/cuke_linter/linters/feature_without_description_linter.rb +0 -1
- data/lib/cuke_linter/linters/feature_without_name_linter.rb +0 -1
- data/lib/cuke_linter/linters/feature_without_scenarios_linter.rb +6 -3
- data/lib/cuke_linter/linters/linter.rb +0 -1
- data/lib/cuke_linter/linters/outline_with_single_example_row_linter.rb +0 -1
- data/lib/cuke_linter/linters/single_test_background_linter.rb +0 -1
- data/lib/cuke_linter/linters/step_with_end_period_linter.rb +0 -1
- data/lib/cuke_linter/linters/step_with_too_many_characters_linter.rb +0 -1
- data/lib/cuke_linter/linters/test_name_with_too_many_characters_linter.rb +38 -0
- data/lib/cuke_linter/linters/test_should_use_background_linter.rb +2 -2
- data/lib/cuke_linter/linters/test_with_action_step_as_final_step_linter.rb +0 -1
- data/lib/cuke_linter/linters/test_with_bad_name_linter.rb +0 -1
- data/lib/cuke_linter/linters/test_with_no_action_step_linter.rb +0 -1
- data/lib/cuke_linter/linters/test_with_no_name_linter.rb +0 -1
- data/lib/cuke_linter/linters/test_with_no_verification_step_linter.rb +0 -1
- data/lib/cuke_linter/linters/test_with_setup_step_after_action_step_linter.rb +0 -1
- data/lib/cuke_linter/linters/test_with_setup_step_after_verification_step_linter.rb +0 -1
- data/lib/cuke_linter/linters/test_with_setup_step_as_final_step_linter.rb +0 -1
- data/lib/cuke_linter/linters/test_with_too_many_steps_linter.rb +0 -1
- data/lib/cuke_linter/version.rb +1 -1
- data/lib/cuke_linter.rb +1 -3
- data/testing/cucumber/features/command_line.feature +5 -2
- data/testing/cucumber/features/configuration/configuring_linters.feature +5 -2
- data/testing/cucumber/features/configuration/locally_scoping_linters.feature +7 -2
- data/testing/cucumber/features/configuration/using_configurations.feature +2 -1
- data/testing/cucumber/features/custom_linters.feature +3 -1
- data/testing/cucumber/features/linters/feature_without_scenarios.feature +23 -1
- data/testing/cucumber/features/linters/rule_without_name.feature +18 -0
- data/testing/cucumber/features/linters/test_name_too_long.feature +41 -0
- metadata +58 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c131f0cd2c39b7ca961f791d36057e5bb502a58642b81a87f0e5ced67fca7e30
|
4
|
+
data.tar.gz: 131411ade0634a8a03813996cab553303f78d28208d015302089400af07bb6e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d6ed6d47f19beefe74c57865171d6cfc0ccf8770ef648dd7103ff4c4fc183a621dc24fc53cb6d3ab9b6adb1e713b6f871d1c782d2514f1c301dc5590b9d8bb8
|
7
|
+
data.tar.gz: 1b8d2841790e2f48351f01ae3af0c230256ec3b2a020317469b46bd1f7279d055963f6c050f1889e08482f592af9f4fa853b1f82e10eb4fe81254fa8c2faecde
|
data/CHANGELOG.md
CHANGED
@@ -8,6 +8,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
8
8
|
|
9
9
|
Nothing yet...
|
10
10
|
|
11
|
+
## [1.3.0] - 2022-05-23
|
12
|
+
|
13
|
+
### Added
|
14
|
+
- New linters
|
15
|
+
- TestNameWithTooManyCharactersLinter
|
16
|
+
|
17
|
+
- Linters that are impacted by `Rule` elements in Gherkin have been updated, now that Rules models are available
|
18
|
+
in CukeModeler
|
19
|
+
- FeatureWithoutScenariosLinter
|
20
|
+
|
21
|
+
## [1.2.1] - 2021-06-13
|
22
|
+
|
23
|
+
### Fixed
|
24
|
+
- Updated the minimum required Ruby version to `2.1`. The gem has never had `2.0` compatible code (due to using
|
25
|
+
named parameters without default values), so it's easier to just officially drop `2.0` 'support' than to change
|
26
|
+
the API to enable a use case that was never used anyway.
|
27
|
+
|
28
|
+
## [1.2.0] - 2021-01-08
|
29
|
+
|
30
|
+
### Added
|
31
|
+
- Ruby 3.x is now supported
|
32
|
+
|
11
33
|
## [1.1.0] - 2020-06-14
|
12
34
|
|
13
35
|
### Added
|
@@ -164,7 +186,10 @@ Nothing yet...
|
|
164
186
|
- Custom linters, formatters, and command line usability
|
165
187
|
|
166
188
|
|
167
|
-
[Unreleased]: https://github.com/enkessler/cuke_linter/compare/v1.
|
189
|
+
[Unreleased]: https://github.com/enkessler/cuke_linter/compare/v1.3.0...HEAD
|
190
|
+
[1.3.0]: https://github.com/enkessler/cuke_linter/compare/v1.2.1...v1.3.0
|
191
|
+
[1.2.1]: https://github.com/enkessler/cuke_linter/compare/v1.2.0...v1.2.1
|
192
|
+
[1.2.0]: https://github.com/enkessler/cuke_linter/compare/v1.1.0...v1.2.0
|
168
193
|
[1.1.0]: https://github.com/enkessler/cuke_linter/compare/v1.0.1...v1.1.0
|
169
194
|
[1.0.1]: https://github.com/enkessler/cuke_linter/compare/v1.0.0...v1.0.1
|
170
195
|
[1.0.0]: https://github.com/enkessler/cuke_linter/compare/v0.13.0...v1.0.0
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -4,12 +4,11 @@ Basic stuff:
|
|
4
4
|
[![Downloads](https://img.shields.io/gem/dt/cuke_linter.svg)](https://rubygems.org/gems/cuke_linter)
|
5
5
|
|
6
6
|
User stuff:
|
7
|
-
[![Cucumber Docs](http://img.shields.io/badge/Documentation-Features-green.svg)](https://
|
7
|
+
[![Cucumber Docs](http://img.shields.io/badge/Documentation-Features-green.svg)](https://github.com/enkessler/cuke_linter/tree/master/testing/cucumber/features)
|
8
8
|
[![Yard Docs](http://img.shields.io/badge/Documentation-API-blue.svg)](https://www.rubydoc.info/gems/cuke_linter)
|
9
9
|
|
10
10
|
Developer stuff:
|
11
|
-
[![Build Status](https://
|
12
|
-
[![Build Status](https://ci.appveyor.com/api/projects/status/g5o70u747x073evy/branch/master?svg=true)](https://ci.appveyor.com/project/enkessler/cuke-linter/branch/master)
|
11
|
+
[![Build Status](https://github.com/enkessler/cuke_linter/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/enkessler/cuke_linter/actions/workflows/ci.yml)
|
13
12
|
[![Coverage Status](https://coveralls.io/repos/github/enkessler/cuke_linter/badge.svg?branch=master)](https://coveralls.io/github/enkessler/cuke_linter?branch=master)
|
14
13
|
[![Maintainability](https://api.codeclimate.com/v1/badges/d1b86760e59a457c8e73/maintainability)](https://codeclimate.com/github/enkessler/cuke_linter/maintainability)
|
15
14
|
[![Inline docs](http://inch-ci.org/github/enkessler/cuke_linter.svg?branch=master)](https://inch-ci.org/github/enkessler/cuke_linter?branch=master)
|
@@ -149,7 +148,7 @@ Rather than using the default linters or providing a custom set of of modified l
|
|
149
148
|
|
150
149
|
### <a id="documentation"></a>Everything Else
|
151
150
|
|
152
|
-
For more detailed examples of usage, see the documentation [here](https://
|
151
|
+
For more detailed examples of usage, see the documentation [here](https://github.com/enkessler/cuke_linter/tree/master/testing/cucumber/features).
|
153
152
|
|
154
153
|
## Development and Contributing
|
155
154
|
|
data/cuke_linter.gemspec
CHANGED
@@ -9,13 +9,24 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.email = ['morrow748@gmail.com']
|
10
10
|
|
11
11
|
spec.summary = 'Lints feature files used by Cucumber and other similar frameworks.'
|
12
|
+
spec.description = ["This gem provides linters for detecting common 'smells' in `.feature` files. ",
|
13
|
+
'In addition to the provided linters, custom linters can be made in order to ',
|
14
|
+
'create custom linting rules.'].join
|
12
15
|
spec.homepage = 'https://github.com/enkessler/cuke_linter'
|
13
16
|
spec.license = 'MIT'
|
14
17
|
|
18
|
+
spec.metadata = {
|
19
|
+
'bug_tracker_uri' => 'https://github.com/enkessler/cuke_linter/issues',
|
20
|
+
'changelog_uri' => 'https://github.com/enkessler/cuke_linter/blob/master/CHANGELOG.md',
|
21
|
+
'documentation_uri' => 'https://www.rubydoc.info/gems/cuke_linter',
|
22
|
+
'homepage_uri' => 'https://github.com/enkessler/cuke_linter',
|
23
|
+
'source_code_uri' => 'https://github.com/enkessler/cuke_linter'
|
24
|
+
}
|
25
|
+
|
15
26
|
|
16
27
|
# Specify which files should be added to the gem when it is released.
|
17
28
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
18
|
-
spec.files
|
29
|
+
spec.files = Dir.chdir(File.expand_path('', __dir__)) do
|
19
30
|
source_controlled_files = `git ls-files -z`.split("\x0")
|
20
31
|
source_controlled_files.keep_if { |file| file =~ %r{^(lib|exe|testing/cucumber/features)} }
|
21
32
|
source_controlled_files + ['README.md', 'LICENSE.txt', 'CHANGELOG.md', 'cuke_linter.gemspec']
|
@@ -24,13 +35,12 @@ Gem::Specification.new do |spec|
|
|
24
35
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
36
|
spec.require_paths = ['lib']
|
26
37
|
|
27
|
-
spec.required_ruby_version = '
|
38
|
+
spec.required_ruby_version = '>= 2.1', '< 4.0'
|
28
39
|
|
29
40
|
spec.add_runtime_dependency 'cuke_modeler', '>= 1.5', '< 4.0'
|
30
41
|
|
31
42
|
spec.add_development_dependency 'bundler', '< 3.0'
|
32
|
-
spec.add_development_dependency 'childprocess', '
|
33
|
-
spec.add_development_dependency 'coveralls', '< 1.0.0'
|
43
|
+
spec.add_development_dependency 'childprocess', '< 4.0'
|
34
44
|
spec.add_development_dependency 'cucumber', '< 5.0'
|
35
45
|
spec.add_development_dependency 'cuke_slicer', '>= 2.0.2', '< 3.0'
|
36
46
|
spec.add_development_dependency 'ffi', '~> 1.0'
|
@@ -39,6 +49,10 @@ Gem::Specification.new do |spec|
|
|
39
49
|
spec.add_development_dependency 'rake', '~> 12.0'
|
40
50
|
spec.add_development_dependency 'require_all', '~> 2.0'
|
41
51
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
42
|
-
|
43
|
-
|
52
|
+
# RuboCop drops Ruby 2.1 support after this version and we need
|
53
|
+
# to maintain Ruby 2.1 compatibility when writing code for this gem
|
54
|
+
spec.add_development_dependency 'rubocop', '<= 0.57.2'
|
55
|
+
spec.add_development_dependency 'simplecov', '< 1.0'
|
56
|
+
spec.add_development_dependency 'simplecov-lcov', '< 1.0'
|
57
|
+
spec.add_development_dependency 'yard', '< 1.0'
|
44
58
|
end
|
data/exe/cuke_linter
CHANGED
@@ -1,14 +1,17 @@
|
|
1
1
|
module CukeLinter
|
2
2
|
|
3
3
|
# A linter that detects empty features
|
4
|
-
|
5
4
|
class FeatureWithoutScenariosLinter < Linter
|
6
5
|
|
7
6
|
# The rule used to determine if a model has a problem
|
8
|
-
def rule(model)
|
7
|
+
def rule(model) # rubocop:disable Metrics/CyclomaticComplexity # It's good enough
|
9
8
|
return false unless model.is_a?(CukeModeler::Feature)
|
10
9
|
|
11
|
-
model.tests
|
10
|
+
feature_tests = model.tests && model.tests.any?
|
11
|
+
rule_tests = model.respond_to?(:rules) && # Earlier versions of CukeModeler did not have Rule models
|
12
|
+
model.rules && model.rules.any? { |rule| rule.tests && rule.tests.any? }
|
13
|
+
|
14
|
+
!(feature_tests || rule_tests)
|
12
15
|
end
|
13
16
|
|
14
17
|
# The message used to describe the problem that has been found
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module CukeLinter
|
2
|
+
|
3
|
+
# A linter that detects test names that are too long
|
4
|
+
class TestNameWithTooManyCharactersLinter < Linter
|
5
|
+
|
6
|
+
# The threshold used if not otherwise configured
|
7
|
+
DEFAULT_TEST_NAME_LENGTH_THRESHOLD = 80
|
8
|
+
|
9
|
+
# Changes the linting settings on the linter using the provided configuration
|
10
|
+
def configure(options)
|
11
|
+
@test_name_length_threshold = options['TestNameLengthThreshold'] if options['TestNameLengthThreshold']
|
12
|
+
end
|
13
|
+
|
14
|
+
# The rule used to determine if a model has a problem
|
15
|
+
def rule(model)
|
16
|
+
return false unless model.is_a?(CukeModeler::Scenario) || model.is_a?(CukeModeler::Outline)
|
17
|
+
|
18
|
+
@linted_test_name_length = model.name.nil? ? 0 : model.name.length
|
19
|
+
|
20
|
+
@linted_test_name_length > test_name_length_threshold
|
21
|
+
end
|
22
|
+
|
23
|
+
# The message used to describe the problem that has been found
|
24
|
+
def message
|
25
|
+
"Scenario name is too long. #{@linted_test_name_length} characters found (max #{test_name_length_threshold})"
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
|
32
|
+
# The maximum length allowable of a scenario name
|
33
|
+
def test_name_length_threshold
|
34
|
+
@test_name_length_threshold || DEFAULT_TEST_NAME_LENGTH_THRESHOLD
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
@@ -1,8 +1,8 @@
|
|
1
|
+
# TODO: Make a new class that it is from the POV of a Feature model instead
|
2
|
+
|
1
3
|
module CukeLinter
|
2
4
|
|
3
|
-
# TODO: Make a new class that it is from the POV of a Feature model instead
|
4
5
|
# A linter that detects scenarios and outlines within a feature that all share common beginning steps
|
5
|
-
|
6
6
|
class TestShouldUseBackgroundLinter < Linter
|
7
7
|
|
8
8
|
# The rule used to determine if a model has a problem
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module CukeLinter
|
2
2
|
|
3
3
|
# A linter that detects scenarios and outlines that have a setup step that comes after a verification step
|
4
|
-
|
5
4
|
class TestWithSetupStepAfterVerificationStepLinter < Linter
|
6
5
|
|
7
6
|
# Changes the linting settings on the linter using the provided configuration
|
data/lib/cuke_linter/version.rb
CHANGED
data/lib/cuke_linter.rb
CHANGED
@@ -19,6 +19,7 @@ require 'cuke_linter/linters/outline_with_single_example_row_linter'
|
|
19
19
|
require 'cuke_linter/linters/single_test_background_linter'
|
20
20
|
require 'cuke_linter/linters/step_with_end_period_linter'
|
21
21
|
require 'cuke_linter/linters/step_with_too_many_characters_linter'
|
22
|
+
require 'cuke_linter/linters/test_name_with_too_many_characters_linter'
|
22
23
|
require 'cuke_linter/linters/test_should_use_background_linter'
|
23
24
|
require 'cuke_linter/linters/test_with_action_step_as_final_step_linter'
|
24
25
|
require 'cuke_linter/linters/test_with_bad_name_linter'
|
@@ -164,9 +165,6 @@ module CukeLinter
|
|
164
165
|
def dynamic_linters
|
165
166
|
# No need to keep making new ones over and over...
|
166
167
|
@dynamic_linters ||= Hash.new { |hash, key| hash[key] = key.new }
|
167
|
-
# return @dynamic_linters if @dynamic_linters
|
168
|
-
#
|
169
|
-
# @dynamic_linters = {}
|
170
168
|
end
|
171
169
|
|
172
170
|
def format_data(formatters, linting_data)
|
@@ -101,7 +101,8 @@ Feature: Using cuke_linter on the command line
|
|
101
101
|
|
102
102
|
Scenario: Specifying a formatter to use
|
103
103
|
|
104
|
-
Note: The file containing the formatter class will have to be explicitly loaded if not using one
|
104
|
+
Note: The file containing the formatter class will have to be explicitly loaded if not using one
|
105
|
+
of the built in formatters
|
105
106
|
|
106
107
|
Given the following feature file "some.feature":
|
107
108
|
"""
|
@@ -134,7 +135,9 @@ Feature: Using cuke_linter on the command line
|
|
134
135
|
|
135
136
|
Scenario: Redirecting output for specific formatters
|
136
137
|
|
137
|
-
Note: Formatters match to output locations in the same order that they are specified. Formatters
|
138
|
+
Note: Formatters match to output locations in the same order that they are specified. Formatters
|
139
|
+
that do not have their output location specified will output to STDOUT. Output locations
|
140
|
+
that are not matched to a formatter will use the default formatter.
|
138
141
|
|
139
142
|
Given the following feature file "some.feature":
|
140
143
|
"""
|
@@ -1,6 +1,8 @@
|
|
1
1
|
Feature: Configuration of linters
|
2
2
|
|
3
|
-
Instead of having to modify the linting object directly in a script at runtime, a configuration file can
|
3
|
+
Instead of having to modify the linting object directly in a script at runtime, a configuration file can
|
4
|
+
be used so that specific linters can be configured in a more convenient, static manner. Some configurable
|
5
|
+
properties are available across all linters while some are linter specific.
|
4
6
|
|
5
7
|
|
6
8
|
Scenario: Disabling a linter
|
@@ -20,7 +22,8 @@ Feature: Configuration of linters
|
|
20
22
|
|
21
23
|
Scenario: Setting a common configuration for all linters
|
22
24
|
|
23
|
-
Note: Any property could be set for all linters, but disabling them (and then re-enabling a select few) is
|
25
|
+
Note: Any property could be set for all linters, but disabling them (and then re-enabling a select few) is
|
26
|
+
one of the few things that you are likely to want to do to all linters.
|
24
27
|
|
25
28
|
Given a linter registered as "AlwaysFindsAProblem"
|
26
29
|
And the following configuration file:
|
@@ -4,12 +4,17 @@ Feature: Locally scoping linters
|
|
4
4
|
I want to be able to limit the scope of linters for certain portions of the documentation
|
5
5
|
So that exceptions to rules can be made
|
6
6
|
|
7
|
-
In addition to using configurations to change whether or not a given linter is used when linting, linters
|
7
|
+
In addition to using configurations to change whether or not a given linter is used when linting, linters
|
8
|
+
can be enabled/disabled for specific portions of a `.feature` file. To enable/disable one (or more) linters,
|
9
|
+
add a comment line before the portion of the file where the change should apply. Add a comment with the
|
10
|
+
opposite change at the point in the file when the default behavior should resume. Unless so countermanded,
|
11
|
+
changes remain in effect for the remainder of the feature file.
|
8
12
|
|
9
13
|
|
10
14
|
Scenario: Enabling/disabling a linter within a feature file
|
11
15
|
|
12
|
-
Note: This example disables linters that are enabled by default but enabling a linter that is disabled by
|
16
|
+
Note: This example disables linters that are enabled by default but enabling a linter that is disabled by
|
17
|
+
default works in the same manner
|
13
18
|
|
14
19
|
Given the default linters are being used
|
15
20
|
And a feature file model based on the following text:
|
@@ -1,6 +1,7 @@
|
|
1
1
|
Feature: Using a configuration
|
2
2
|
|
3
|
-
Configuration can be done during a script or through a configuration file. This file can be explicitly
|
3
|
+
Configuration can be done during a script or through a configuration file. This file can be explicitly
|
4
|
+
provided or a default configuration file will be used.
|
4
5
|
|
5
6
|
|
6
7
|
Scenario: Providing a configuration directly
|
@@ -1,6 +1,8 @@
|
|
1
1
|
Feature: Custom linters
|
2
2
|
|
3
|
-
In addition to the linters provided by CukeLinter, custom linters can be used. A linter is
|
3
|
+
In addition to the linters provided by CukeLinter, custom linters can be used. A linter is
|
4
|
+
essentially any object that provides a few needed methods. In order to simplify the creation
|
5
|
+
of custom linters, a base linter class is available that provides these needed methods.
|
4
6
|
|
5
7
|
|
6
8
|
Scenario: Creating a custom linter object
|
@@ -5,7 +5,7 @@ Feature: Feature without scenarios linter
|
|
5
5
|
So that I do not have incomplete documentation
|
6
6
|
|
7
7
|
|
8
|
-
Scenario: Linting
|
8
|
+
Scenario: Linting (Bad)
|
9
9
|
Given a linter for features without scenarios
|
10
10
|
And the following feature:
|
11
11
|
"""
|
@@ -15,3 +15,25 @@ Feature: Feature without scenarios linter
|
|
15
15
|
Then an error is reported:
|
16
16
|
| linter | problem | location |
|
17
17
|
| FeatureWithoutScenariosLinter | Feature has no scenarios | <path_to_file>:1 |
|
18
|
+
|
19
|
+
Scenario: Linting (Good)
|
20
|
+
Given a linter for features without scenarios
|
21
|
+
And the following feature:
|
22
|
+
"""
|
23
|
+
Feature:
|
24
|
+
Scenario:
|
25
|
+
"""
|
26
|
+
When it is linted
|
27
|
+
Then no error is reported
|
28
|
+
|
29
|
+
@cuke_modeler_min_version_3
|
30
|
+
Scenario: Linting (Good, with Rules)
|
31
|
+
Given a linter for features without scenarios
|
32
|
+
And the following feature:
|
33
|
+
"""
|
34
|
+
Feature:
|
35
|
+
Rule:
|
36
|
+
Scenario:
|
37
|
+
"""
|
38
|
+
When it is linted
|
39
|
+
Then no error is reported
|
@@ -0,0 +1,18 @@
|
|
1
|
+
Feature: Feature without name linter
|
2
|
+
|
3
|
+
As a reader of documentation
|
4
|
+
I want every feature to have a name
|
5
|
+
So that I can get an idea of what the feature is about without having to read every use case
|
6
|
+
|
7
|
+
|
8
|
+
Scenario: Linting
|
9
|
+
Given a linter for features without a name
|
10
|
+
And the following feature:
|
11
|
+
"""
|
12
|
+
Feature:
|
13
|
+
This feature does not have a name
|
14
|
+
"""
|
15
|
+
When it is linted
|
16
|
+
Then an error is reported:
|
17
|
+
| linter | problem | location |
|
18
|
+
| FeatureWithoutNameLinter | Feature does not have a name. | <path_to_file>:1 |
|
@@ -0,0 +1,41 @@
|
|
1
|
+
Feature: Scenario name with too many characters
|
2
|
+
|
3
|
+
As a reader of documentation
|
4
|
+
I want test names not to be unduly long
|
5
|
+
So that I can easily understand its purpose
|
6
|
+
|
7
|
+
|
8
|
+
Scenario: Linter
|
9
|
+
|
10
|
+
Given a linter for test names with too many characters
|
11
|
+
And the following feature:
|
12
|
+
"""
|
13
|
+
Feature:
|
14
|
+
|
15
|
+
Scenario: tea exists and teapots exist and so do cups and saucers and there might be milk in the milk jug together with sugar cubes
|
16
|
+
"""
|
17
|
+
When it is linted
|
18
|
+
Then an error is reported:
|
19
|
+
| linter | problem | location |
|
20
|
+
| TestNameWithTooManyCharactersLinter | Scenario name is too long. 121 characters found (max 80) | <path_to_file>:3 |
|
21
|
+
|
22
|
+
|
23
|
+
Scenario: Configuration of test name count threshold
|
24
|
+
|
25
|
+
Given a linter for test names with too many characters has been registered
|
26
|
+
And the following configuration file:
|
27
|
+
"""
|
28
|
+
TestNameWithTooManyCharactersLinter:
|
29
|
+
TestNameLengthThreshold: 30
|
30
|
+
"""
|
31
|
+
And the following feature:
|
32
|
+
"""
|
33
|
+
Feature:
|
34
|
+
|
35
|
+
Scenario: This scenario name is way too long so it would be better to shorten it somehow, please do so
|
36
|
+
"""
|
37
|
+
When the configuration file is loaded
|
38
|
+
And the feature is linted
|
39
|
+
Then an error is reported:
|
40
|
+
| linter | problem | location |
|
41
|
+
| TestNameWithTooManyCharactersLinter | Scenario name is too long. 92 characters found (max 30) | <path_to_file>:3 |
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cuke_linter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Kessler
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cuke_modeler
|
@@ -46,32 +46,18 @@ dependencies:
|
|
46
46
|
version: '3.0'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: childprocess
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
-
requirements:
|
51
|
-
- - "~>"
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '3.0'
|
54
|
-
type: :development
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
requirements:
|
58
|
-
- - "~>"
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: '3.0'
|
61
|
-
- !ruby/object:Gem::Dependency
|
62
|
-
name: coveralls
|
63
49
|
requirement: !ruby/object:Gem::Requirement
|
64
50
|
requirements:
|
65
51
|
- - "<"
|
66
52
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
53
|
+
version: '4.0'
|
68
54
|
type: :development
|
69
55
|
prerelease: false
|
70
56
|
version_requirements: !ruby/object:Gem::Requirement
|
71
57
|
requirements:
|
72
58
|
- - "<"
|
73
59
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
60
|
+
version: '4.0'
|
75
61
|
- !ruby/object:Gem::Dependency
|
76
62
|
name: cucumber
|
77
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -192,33 +178,63 @@ dependencies:
|
|
192
178
|
version: '3.0'
|
193
179
|
- !ruby/object:Gem::Dependency
|
194
180
|
name: rubocop
|
181
|
+
requirement: !ruby/object:Gem::Requirement
|
182
|
+
requirements:
|
183
|
+
- - "<="
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: 0.57.2
|
186
|
+
type: :development
|
187
|
+
prerelease: false
|
188
|
+
version_requirements: !ruby/object:Gem::Requirement
|
189
|
+
requirements:
|
190
|
+
- - "<="
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: 0.57.2
|
193
|
+
- !ruby/object:Gem::Dependency
|
194
|
+
name: simplecov
|
195
195
|
requirement: !ruby/object:Gem::Requirement
|
196
196
|
requirements:
|
197
197
|
- - "<"
|
198
198
|
- !ruby/object:Gem::Version
|
199
|
-
version: 1.0
|
199
|
+
version: '1.0'
|
200
200
|
type: :development
|
201
201
|
prerelease: false
|
202
202
|
version_requirements: !ruby/object:Gem::Requirement
|
203
203
|
requirements:
|
204
204
|
- - "<"
|
205
205
|
- !ruby/object:Gem::Version
|
206
|
-
version: 1.0
|
206
|
+
version: '1.0'
|
207
207
|
- !ruby/object:Gem::Dependency
|
208
|
-
name: simplecov
|
208
|
+
name: simplecov-lcov
|
209
|
+
requirement: !ruby/object:Gem::Requirement
|
210
|
+
requirements:
|
211
|
+
- - "<"
|
212
|
+
- !ruby/object:Gem::Version
|
213
|
+
version: '1.0'
|
214
|
+
type: :development
|
215
|
+
prerelease: false
|
216
|
+
version_requirements: !ruby/object:Gem::Requirement
|
217
|
+
requirements:
|
218
|
+
- - "<"
|
219
|
+
- !ruby/object:Gem::Version
|
220
|
+
version: '1.0'
|
221
|
+
- !ruby/object:Gem::Dependency
|
222
|
+
name: yard
|
209
223
|
requirement: !ruby/object:Gem::Requirement
|
210
224
|
requirements:
|
211
225
|
- - "<"
|
212
226
|
- !ruby/object:Gem::Version
|
213
|
-
version: 1.0
|
227
|
+
version: '1.0'
|
214
228
|
type: :development
|
215
229
|
prerelease: false
|
216
230
|
version_requirements: !ruby/object:Gem::Requirement
|
217
231
|
requirements:
|
218
232
|
- - "<"
|
219
233
|
- !ruby/object:Gem::Version
|
220
|
-
version: 1.0
|
221
|
-
description:
|
234
|
+
version: '1.0'
|
235
|
+
description: This gem provides linters for detecting common 'smells' in `.feature`
|
236
|
+
files. In addition to the provided linters, custom linters can be made in order
|
237
|
+
to create custom linting rules.
|
222
238
|
email:
|
223
239
|
- morrow748@gmail.com
|
224
240
|
executables:
|
@@ -253,6 +269,7 @@ files:
|
|
253
269
|
- lib/cuke_linter/linters/single_test_background_linter.rb
|
254
270
|
- lib/cuke_linter/linters/step_with_end_period_linter.rb
|
255
271
|
- lib/cuke_linter/linters/step_with_too_many_characters_linter.rb
|
272
|
+
- lib/cuke_linter/linters/test_name_with_too_many_characters_linter.rb
|
256
273
|
- lib/cuke_linter/linters/test_should_use_background_linter.rb
|
257
274
|
- lib/cuke_linter/linters/test_with_action_step_as_final_step_linter.rb
|
258
275
|
- lib/cuke_linter/linters/test_with_bad_name_linter.rb
|
@@ -283,9 +300,11 @@ files:
|
|
283
300
|
- testing/cucumber/features/linters/feature_without_name.feature
|
284
301
|
- testing/cucumber/features/linters/feature_without_scenarios.feature
|
285
302
|
- testing/cucumber/features/linters/outline_with_single_example_row.feature
|
303
|
+
- testing/cucumber/features/linters/rule_without_name.feature
|
286
304
|
- testing/cucumber/features/linters/single_test_background.feature
|
287
305
|
- testing/cucumber/features/linters/step_too_long.feature
|
288
306
|
- testing/cucumber/features/linters/step_with_end_period.feature
|
307
|
+
- testing/cucumber/features/linters/test_name_too_long.feature
|
289
308
|
- testing/cucumber/features/linters/test_should_use_background.feature
|
290
309
|
- testing/cucumber/features/linters/test_with_action_as_final_step.feature
|
291
310
|
- testing/cucumber/features/linters/test_with_bad_name.feature
|
@@ -299,25 +318,32 @@ files:
|
|
299
318
|
homepage: https://github.com/enkessler/cuke_linter
|
300
319
|
licenses:
|
301
320
|
- MIT
|
302
|
-
metadata:
|
303
|
-
|
321
|
+
metadata:
|
322
|
+
bug_tracker_uri: https://github.com/enkessler/cuke_linter/issues
|
323
|
+
changelog_uri: https://github.com/enkessler/cuke_linter/blob/master/CHANGELOG.md
|
324
|
+
documentation_uri: https://www.rubydoc.info/gems/cuke_linter
|
325
|
+
homepage_uri: https://github.com/enkessler/cuke_linter
|
326
|
+
source_code_uri: https://github.com/enkessler/cuke_linter
|
327
|
+
post_install_message:
|
304
328
|
rdoc_options: []
|
305
329
|
require_paths:
|
306
330
|
- lib
|
307
331
|
required_ruby_version: !ruby/object:Gem::Requirement
|
308
332
|
requirements:
|
309
|
-
- - "
|
333
|
+
- - ">="
|
334
|
+
- !ruby/object:Gem::Version
|
335
|
+
version: '2.1'
|
336
|
+
- - "<"
|
310
337
|
- !ruby/object:Gem::Version
|
311
|
-
version: '
|
338
|
+
version: '4.0'
|
312
339
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
313
340
|
requirements:
|
314
341
|
- - ">="
|
315
342
|
- !ruby/object:Gem::Version
|
316
343
|
version: '0'
|
317
344
|
requirements: []
|
318
|
-
|
319
|
-
|
320
|
-
signing_key:
|
345
|
+
rubygems_version: 3.2.3
|
346
|
+
signing_key:
|
321
347
|
specification_version: 4
|
322
348
|
summary: Lints feature files used by Cucumber and other similar frameworks.
|
323
349
|
test_files: []
|