cuke_linter 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,8 +15,8 @@ module CukeLinter
15
15
  # The rule used to determine if a model has a problem
16
16
  def rule(model)
17
17
  return false unless model.is_a?(CukeModeler::Step)
18
-
19
- @linted_step_length = model.text&.length || 0
18
+
19
+ @linted_step_length = model.text.nil? ? 0 : model.text.length
20
20
 
21
21
  @linted_step_length > step_length_threshold
22
22
  end
@@ -14,40 +14,48 @@ module CukeLinter
14
14
 
15
15
  return false unless parent_feature_model.tests.count > 1
16
16
 
17
- matching_steps = parent_feature_model.tests.all? do |test|
17
+ matching_steps = all_first_steps_match?(parent_feature_model, model_steps)
18
+ none_parameterized = no_parameterized_steps?(parent_feature_model)
19
+
20
+ matching_steps && none_parameterized
21
+ end
22
+
23
+ # The message used to describe the problem that has been found
24
+ def message
25
+ 'Test shares steps with all other tests in feature. Use a background.'
26
+ end
27
+
28
+
29
+ private
30
+
31
+
32
+ def all_first_steps_match?(feature_model, model_steps)
33
+ feature_model.tests.all? do |test|
18
34
  test_steps = test.steps || []
19
35
  test_steps.first == model_steps.first
20
36
  end
37
+ end
21
38
 
22
- none_parameterized = parent_feature_model.tests.none? do |test|
39
+ def no_parameterized_steps?(feature_model)
40
+ feature_model.tests.none? do |test|
23
41
  next false if test.is_a?(CukeModeler::Scenario)
24
42
 
25
43
  test_steps = test.steps || []
26
44
  params_used_by_test = test.examples.map(&:parameters).flatten.uniq
27
45
 
28
46
  next false unless test_steps.any?
47
+
29
48
  parameterized_step?(test_steps.first, parameters: params_used_by_test)
30
49
  end
31
-
32
- matching_steps && none_parameterized
33
50
  end
34
51
 
35
- # The message used to describe the problem that has been found
36
- def message
37
- 'Test shares steps with all other tests in feature. Use a background.'
38
- end
39
-
40
-
41
- private
42
-
43
-
44
52
  def parameterized_step?(step_model, parameters:)
45
53
  parameters.any? do |parameter|
46
54
  parameter_string = "<#{parameter}>"
47
55
 
48
56
  parameterized_text?(step_model, parameter_string) ||
49
- parameterized_doc_string?(step_model, parameter_string) ||
50
- parameterized_table?(step_model, parameter_string)
57
+ parameterized_doc_string?(step_model, parameter_string) ||
58
+ parameterized_table?(step_model, parameter_string)
51
59
  end
52
60
  end
53
61
 
@@ -9,10 +9,10 @@ module CukeLinter
9
9
  return false unless model.is_a?(CukeModeler::Scenario) || model.is_a?(CukeModeler::Outline)
10
10
 
11
11
  lowercase_name = model.name.downcase
12
- return true if lowercase_name.include?('test') ||
13
- lowercase_name.include?('verif') ||
14
- lowercase_name.include?('check')
15
- false
12
+
13
+ lowercase_name.include?('test') ||
14
+ lowercase_name.include?('verif') ||
15
+ lowercase_name.include?('check')
16
16
  end
17
17
 
18
18
  # The message used to describe the problem that has been found
@@ -27,7 +27,7 @@ module CukeLinter
27
27
  private
28
28
 
29
29
  def given_keywords
30
- @given_keywords || [DEFAULT_GIVEN_KEYWORD]
30
+ @given_keywords || [DEFAULT_GIVEN_KEYWORD]
31
31
  end
32
32
 
33
33
  end
@@ -1,4 +1,4 @@
1
1
  module CukeLinter
2
2
  # The release version of this gem
3
- VERSION = '1.0.0'
3
+ VERSION = '1.0.1'.freeze
4
4
  end
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.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Kessler
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-09 00:00:00.000000000 Z
11
+ date: 2020-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cuke_modeler
@@ -44,6 +44,34 @@ dependencies:
44
44
  - - "<"
45
45
  - !ruby/object:Gem::Version
46
46
  version: '3.0'
47
+ - !ruby/object:Gem::Dependency
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
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "<"
66
+ - !ruby/object:Gem::Version
67
+ version: 1.0.0
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "<"
73
+ - !ruby/object:Gem::Version
74
+ version: 1.0.0
47
75
  - !ruby/object:Gem::Dependency
48
76
  name: cucumber
49
77
  requirement: !ruby/object:Gem::Requirement
@@ -59,7 +87,27 @@ dependencies:
59
87
  - !ruby/object:Gem::Version
60
88
  version: '3.0'
61
89
  - !ruby/object:Gem::Dependency
62
- name: racatt
90
+ name: cuke_slicer
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: 2.0.2
96
+ - - "<"
97
+ - !ruby/object:Gem::Version
98
+ version: '3.0'
99
+ type: :development
100
+ prerelease: false
101
+ version_requirements: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: 2.0.2
106
+ - - "<"
107
+ - !ruby/object:Gem::Version
108
+ version: '3.0'
109
+ - !ruby/object:Gem::Dependency
110
+ name: ffi
63
111
  requirement: !ruby/object:Gem::Requirement
64
112
  requirements:
65
113
  - - "~>"
@@ -72,6 +120,34 @@ dependencies:
72
120
  - - "~>"
73
121
  - !ruby/object:Gem::Version
74
122
  version: '1.0'
123
+ - !ruby/object:Gem::Dependency
124
+ name: parallel
125
+ requirement: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - "~>"
128
+ - !ruby/object:Gem::Version
129
+ version: '1.0'
130
+ type: :development
131
+ prerelease: false
132
+ version_requirements: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - "~>"
135
+ - !ruby/object:Gem::Version
136
+ version: '1.0'
137
+ - !ruby/object:Gem::Dependency
138
+ name: rainbow
139
+ requirement: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - "<"
142
+ - !ruby/object:Gem::Version
143
+ version: 4.0.0
144
+ type: :development
145
+ prerelease: false
146
+ version_requirements: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - "<"
149
+ - !ruby/object:Gem::Version
150
+ version: 4.0.0
75
151
  - !ruby/object:Gem::Dependency
76
152
  name: rake
77
153
  requirement: !ruby/object:Gem::Requirement
@@ -115,7 +191,7 @@ dependencies:
115
191
  - !ruby/object:Gem::Version
116
192
  version: '3.0'
117
193
  - !ruby/object:Gem::Dependency
118
- name: simplecov
194
+ name: rubocop
119
195
  requirement: !ruby/object:Gem::Requirement
120
196
  requirements:
121
197
  - - "<"
@@ -129,7 +205,7 @@ dependencies:
129
205
  - !ruby/object:Gem::Version
130
206
  version: 1.0.0
131
207
  - !ruby/object:Gem::Dependency
132
- name: coveralls
208
+ name: simplecov
133
209
  requirement: !ruby/object:Gem::Requirement
134
210
  requirements:
135
211
  - - "<"
@@ -142,20 +218,6 @@ dependencies:
142
218
  - - "<"
143
219
  - !ruby/object:Gem::Version
144
220
  version: 1.0.0
145
- - !ruby/object:Gem::Dependency
146
- name: rainbow
147
- requirement: !ruby/object:Gem::Requirement
148
- requirements:
149
- - - "<"
150
- - !ruby/object:Gem::Version
151
- version: 4.0.0
152
- type: :development
153
- prerelease: false
154
- version_requirements: !ruby/object:Gem::Requirement
155
- requirements:
156
- - - "<"
157
- - !ruby/object:Gem::Version
158
- version: 4.0.0
159
221
  description:
160
222
  email:
161
223
  - morrow748@gmail.com
@@ -170,7 +232,11 @@ files:
170
232
  - cuke_linter.gemspec
171
233
  - exe/cuke_linter
172
234
  - lib/cuke_linter.rb
235
+ - lib/cuke_linter/configuration.rb
236
+ - lib/cuke_linter/default_linters.rb
173
237
  - lib/cuke_linter/formatters/pretty_formatter.rb
238
+ - lib/cuke_linter/gherkin.rb
239
+ - lib/cuke_linter/linter_registration.rb
174
240
  - lib/cuke_linter/linters/background_does_more_than_setup_linter.rb
175
241
  - lib/cuke_linter/linters/element_with_common_tags_linter.rb
176
242
  - lib/cuke_linter/linters/element_with_duplicate_tags_linter.rb