cucumber_lint 0.0.4 → 0.1.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.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -0
  3. data/Gemfile +2 -1
  4. data/Gemfile.lock +48 -30
  5. data/README.md +41 -24
  6. data/Rakefile +1 -1
  7. data/circle.yml +3 -0
  8. data/config/default.yml +27 -0
  9. data/cucumber_lint.gemspec +4 -4
  10. data/features/cucumber_lint/consistent_empty_lines/between_description_and_scenario.feature +39 -0
  11. data/features/cucumber_lint/consistent_empty_lines/between_elements/ending_with_docstring.feature +47 -0
  12. data/features/cucumber_lint/consistent_empty_lines/between_elements/ending_with_examples.feature +49 -0
  13. data/features/cucumber_lint/consistent_empty_lines/between_elements/ending_with_step.feature +41 -0
  14. data/features/cucumber_lint/consistent_empty_lines/between_elements/ending_with_table.feature +43 -0
  15. data/features/cucumber_lint/consistent_empty_lines/between_feature_and_description.feature +33 -0
  16. data/features/cucumber_lint/consistent_empty_lines/between_feature_and_scenario.feature +33 -0
  17. data/features/cucumber_lint/consistent_table_headers/examples_table.feature +74 -0
  18. data/features/cucumber_lint/consistent_table_headers/step_table.feature +64 -0
  19. data/features/cucumber_lint/consistent_table_headers/unsupported_style.feature +20 -0
  20. data/features/cucumber_lint/consistent_table_whitespace/examples_table.feature +46 -0
  21. data/features/cucumber_lint/consistent_table_whitespace/step_table.feature +42 -0
  22. data/features/cucumber_lint/no_empty_features.feature +20 -0
  23. data/features/cucumber_lint/no_files.feature +6 -0
  24. data/features/cucumber_lint/no_repeating_keywords.feature +44 -0
  25. data/features/cucumber_lint/unsupported_options.feature +11 -0
  26. data/features/step_definitions/cli_steps.rb +47 -10
  27. data/features/step_definitions/env.rb +5 -9
  28. data/features/step_definitions/fixtures/config/disabled.yml +18 -0
  29. data/features/step_definitions/support/file_helpers.rb +20 -0
  30. data/lib/core_ext/array.rb +8 -0
  31. data/lib/core_ext/basic_object.rb +8 -0
  32. data/lib/core_ext/hash.rb +3 -18
  33. data/lib/core_ext/string.rb +7 -0
  34. data/lib/cucumber_lint/cli.rb +60 -31
  35. data/lib/cucumber_lint/config.rb +55 -0
  36. data/lib/cucumber_lint/errors/unsupported_style.rb +10 -0
  37. data/lib/cucumber_lint/linted_file.rb +77 -0
  38. data/lib/cucumber_lint/linter/feature_empty_lines_linter.rb +125 -0
  39. data/lib/cucumber_lint/linter/feature_linter.rb +33 -30
  40. data/lib/cucumber_lint/linter/scenario_outline_linter.rb +17 -8
  41. data/lib/cucumber_lint/linter/steps_linter.rb +9 -8
  42. data/lib/cucumber_lint/linter/table_linter.rb +26 -15
  43. data/lib/cucumber_lint/linter.rb +10 -10
  44. data/lib/cucumber_lint/version.rb +1 -1
  45. data/lib/cucumber_lint.rb +4 -1
  46. metadata +35 -36
  47. data/.travis.yml +0 -9
  48. data/features/cucumber_lint/fix/nothing.feature +0 -12
  49. data/features/cucumber_lint/fix/repeating_steps.feature +0 -25
  50. data/features/cucumber_lint/fix/table_whitespace.feature +0 -25
  51. data/features/cucumber_lint/fix/uppercase_table_headers.feature +0 -25
  52. data/features/cucumber_lint/lint/nothing.feature +0 -12
  53. data/features/cucumber_lint/lint/repeating_steps.feature +0 -31
  54. data/features/cucumber_lint/lint/table_whitespace.feature +0 -27
  55. data/features/cucumber_lint/lint/uppercase_table_headers.feature +0 -30
  56. data/features/step_definitions/feature_formatter_steps.rb +0 -15
  57. data/features/step_definitions/fixtures/repeating_steps/bad.feature.example +0 -12
  58. data/features/step_definitions/fixtures/repeating_steps/good.feature.example +0 -12
  59. data/features/step_definitions/fixtures/table_whitespace/bad.feature.example +0 -20
  60. data/features/step_definitions/fixtures/table_whitespace/good.feature.example +0 -20
  61. data/features/step_definitions/fixtures/uppercase_table_headers/bad.feature.example +0 -20
  62. data/features/step_definitions/fixtures/uppercase_table_headers/good.feature.example +0 -20
  63. data/lib/cucumber_lint/fix_list.rb +0 -37
data/.travis.yml DELETED
@@ -1,9 +0,0 @@
1
- language: ruby
2
-
3
- rvm:
4
- - 2.2.0
5
-
6
- cache: bundler
7
-
8
- script:
9
- - rake
@@ -1,12 +0,0 @@
1
- Feature: fixing
2
-
3
- Scenario: nothing
4
- Given I have no files
5
- When I run `cucumber_lint --fix`
6
- Then I see the output
7
- """
8
-
9
-
10
- 0 files inspected
11
- """
12
- And it exits with status 0
@@ -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,12 +0,0 @@
1
- Feature: linting
2
-
3
- Scenario: nothing
4
- Given I have no files
5
- When I run `cucumber_lint`
6
- Then I see the output
7
- """
8
-
9
-
10
- 0 files inspected
11
- """
12
- 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,12 +0,0 @@
1
- Feature: Test Feature
2
-
3
- Scenario: Test Scenario
4
- Given A
5
- Given B
6
- Given C
7
- When D
8
- When E
9
- When F
10
- Then G
11
- Then H
12
- Then I
@@ -1,12 +0,0 @@
1
- Feature: Test Feature
2
-
3
- Scenario: Test Scenario
4
- Given A
5
- And B
6
- And C
7
- When D
8
- And E
9
- And F
10
- Then G
11
- And H
12
- And I
@@ -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