cucumber_lint 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 94c51a359d3dfd56d9e66c83eea181c6df770d78
4
- data.tar.gz: 980e0c5a5cd2be86a3a2eec67e7cffe34749e2e6
3
+ metadata.gz: 14c5f7a327e02199b8c85472fa18939f9e2b1e13
4
+ data.tar.gz: 0729a48fa5bf275c74de17815e39c05b76129160
5
5
  SHA512:
6
- metadata.gz: d64ab9a0d90ed805b7951b567aefa33bd1c29adcb736a9527716cf494e2f313b828118441e011fc629e8c32fe3e28d432b8d876e9d1b74fbe82ea0ff62173e93
7
- data.tar.gz: 42b46b733869d0405a6de236fd5522c095f9d4f664123b49f83d81f121e1f10ee040d98f03b96f046380626e5f815e17e219c5a6b96a696ae4354430cd7bd10c
6
+ metadata.gz: 51b6e6b7d97f8d5f80b08b39bdf7c1a74fd03a8e3050bcdaf43736fe77628cf655ae3c6e4b6a22a90c0193000a0de081a48bf9f142a99117b0307384fc158f87
7
+ data.tar.gz: 41382370be1888ce0d6cb4e3dea6a21672dc9d8e671bcf6e4c18332a5e12ad3f7109bc15fa9623f42f04e58216afc40f8bd30d233e0fcfc18b65a950c8ba2022
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cucumber_lint (0.1.0)
4
+ cucumber_lint (0.1.2)
5
5
  colorize (~> 0.7.7)
6
6
  gherkin (~> 2.12.2)
7
7
  multi_json (~> 1.11.2)
@@ -4,6 +4,7 @@ Feature: consistent_empty_lines between description and element
4
4
  Given I have a feature with content
5
5
  """
6
6
  Feature: Test Feature
7
+
7
8
  As a user
8
9
  When I have this
9
10
  I expect that
@@ -21,35 +22,11 @@ Feature: consistent_empty_lines between description and element
21
22
  Given I have "consistent_empty_lines" enabled with
22
23
  | KEY | VALUE |
23
24
  | between_description_and_element | 1 |
24
- When I run `cucumber_lint`
25
- Then it fails with
26
- | LINE | MESSAGE |
27
- | 5 | Add empty line |
28
- When I run `cucumber_lint --fix`
29
- Then my feature now has content
30
- """
31
- Feature: Test Feature
32
- As a user
33
- When I have this
34
- I expect that
35
-
36
- Scenario: Test Scenario
37
- Given this
38
- Then that
39
- """
40
- When I run `cucumber_lint`
41
- Then it passes
42
-
43
- Scenario: lint and fix (with non-zero between feature and description)
44
- Given I have "consistent_empty_lines" enabled with
45
- | KEY | VALUE |
46
- | between_description_and_element | 2 |
47
25
  | between_feature_and_description | 1 |
48
26
  When I run `cucumber_lint`
49
27
  Then it fails with
50
- | LINE | MESSAGE |
51
- | 2 | Add empty line |
52
- | 5 | Add 2 empty lines |
28
+ | LINE | MESSAGE |
29
+ | 6 | Add empty line |
53
30
  When I run `cucumber_lint --fix`
54
31
  Then my feature now has content
55
32
  """
@@ -59,7 +36,6 @@ Feature: consistent_empty_lines between description and element
59
36
  When I have this
60
37
  I expect that
61
38
 
62
-
63
39
  Scenario: Test Scenario
64
40
  Given this
65
41
  Then that
@@ -0,0 +1,44 @@
1
+ Feature: consistent_empty_lines between description and element
2
+
3
+ Background:
4
+ Given I have a feature with content
5
+ """
6
+ Feature: Test Feature
7
+ As a user
8
+ When I have this
9
+ I expect that
10
+ @tag
11
+ Scenario: Test Scenario
12
+ Given this
13
+ Then that
14
+ """
15
+
16
+ Scenario: disabled
17
+ Given I have "consistent_empty_lines" disabled
18
+ When I run `cucumber_lint`
19
+ Then it passes
20
+
21
+ Scenario: lint and fix
22
+ Given I have "consistent_empty_lines" enabled with
23
+ | KEY | VALUE |
24
+ | between_description_and_element | 1 |
25
+ | between_feature_and_description | 0 |
26
+ When I run `cucumber_lint`
27
+ Then it fails with
28
+ | LINE | MESSAGE |
29
+ | 5 | Add empty line |
30
+ When I run `cucumber_lint --fix`
31
+ Then my feature now has content
32
+ """
33
+ Feature: Test Feature
34
+ As a user
35
+ When I have this
36
+ I expect that
37
+
38
+ @tag
39
+ Scenario: Test Scenario
40
+ Given this
41
+ Then that
42
+ """
43
+ When I run `cucumber_lint`
44
+ Then it passes
@@ -1,13 +1,15 @@
1
- Feature: consistent_empty_lines between feature and description
1
+ Feature: consistent_empty_lines between description and element
2
2
 
3
3
  Background:
4
4
  Given I have a feature with content
5
5
  """
6
6
  Feature: Test Feature
7
-
8
7
  As a user
9
8
  When I have this
10
9
  I expect that
10
+ Scenario: Test Scenario
11
+ Given this
12
+ Then that
11
13
  """
12
14
 
13
15
  Scenario: disabled
@@ -17,12 +19,13 @@ Feature: consistent_empty_lines between feature and description
17
19
 
18
20
  Scenario: lint and fix
19
21
  Given I have "consistent_empty_lines" enabled with
20
- | KEY | VALUE |
21
- | feature_and_description | 1 |
22
+ | KEY | VALUE |
23
+ | between_description_and_element | 1 |
24
+ | between_feature_and_description | 0 |
22
25
  When I run `cucumber_lint`
23
26
  Then it fails with
24
- | LINE | MESSAGE |
25
- | 2 | Remove empty line |
27
+ | LINE | MESSAGE |
28
+ | 5 | Add empty line |
26
29
  When I run `cucumber_lint --fix`
27
30
  Then my feature now has content
28
31
  """
@@ -30,6 +33,10 @@ Feature: consistent_empty_lines between feature and description
30
33
  As a user
31
34
  When I have this
32
35
  I expect that
36
+
37
+ Scenario: Test Scenario
38
+ Given this
39
+ Then that
33
40
  """
34
41
  When I run `cucumber_lint`
35
42
  Then it passes
@@ -0,0 +1,45 @@
1
+ Feature: consistent_empty_lines between elements (with tag)
2
+
3
+ Background:
4
+ Given I have a feature with content
5
+ """
6
+ Feature: Test Feature
7
+
8
+ Scenario: Test Scenario
9
+ Given this
10
+ Then that
11
+ @tag
12
+ Scenario: Test Scenario
13
+ Given this
14
+ Then that
15
+ """
16
+
17
+ Scenario: disabled
18
+ Given I have "consistent_empty_lines" disabled
19
+ When I run `cucumber_lint`
20
+ Then it passes
21
+
22
+ Scenario: lint and fix
23
+ Given I have "consistent_empty_lines" enabled with
24
+ | KEY | VALUE |
25
+ | between_elements | 1 |
26
+ When I run `cucumber_lint`
27
+ Then it fails with
28
+ | LINE | MESSAGE |
29
+ | 6 | Add empty line |
30
+ When I run `cucumber_lint --fix`
31
+ Then my feature now has content
32
+ """
33
+ Feature: Test Feature
34
+
35
+ Scenario: Test Scenario
36
+ Given this
37
+ Then that
38
+
39
+ @tag
40
+ Scenario: Test Scenario
41
+ Given this
42
+ Then that
43
+ """
44
+ When I run `cucumber_lint`
45
+ Then it passes
@@ -0,0 +1,37 @@
1
+ Feature: consistent_empty_lines between feature and element
2
+
3
+ Background:
4
+ Given I have a feature with content
5
+ """
6
+ Feature: Test Feature
7
+ @tag
8
+ Scenario: Test Scenario
9
+ Given this
10
+ Then that
11
+ """
12
+
13
+ Scenario: disabled
14
+ Given I have "consistent_empty_lines" disabled
15
+ When I run `cucumber_lint`
16
+ Then it passes
17
+
18
+ Scenario: lint and fix
19
+ Given I have "consistent_empty_lines" enabled with
20
+ | KEY | VALUE |
21
+ | between_feature_and_element | 1 |
22
+ When I run `cucumber_lint`
23
+ Then it fails with
24
+ | LINE | MESSAGE |
25
+ | 2 | Add empty line |
26
+ When I run `cucumber_lint --fix`
27
+ Then my feature now has content
28
+ """
29
+ Feature: Test Feature
30
+
31
+ @tag
32
+ Scenario: Test Scenario
33
+ Given this
34
+ Then that
35
+ """
36
+ When I run `cucumber_lint`
37
+ Then it passes
@@ -2,6 +2,7 @@ require 'active_support/core_ext/hash/deep_merge.rb'
2
2
  require 'cucumber_lint'
3
3
  require 'open4'
4
4
  require 'rspec'
5
+ require 'tmpdir'
5
6
 
6
7
 
7
8
  BIN_PATH = "#{File.dirname(__FILE__)}/../../bin"
@@ -1,4 +1,5 @@
1
1
  require 'colorize'
2
+ require 'pathname'
2
3
  require 'ostruct'
3
4
 
4
5
  module CucumberLint
@@ -1,3 +1,5 @@
1
+ require 'pathname'
2
+
1
3
  module CucumberLint
2
4
  # A class that represents a file being linted
3
5
  class LintedFile
@@ -33,6 +33,15 @@ module CucumberLint
33
33
  end
34
34
 
35
35
 
36
+ def element_start element
37
+ if element.tags
38
+ element.tags[0].line
39
+ else
40
+ element.line
41
+ end
42
+ end
43
+
44
+
36
45
  def expected_first_element_start
37
46
  spacing = if @description == ''
38
47
  config_value(:between_feature_and_element)
@@ -72,7 +81,7 @@ module CucumberLint
72
81
 
73
82
  expected_element_start = expected_first_element_start
74
83
  @feature.elements.each do |element|
75
- resolve_empty_line_difference element.line, expected_element_start
84
+ resolve_empty_line_difference element_start(element), expected_element_start
76
85
  lint_scenario_outline_and_examples element if element.type == 'scenario_outline'
77
86
  expected_element_start = element_end(element) + config_value(:between_elements) + 1
78
87
  end
@@ -4,6 +4,7 @@ require 'core_ext/hash'
4
4
  require 'gherkin/formatter/json_formatter'
5
5
  require 'gherkin/parser/parser'
6
6
  require 'multi_json'
7
+ require 'stringio'
7
8
 
8
9
  module CucumberLint
9
10
  # A linter for a given feature (represented by a filename)
@@ -1,5 +1,6 @@
1
1
  require 'core_ext/string'
2
2
  require 'gherkin/formatter/pretty_formatter'
3
+ require 'stringio'
3
4
 
4
5
  module CucumberLint
5
6
  # A linter for a series of table rows (as parsed by Gherkin)
@@ -1,3 +1,3 @@
1
1
  module CucumberLint # rubocop:disable Style/Documentation
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber_lint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - charlierudolph
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-31 00:00:00.000000000 Z
11
+ date: 2015-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -73,13 +73,16 @@ files:
73
73
  - config/default.yml
74
74
  - cucumber.yml
75
75
  - cucumber_lint.gemspec
76
- - features/cucumber_lint/consistent_empty_lines/between_description_and_element.feature
76
+ - features/cucumber_lint/consistent_empty_lines/between_description_and_element/non_zero_between_feature_and_description.feature
77
+ - features/cucumber_lint/consistent_empty_lines/between_description_and_element/with_tag.feature
78
+ - features/cucumber_lint/consistent_empty_lines/between_description_and_element/zero_between_feature_and_description.feature
77
79
  - features/cucumber_lint/consistent_empty_lines/between_elements/ending_with_docstring.feature
78
80
  - features/cucumber_lint/consistent_empty_lines/between_elements/ending_with_examples.feature
79
81
  - features/cucumber_lint/consistent_empty_lines/between_elements/ending_with_step.feature
80
82
  - features/cucumber_lint/consistent_empty_lines/between_elements/ending_with_table.feature
81
- - features/cucumber_lint/consistent_empty_lines/between_feature_and_description.feature
82
- - features/cucumber_lint/consistent_empty_lines/between_feature_and_element.feature
83
+ - features/cucumber_lint/consistent_empty_lines/between_elements/with_tag.feature
84
+ - features/cucumber_lint/consistent_empty_lines/between_feature_and_element/basic.feature
85
+ - features/cucumber_lint/consistent_empty_lines/between_feature_and_element/with_tag.feature
83
86
  - features/cucumber_lint/consistent_table_headers/examples_table.feature
84
87
  - features/cucumber_lint/consistent_table_headers/step_table.feature
85
88
  - features/cucumber_lint/consistent_table_headers/unsupported_style.feature
@@ -130,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
133
  version: '0'
131
134
  requirements: []
132
135
  rubyforge_project:
133
- rubygems_version: 2.4.8
136
+ rubygems_version: 2.4.5
134
137
  signing_key:
135
138
  specification_version: 4
136
139
  summary: A command line interface for linting and formatting cucumber features