cucumber_lint 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/Gemfile +2 -1
- data/Gemfile.lock +48 -30
- data/README.md +41 -24
- data/Rakefile +1 -1
- data/circle.yml +3 -0
- data/config/default.yml +27 -0
- data/cucumber_lint.gemspec +4 -4
- data/features/cucumber_lint/consistent_empty_lines/between_description_and_scenario.feature +39 -0
- data/features/cucumber_lint/consistent_empty_lines/between_elements/ending_with_docstring.feature +47 -0
- data/features/cucumber_lint/consistent_empty_lines/between_elements/ending_with_examples.feature +49 -0
- data/features/cucumber_lint/consistent_empty_lines/between_elements/ending_with_step.feature +41 -0
- data/features/cucumber_lint/consistent_empty_lines/between_elements/ending_with_table.feature +43 -0
- data/features/cucumber_lint/consistent_empty_lines/between_feature_and_description.feature +33 -0
- data/features/cucumber_lint/consistent_empty_lines/between_feature_and_scenario.feature +33 -0
- data/features/cucumber_lint/consistent_table_headers/examples_table.feature +74 -0
- data/features/cucumber_lint/consistent_table_headers/step_table.feature +64 -0
- data/features/cucumber_lint/consistent_table_headers/unsupported_style.feature +20 -0
- data/features/cucumber_lint/consistent_table_whitespace/examples_table.feature +46 -0
- data/features/cucumber_lint/consistent_table_whitespace/step_table.feature +42 -0
- data/features/cucumber_lint/no_empty_features.feature +20 -0
- data/features/cucumber_lint/no_files.feature +6 -0
- data/features/cucumber_lint/no_repeating_keywords.feature +44 -0
- data/features/cucumber_lint/unsupported_options.feature +11 -0
- data/features/step_definitions/cli_steps.rb +47 -10
- data/features/step_definitions/env.rb +5 -9
- data/features/step_definitions/fixtures/config/disabled.yml +18 -0
- data/features/step_definitions/support/file_helpers.rb +20 -0
- data/lib/core_ext/array.rb +8 -0
- data/lib/core_ext/basic_object.rb +8 -0
- data/lib/core_ext/hash.rb +3 -18
- data/lib/core_ext/string.rb +7 -0
- data/lib/cucumber_lint/cli.rb +60 -31
- data/lib/cucumber_lint/config.rb +55 -0
- data/lib/cucumber_lint/errors/unsupported_style.rb +10 -0
- data/lib/cucumber_lint/linted_file.rb +77 -0
- data/lib/cucumber_lint/linter/feature_empty_lines_linter.rb +125 -0
- data/lib/cucumber_lint/linter/feature_linter.rb +33 -30
- data/lib/cucumber_lint/linter/scenario_outline_linter.rb +17 -8
- data/lib/cucumber_lint/linter/steps_linter.rb +9 -8
- data/lib/cucumber_lint/linter/table_linter.rb +26 -15
- data/lib/cucumber_lint/linter.rb +10 -10
- data/lib/cucumber_lint/version.rb +1 -1
- data/lib/cucumber_lint.rb +4 -1
- metadata +35 -36
- data/.travis.yml +0 -9
- data/features/cucumber_lint/fix/nothing.feature +0 -12
- data/features/cucumber_lint/fix/repeating_steps.feature +0 -25
- data/features/cucumber_lint/fix/table_whitespace.feature +0 -25
- data/features/cucumber_lint/fix/uppercase_table_headers.feature +0 -25
- data/features/cucumber_lint/lint/nothing.feature +0 -12
- data/features/cucumber_lint/lint/repeating_steps.feature +0 -31
- data/features/cucumber_lint/lint/table_whitespace.feature +0 -27
- data/features/cucumber_lint/lint/uppercase_table_headers.feature +0 -30
- data/features/step_definitions/feature_formatter_steps.rb +0 -15
- data/features/step_definitions/fixtures/repeating_steps/bad.feature.example +0 -12
- data/features/step_definitions/fixtures/repeating_steps/good.feature.example +0 -12
- data/features/step_definitions/fixtures/table_whitespace/bad.feature.example +0 -20
- data/features/step_definitions/fixtures/table_whitespace/good.feature.example +0 -20
- data/features/step_definitions/fixtures/uppercase_table_headers/bad.feature.example +0 -20
- data/features/step_definitions/fixtures/uppercase_table_headers/good.feature.example +0 -20
- data/lib/cucumber_lint/fix_list.rb +0 -37
data/.travis.yml
DELETED
@@ -1,25 +0,0 @@
|
|
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
|
@@ -1,25 +0,0 @@
|
|
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
|
@@ -1,25 +0,0 @@
|
|
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
|
@@ -1,31 +0,0 @@
|
|
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
|
@@ -1,27 +0,0 @@
|
|
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
|
@@ -1,30 +0,0 @@
|
|
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
|
@@ -1,15 +0,0 @@
|
|
1
|
-
Given(/^feature content$/) do |content|
|
2
|
-
@content = content
|
3
|
-
end
|
4
|
-
|
5
|
-
|
6
|
-
Then(/^the formatted feature content is$/) do |content|
|
7
|
-
expected = content
|
8
|
-
actual = CucumberLint::FeatureFormatter.new(@content).formatted_content
|
9
|
-
expect(actual).to eql expected
|
10
|
-
end
|
11
|
-
|
12
|
-
|
13
|
-
Then(/^the feature is formatted$/) do
|
14
|
-
expect(CucumberLint::FeatureFormatter.new(@content)).to be_formatted
|
15
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
Feature: Test Feature
|
2
|
-
|
3
|
-
Scenario: Test Scenario
|
4
|
-
Given a table
|
5
|
-
|VEGETABLE|CODENAME|
|
6
|
-
|Asparagus|Alpha|
|
7
|
-
|Broccoli|Bravo|
|
8
|
-
|Carrot|Charlie|
|
9
|
-
Then my tests pass
|
10
|
-
|
11
|
-
|
12
|
-
Scenario Outline: Test Scenario Outline
|
13
|
-
Given <VEGETABLE> and <FRUIT>
|
14
|
-
Then I expect <CODENAME>
|
15
|
-
|
16
|
-
Examples:
|
17
|
-
|VEGETABLE| FRUIT | CODENAME |
|
18
|
-
|Asparagus | Apple | Alpha |
|
19
|
-
|Broccoli | Banana | Bravo |
|
20
|
-
| Carrot| Cherry | Charlie |
|
@@ -1,20 +0,0 @@
|
|
1
|
-
Feature: Test Feature
|
2
|
-
|
3
|
-
Scenario: Test Scenario
|
4
|
-
Given a table
|
5
|
-
| VEGETABLE | CODENAME |
|
6
|
-
| Asparagus | Alpha |
|
7
|
-
| Broccoli | Bravo |
|
8
|
-
| Carrot | Charlie |
|
9
|
-
Then my tests pass
|
10
|
-
|
11
|
-
|
12
|
-
Scenario Outline: Test Scenario Outline
|
13
|
-
Given <VEGETABLE> and <FRUIT>
|
14
|
-
Then I expect <CODENAME>
|
15
|
-
|
16
|
-
Examples:
|
17
|
-
| VEGETABLE | FRUIT | CODENAME |
|
18
|
-
| Asparagus | Apple | Alpha |
|
19
|
-
| Broccoli | Banana | Bravo |
|
20
|
-
| Carrot | Cherry | Charlie |
|
@@ -1,20 +0,0 @@
|
|
1
|
-
Feature: Test Feature
|
2
|
-
|
3
|
-
Scenario: Test Scenario
|
4
|
-
Given a table
|
5
|
-
| vegetable | codename |
|
6
|
-
| Asparagus | Alpha |
|
7
|
-
| Broccoli | Bravo |
|
8
|
-
| Carrot | Charlie |
|
9
|
-
Then my tests pass
|
10
|
-
|
11
|
-
|
12
|
-
Scenario Outline: Test Scenario Outline
|
13
|
-
Given <vegetable> and <fruit>
|
14
|
-
Then I expect <codename>
|
15
|
-
|
16
|
-
Examples:
|
17
|
-
| vegetable | fruit | codename |
|
18
|
-
| Asparagus | Apple | Alpha |
|
19
|
-
| Broccoli | Banana | Bravo |
|
20
|
-
| Carrot | Cherry | Charlie |
|
@@ -1,20 +0,0 @@
|
|
1
|
-
Feature: Test Feature
|
2
|
-
|
3
|
-
Scenario: Test Scenario
|
4
|
-
Given a table
|
5
|
-
| VEGETABLE | CODENAME |
|
6
|
-
| Asparagus | Alpha |
|
7
|
-
| Broccoli | Bravo |
|
8
|
-
| Carrot | Charlie |
|
9
|
-
Then my tests pass
|
10
|
-
|
11
|
-
|
12
|
-
Scenario Outline: Test Scenario Outline
|
13
|
-
Given <VEGETABLE> and <FRUIT>
|
14
|
-
Then I expect <CODENAME>
|
15
|
-
|
16
|
-
Examples:
|
17
|
-
| VEGETABLE | FRUIT | CODENAME |
|
18
|
-
| Asparagus | Apple | Alpha |
|
19
|
-
| Broccoli | Banana | Bravo |
|
20
|
-
| Carrot | Cherry | Charlie |
|
@@ -1,37 +0,0 @@
|
|
1
|
-
module CucumberLint
|
2
|
-
# A class that represents a list of fixes to apply to a feature
|
3
|
-
class FixList
|
4
|
-
|
5
|
-
attr_reader :list
|
6
|
-
|
7
|
-
|
8
|
-
def initialize
|
9
|
-
@list = {}
|
10
|
-
end
|
11
|
-
|
12
|
-
|
13
|
-
def add line_number, fix
|
14
|
-
@list[line_number] ||= []
|
15
|
-
@list[line_number] += Array(fix)
|
16
|
-
end
|
17
|
-
|
18
|
-
|
19
|
-
def apply lines
|
20
|
-
lines.each_with_index.map do |line, index|
|
21
|
-
line_number = index + 1
|
22
|
-
|
23
|
-
@list.fetch(line_number, []).each do |fix|
|
24
|
-
line = fix.call(line)
|
25
|
-
end
|
26
|
-
|
27
|
-
line
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
|
32
|
-
def empty?
|
33
|
-
@list.empty?
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
37
|
-
end
|