cucumber_lint 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +0 -4
- data/.travis.yml +9 -0
- data/Gemfile +7 -5
- data/Gemfile.lock +3 -1
- data/README.md +28 -40
- data/Rakefile +12 -6
- data/cucumber_lint.gemspec +2 -0
- data/features/cucumber_lint/fix/nothing.feature +12 -0
- data/features/cucumber_lint/fix/repeating_steps.feature +25 -0
- data/features/cucumber_lint/fix/table_whitespace.feature +25 -0
- data/features/cucumber_lint/fix/uppercase_table_headers.feature +25 -0
- data/features/cucumber_lint/lint/nothing.feature +12 -0
- data/features/cucumber_lint/lint/repeating_steps.feature +31 -0
- data/features/cucumber_lint/lint/table_whitespace.feature +27 -0
- data/features/cucumber_lint/lint/uppercase_table_headers.feature +30 -0
- data/features/step_definitions/cli_steps.rb +9 -6
- data/features/step_definitions/fixtures/repeating_steps/bad.feature.example +12 -0
- data/features/step_definitions/fixtures/repeating_steps/good.feature.example +12 -0
- data/features/step_definitions/fixtures/table_whitespace/bad.feature.example +20 -0
- data/features/step_definitions/fixtures/table_whitespace/good.feature.example +20 -0
- data/features/step_definitions/fixtures/uppercase_table_headers/bad.feature.example +20 -0
- data/features/step_definitions/fixtures/uppercase_table_headers/good.feature.example +20 -0
- data/lib/core_ext/hash.rb +29 -0
- data/lib/cucumber_lint/cli.rb +50 -38
- data/lib/cucumber_lint/fix_list.rb +37 -0
- data/lib/cucumber_lint/linter/feature_linter.rb +92 -0
- data/lib/cucumber_lint/linter/scenario_outline_linter.rb +34 -0
- data/lib/cucumber_lint/linter/steps_linter.rb +49 -0
- data/lib/cucumber_lint/linter/table_linter.rb +70 -0
- data/lib/cucumber_lint/linter.rb +21 -0
- data/lib/cucumber_lint/version.rb +2 -2
- data/lib/cucumber_lint.rb +7 -4
- metadata +64 -16
- data/features/cucumber_lint/cli_fix.feature +0 -51
- data/features/cucumber_lint/cli_lint.feature +0 -55
- data/features/cucumber_lint/feature_formatter.feature +0 -106
- data/features/cucumber_lint/steps_formatter.feature +0 -30
- data/features/cucumber_lint/table_formatter.feature +0 -45
- data/features/step_definitions/fixtures/formatted.feature.example +0 -9
- data/features/step_definitions/fixtures/unformatted.feature.example +0 -9
- data/features/step_definitions/steps_formatter_steps.rb +0 -15
- data/features/step_definitions/table_formatter_steps.rb +0 -15
- data/lib/core_ext/array.rb +0 -22
- data/lib/cucumber_lint/feature_formatter.rb +0 -48
- data/lib/cucumber_lint/steps_formatter.rb +0 -50
- data/lib/cucumber_lint/table_formatter.rb +0 -65
- data/spec/core_ext/array_spec.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59f628a63c86ef172e490dc170991ddef1985a98
|
4
|
+
data.tar.gz: e2d61829e08b5a7401c2956a10835600f9ea9721
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f447e200f24df005c46b2a9902e40372e9f1e0b2b17d5f34a88fa1ac51b6f87383412f8023a9bcdc553193321b34c801c62c04b8187c8251fc174f701d8da52e
|
7
|
+
data.tar.gz: 8a7e79e55b286855daff422796482af173d987a2fe84c29b7d0b570aecf692414cbe5238bf0a576a93892f1548688a6826a17a65b0c2379e6f79cab927597742
|
data/.rubocop.yml
CHANGED
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,8 @@
|
|
1
1
|
# cucumber_lint
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/cucumber_lint.svg)](http://badge.fury.io/rb/cucumber_lint)
|
3
|
+
[![Build Status](https://travis-ci.org/charlierudolph/cucumber_lint.svg)](https://travis-ci.org/charlierudolph/cucumber_lint)
|
4
|
+
[![Dependency Status](https://gemnasium.com/charlierudolph/cucumber_lint.svg)](https://gemnasium.com/charlierudolph/cucumber_lint)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/charlierudolph/cucumber_lint/badges/gpa.svg)](https://codeclimate.com/github/charlierudolph/cucumber_lint)
|
2
6
|
|
3
7
|
A command line linter and formatter for cucumber features
|
4
8
|
|
@@ -15,48 +19,32 @@ cucumber_lint # Lints (exits with status 1 on failure, 0 on success)
|
|
15
19
|
cucumber_lint --fix # Fixes all lint errors
|
16
20
|
```
|
17
21
|
|
18
|
-
###
|
19
|
-
* requires at a space leading and trailing cell content
|
20
|
-
* requires pipes to be aligned
|
21
|
-
|
22
|
-
Bad
|
23
|
-
````
|
24
|
-
|header_column1|header_column2|
|
25
|
-
|row1_column1|row1_column2|
|
26
|
-
|row2_column1|row2_column2|
|
27
|
-
|row3_column1|row3_column2|
|
28
|
-
```
|
29
|
-
Bad
|
30
|
-
```
|
31
|
-
| header_column1 | header_column2 |
|
32
|
-
| row1_column1 | row1_column2 |
|
33
|
-
| row2_column1 | row2_column2 |
|
34
|
-
| row3_column1 | row3_column2 |
|
35
|
-
```
|
36
|
-
Good
|
37
|
-
```
|
38
|
-
| header_column1 | header_column2 |
|
39
|
-
| row1_column1 | row1_column2 |
|
40
|
-
| row2_column1 | row2_column2 |
|
41
|
-
| row3_column1 | row3_column2 |
|
42
|
-
```
|
22
|
+
### Features
|
43
23
|
|
44
|
-
|
24
|
+
#### Repeating step keywords
|
45
25
|
* Use `And` instead of repeating `Given`, `When`, or `Then`
|
46
26
|
|
47
|
-
|
27
|
+
```coffee
|
28
|
+
# Bad # Good
|
29
|
+
Given A Given A
|
30
|
+
Given B And B
|
31
|
+
When C When C
|
32
|
+
Then D Then D
|
33
|
+
Then E And E
|
48
34
|
```
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
And E
|
35
|
+
|
36
|
+
#### Table whitespace
|
37
|
+
* requires leading and trailing space around the cell content
|
38
|
+
* requires pipes to be aligned
|
39
|
+
|
40
|
+
|
41
|
+
```coffee
|
42
|
+
# Bad # Bad # Good
|
43
|
+
|VEGETABLE|CODENAME| | VEGETABLE | CODENAME | | VEGETABLE | CODENAME |
|
44
|
+
|Asparagus|Alpha| |Asparagus | Alpha | | Asparagus | Alpha |
|
45
|
+
|Broccoli|Bravo| |Broccoli | Bravo | | Broccoli | Bravo |
|
46
|
+
|Carrot|Charlie| | Carrot| Charlie | | Carrot | Charlie |
|
62
47
|
```
|
48
|
+
|
49
|
+
#### Table headers and scenario outline placeholders
|
50
|
+
* required to be uppercase
|
data/Rakefile
CHANGED
@@ -1,17 +1,23 @@
|
|
1
1
|
desc 'Run all linters and specs'
|
2
|
-
task default: %w(lint
|
2
|
+
task default: %w(lint features)
|
3
3
|
|
4
4
|
|
5
|
-
desc 'Run linters'
|
6
|
-
task :lint
|
5
|
+
desc 'Run all linters and specs'
|
6
|
+
task lint: %w(lint:ruby lint:cucumber)
|
7
|
+
|
8
|
+
|
9
|
+
desc 'Run ruby linters'
|
10
|
+
task 'lint:ruby' do
|
7
11
|
sh 'bundle exec rubocop'
|
8
12
|
end
|
9
13
|
|
10
|
-
|
11
|
-
|
12
|
-
|
14
|
+
|
15
|
+
desc 'Run cucumber linters'
|
16
|
+
task 'lint:cucumber' do
|
17
|
+
sh 'bundle exec cucumber_lint'
|
13
18
|
end
|
14
19
|
|
20
|
+
|
15
21
|
desc 'Run features'
|
16
22
|
task :features do
|
17
23
|
sh 'bundle exec cucumber'
|
data/cucumber_lint.gemspec
CHANGED
@@ -13,6 +13,8 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.license = 'MIT'
|
14
14
|
|
15
15
|
spec.add_runtime_dependency 'colorize', '~> 0.7.5'
|
16
|
+
spec.add_runtime_dependency 'gherkin', '~> 2.12.2', '>= 2.12.2'
|
17
|
+
spec.add_runtime_dependency 'multi_json', '~> 1.10.1', '>= 1.10.1'
|
16
18
|
|
17
19
|
spec.files = `git ls-files`.split("\n")
|
18
20
|
spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
|
@@ -0,0 +1,25 @@
|
|
1
|
+
Feature: fixing
|
2
|
+
|
3
|
+
Scenario: a feature with unformatted repeating steps
|
4
|
+
Given I have a feature with unformatted repeating steps
|
5
|
+
When I run `cucumber_lint --fix`
|
6
|
+
Then I see the output
|
7
|
+
"""
|
8
|
+
W
|
9
|
+
|
10
|
+
1 file inspected (0 passed, 1 written)
|
11
|
+
"""
|
12
|
+
And it exits with status 0
|
13
|
+
And I now have a feature with formatted repeating steps
|
14
|
+
|
15
|
+
|
16
|
+
Scenario: a feature with formatted repeating steps
|
17
|
+
Given I have a feature with formatted repeating steps
|
18
|
+
When I run `cucumber_lint --fix`
|
19
|
+
Then I see the output
|
20
|
+
"""
|
21
|
+
.
|
22
|
+
|
23
|
+
1 file inspected (1 passed)
|
24
|
+
"""
|
25
|
+
And it exits with status 0
|
@@ -0,0 +1,25 @@
|
|
1
|
+
Feature: fixing
|
2
|
+
|
3
|
+
Scenario: a feature with unformatted table whitespace
|
4
|
+
Given I have a feature with unformatted table whitespace
|
5
|
+
When I run `cucumber_lint --fix`
|
6
|
+
Then I see the output
|
7
|
+
"""
|
8
|
+
W
|
9
|
+
|
10
|
+
1 file inspected (0 passed, 1 written)
|
11
|
+
"""
|
12
|
+
And it exits with status 0
|
13
|
+
And I now have a feature with formatted table whitespace
|
14
|
+
|
15
|
+
|
16
|
+
Scenario: a feature with formatted table whitespace
|
17
|
+
Given I have a feature with formatted table whitespace
|
18
|
+
When I run `cucumber_lint --fix`
|
19
|
+
Then I see the output
|
20
|
+
"""
|
21
|
+
.
|
22
|
+
|
23
|
+
1 file inspected (1 passed)
|
24
|
+
"""
|
25
|
+
And it exits with status 0
|
@@ -0,0 +1,25 @@
|
|
1
|
+
Feature: fixing
|
2
|
+
|
3
|
+
Scenario: a feature with unformatted uppercase table headers
|
4
|
+
Given I have a feature with unformatted uppercase table headers
|
5
|
+
When I run `cucumber_lint --fix`
|
6
|
+
Then I see the output
|
7
|
+
"""
|
8
|
+
W
|
9
|
+
|
10
|
+
1 file inspected (0 passed, 1 written)
|
11
|
+
"""
|
12
|
+
And it exits with status 0
|
13
|
+
And I now have a feature with formatted uppercase table headers
|
14
|
+
|
15
|
+
|
16
|
+
Scenario: a feature with formatted uppercase table headers
|
17
|
+
Given I have a feature with formatted uppercase table headers
|
18
|
+
When I run `cucumber_lint --fix`
|
19
|
+
Then I see the output
|
20
|
+
"""
|
21
|
+
.
|
22
|
+
|
23
|
+
1 file inspected (1 passed)
|
24
|
+
"""
|
25
|
+
And it exits with status 0
|
@@ -0,0 +1,31 @@
|
|
1
|
+
Feature: linting
|
2
|
+
|
3
|
+
Scenario: a feature with unformatted repeating steps
|
4
|
+
Given I have a feature with unformatted repeating steps
|
5
|
+
When I run `cucumber_lint`
|
6
|
+
Then I see the output
|
7
|
+
"""
|
8
|
+
F
|
9
|
+
|
10
|
+
./features/repeating_steps.feature:5: Use "And" instead of repeating "Given"
|
11
|
+
./features/repeating_steps.feature:6: Use "And" instead of repeating "Given"
|
12
|
+
./features/repeating_steps.feature:8: Use "And" instead of repeating "When"
|
13
|
+
./features/repeating_steps.feature:9: Use "And" instead of repeating "When"
|
14
|
+
./features/repeating_steps.feature:11: Use "And" instead of repeating "Then"
|
15
|
+
./features/repeating_steps.feature:12: Use "And" instead of repeating "Then"
|
16
|
+
|
17
|
+
1 file inspected (0 passed, 1 failed)
|
18
|
+
"""
|
19
|
+
And it exits with status 1
|
20
|
+
|
21
|
+
|
22
|
+
Scenario: a feature with formatted repeating steps
|
23
|
+
Given I have a feature with formatted repeating steps
|
24
|
+
When I run `cucumber_lint`
|
25
|
+
Then I see the output
|
26
|
+
"""
|
27
|
+
.
|
28
|
+
|
29
|
+
1 file inspected (1 passed)
|
30
|
+
"""
|
31
|
+
And it exits with status 0
|
@@ -0,0 +1,27 @@
|
|
1
|
+
Feature: linting
|
2
|
+
|
3
|
+
Scenario: a feature with unformatted table whitespace
|
4
|
+
Given I have a feature with unformatted table whitespace
|
5
|
+
When I run `cucumber_lint`
|
6
|
+
Then I see the output
|
7
|
+
"""
|
8
|
+
F
|
9
|
+
|
10
|
+
./features/table_whitespace.feature:5: Fix table whitespace
|
11
|
+
./features/table_whitespace.feature:17: Fix table whitespace
|
12
|
+
|
13
|
+
1 file inspected (0 passed, 1 failed)
|
14
|
+
"""
|
15
|
+
And it exits with status 1
|
16
|
+
|
17
|
+
|
18
|
+
Scenario: a feature with formatted table whitespace
|
19
|
+
Given I have a feature with formatted table whitespace
|
20
|
+
When I run `cucumber_lint`
|
21
|
+
Then I see the output
|
22
|
+
"""
|
23
|
+
.
|
24
|
+
|
25
|
+
1 file inspected (1 passed)
|
26
|
+
"""
|
27
|
+
And it exits with status 0
|
@@ -0,0 +1,30 @@
|
|
1
|
+
Feature: fixing
|
2
|
+
|
3
|
+
Scenario: a feature with unformatted uppercase table headers
|
4
|
+
Given I have a feature with unformatted uppercase table headers
|
5
|
+
When I run `cucumber_lint`
|
6
|
+
Then I see the output
|
7
|
+
"""
|
8
|
+
F
|
9
|
+
|
10
|
+
./features/uppercase_table_headers.feature:5: Make table headers uppercase
|
11
|
+
./features/uppercase_table_headers.feature:13: Make "<vegetable>" uppercase
|
12
|
+
./features/uppercase_table_headers.feature:13: Make "<fruit>" uppercase
|
13
|
+
./features/uppercase_table_headers.feature:14: Make "<codename>" uppercase
|
14
|
+
./features/uppercase_table_headers.feature:17: Make table headers uppercase
|
15
|
+
|
16
|
+
1 file inspected (0 passed, 1 failed)
|
17
|
+
"""
|
18
|
+
And it exits with status 1
|
19
|
+
|
20
|
+
|
21
|
+
Scenario: a feature with formatted uppercase table headers
|
22
|
+
Given I have a feature with formatted uppercase table headers
|
23
|
+
When I run `cucumber_lint`
|
24
|
+
Then I see the output
|
25
|
+
"""
|
26
|
+
.
|
27
|
+
|
28
|
+
1 file inspected (1 passed)
|
29
|
+
"""
|
30
|
+
And it exits with status 0
|
@@ -3,9 +3,11 @@ Given(/^I have no files$/) do
|
|
3
3
|
end
|
4
4
|
|
5
5
|
|
6
|
-
Given(/^I have
|
7
|
-
|
8
|
-
|
6
|
+
Given(/^I have a feature with (unformatted|formatted) (.+?)$/) do |format, type|
|
7
|
+
feature_name = format == 'formatted' ? 'good' : 'bad'
|
8
|
+
feature_type = type.gsub(' ', '_')
|
9
|
+
content = IO.read("#{FIXTURES_PATH}/#{feature_type}/#{feature_name}.feature.example")
|
10
|
+
IO.write "#{TMP_DIR}/features/#{feature_type}.feature", content
|
9
11
|
end
|
10
12
|
|
11
13
|
|
@@ -24,8 +26,9 @@ Then(/^it exits with status (\d+)$/) do |status|
|
|
24
26
|
end
|
25
27
|
|
26
28
|
|
27
|
-
Then(/^
|
28
|
-
|
29
|
-
|
29
|
+
Then(/^I now have a feature with formatted (.+?)$/) do |type|
|
30
|
+
feature_type = type.gsub(' ', '_')
|
31
|
+
expected = IO.read("#{FIXTURES_PATH}/#{feature_type}/good.feature.example")
|
32
|
+
actual = IO.read "#{TMP_DIR}/features/#{feature_type}.feature"
|
30
33
|
expect(actual).to eql expected
|
31
34
|
end
|