tailor 1.0.0.alpha2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.tailor +10 -2
- data/Gemfile.lock +2 -2
- data/History.rdoc +20 -0
- data/README.rdoc +176 -26
- data/features/configurable.feature +19 -39
- data/features/horizontal_spacing.feature +3 -2
- data/features/indentation.feature +2 -2
- data/features/indentation/bad_files_with_no_trailing_newline.feature +9 -8
- data/features/indentation/good_files_with_no_trailing_newline.feature +19 -6
- data/features/name_detection.feature +2 -2
- data/features/support/env.rb +0 -2
- data/features/support/file_cases/horizontal_spacing_cases.rb +5 -4
- data/features/support/file_cases/indentation_cases.rb +105 -54
- data/features/support/file_cases/naming_cases.rb +0 -1
- data/features/support/file_cases/vertical_spacing_cases.rb +0 -1
- data/features/support/legacy/bad_ternary_colon_spacing.rb +1 -1
- data/features/valid_ruby.feature +17 -0
- data/features/vertical_spacing.feature +40 -19
- data/lib/ext/string_ext.rb +12 -0
- data/lib/tailor/cli.rb +7 -5
- data/lib/tailor/cli/options.rb +13 -3
- data/lib/tailor/composite_observable.rb +17 -2
- data/lib/tailor/configuration.rb +83 -72
- data/lib/tailor/configuration/style.rb +85 -0
- data/lib/tailor/critic.rb +67 -117
- data/lib/tailor/formatter.rb +38 -0
- data/lib/tailor/formatters/text.rb +35 -10
- data/lib/tailor/lexed_line.rb +38 -5
- data/lib/tailor/lexer.rb +150 -14
- data/lib/tailor/{lexer_constants.rb → lexer/lexer_constants.rb} +9 -7
- data/lib/tailor/lexer/token.rb +6 -2
- data/lib/tailor/logger.rb +4 -0
- data/lib/tailor/problem.rb +8 -73
- data/lib/tailor/reporter.rb +1 -1
- data/lib/tailor/ruler.rb +67 -6
- data/lib/tailor/rulers/allow_camel_case_methods_ruler.rb +9 -1
- data/lib/tailor/rulers/allow_hard_tabs_ruler.rb +9 -1
- data/lib/tailor/rulers/allow_invalid_ruby_ruler.rb +38 -0
- data/lib/tailor/rulers/allow_screaming_snake_case_classes_ruler.rb +9 -2
- data/lib/tailor/rulers/allow_trailing_line_spaces_ruler.rb +10 -5
- data/lib/tailor/rulers/indentation_spaces_ruler.rb +93 -26
- data/lib/tailor/rulers/indentation_spaces_ruler/indentation_manager.rb +128 -84
- data/lib/tailor/rulers/max_code_lines_in_class_ruler.rb +9 -5
- data/lib/tailor/rulers/max_code_lines_in_method_ruler.rb +9 -5
- data/lib/tailor/rulers/max_line_length_ruler.rb +10 -5
- data/lib/tailor/rulers/spaces_after_comma_ruler.rb +13 -4
- data/lib/tailor/rulers/spaces_after_lbrace_ruler.rb +8 -4
- data/lib/tailor/rulers/spaces_after_lbracket_ruler.rb +8 -4
- data/lib/tailor/rulers/spaces_after_lparen_ruler.rb +8 -4
- data/lib/tailor/rulers/spaces_before_comma_ruler.rb +8 -4
- data/lib/tailor/rulers/spaces_before_lbrace_ruler.rb +13 -6
- data/lib/tailor/rulers/spaces_before_rbrace_ruler.rb +12 -8
- data/lib/tailor/rulers/spaces_before_rbracket_ruler.rb +12 -5
- data/lib/tailor/rulers/spaces_before_rparen_ruler.rb +13 -6
- data/lib/tailor/rulers/spaces_in_empty_braces_ruler.rb +13 -9
- data/lib/tailor/rulers/trailing_newlines_ruler.rb +10 -5
- data/lib/tailor/tailorrc.erb +3 -3
- data/lib/tailor/version.rb +1 -1
- data/m.rb +15 -0
- data/spec/spec_helper.rb +0 -1
- data/spec/tailor/cli_spec.rb +8 -9
- data/spec/tailor/composite_observable_spec.rb +41 -0
- data/spec/tailor/configuration/style_spec.rb +197 -0
- data/spec/tailor/configuration_spec.rb +52 -33
- data/spec/tailor/critic_spec.rb +7 -8
- data/spec/tailor/formatter_spec.rb +52 -0
- data/spec/tailor/lexed_line_spec.rb +236 -88
- data/spec/tailor/lexer_spec.rb +8 -63
- data/spec/tailor/problem_spec.rb +14 -46
- data/spec/tailor/reporter_spec.rb +8 -8
- data/spec/tailor/ruler_spec.rb +1 -1
- data/spec/tailor/rulers/indentation_spaces_ruler/indentation_manager_spec.rb +132 -176
- data/spec/tailor/rulers/indentation_spaces_ruler_spec.rb +41 -33
- data/spec/tailor/rulers/{spaces_after_comma_spec.rb → spaces_after_comma_ruler_spec.rb} +5 -5
- data/spec/tailor/rulers/spaces_after_lbrace_ruler_spec.rb +14 -14
- data/spec/tailor/rulers/spaces_before_lbrace_ruler_spec.rb +1 -1
- data/spec/tailor/rulers/spaces_before_rbrace_ruler_spec.rb +1 -1
- data/spec/tailor/version_spec.rb +1 -1
- data/spec/tailor_spec.rb +3 -1
- data/tailor.gemspec +11 -3
- data/uest.rb +9 -0
- metadata +66 -41
- data/features/step_definitions/spacing/commas_steps.rb +0 -14
data/.gitignore
CHANGED
data/.tailor
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
Tailor.config do |config|
|
2
2
|
config.formatters "text"
|
3
3
|
config.file_set 'lib/**/*.rb'
|
4
|
-
|
5
|
-
config.file_set 'features/**/*.rb'
|
4
|
+
|
5
|
+
config.file_set 'features/**/*.rb', :features do |style|
|
6
|
+
style.max_line_length 90, level: :warn
|
7
|
+
end
|
8
|
+
|
9
|
+
config.file_set 'spec/**/*.rb', :spec do |style|
|
10
|
+
style.spaces_after_lbrace 1, level: :warn
|
11
|
+
style.spaces_before_lbrace 1, level: :warn
|
12
|
+
style.spaces_before_rbrace 1, level: :warn
|
13
|
+
end
|
6
14
|
end
|
data/Gemfile.lock
CHANGED
data/History.rdoc
CHANGED
@@ -1,3 +1,23 @@
|
|
1
|
+
=== 1.0.0 2012-04-17
|
2
|
+
|
3
|
+
* Big update to config file.
|
4
|
+
* Fix for indentation checking on nested Hashes.
|
5
|
+
* Fix for overriding default style in config files.
|
6
|
+
* Fix to exit after --show-config.
|
7
|
+
* gh-99[https://github.com/turboladen/tailor/issues/99]
|
8
|
+
* Now warns by default if `ruby -c [file]` fails.
|
9
|
+
* gh-93[https://github.com/turboladen/tailor/issues/93]
|
10
|
+
* 2 'end's on the same line don't cause an indentation error.
|
11
|
+
* gh-92[https://github.com/turboladen/tailor/issues/92]
|
12
|
+
* Users can now turn off a ruler...
|
13
|
+
* CLI: <tt>--my-option off</tt>
|
14
|
+
* Config file: <tt>my_option 1, level: :off</tt>
|
15
|
+
* gh-86[https://github.com/turboladen/tailor/issues/86]
|
16
|
+
* Indentation checking implemented.
|
17
|
+
* gh-68[https://github.com/turboladen/tailor/issues/68]
|
18
|
+
* Spaces aren't improperly detected after a token when the line ends with a
|
19
|
+
backslash.
|
20
|
+
|
1
21
|
=== 1.0.0.alpha2 2012-04-09
|
2
22
|
|
3
23
|
* Fix for when not using a config file.
|
data/README.rdoc
CHANGED
@@ -4,11 +4,14 @@
|
|
4
4
|
|
5
5
|
== DESCRIPTION:
|
6
6
|
|
7
|
-
tailor
|
8
|
-
|
9
|
-
|
7
|
+
tailor parses Ruby files and measures them with some style and static analysis
|
8
|
+
"rulers". Default values for the Rulers are based on a number of style guides
|
9
|
+
in the Ruby community as well as what seems to be common. More on this here
|
10
10
|
http://wiki.github.com/turboladen/tailor.
|
11
11
|
|
12
|
+
tailor's goal is to help you be consistent with your style, throughout your
|
13
|
+
project, whatever style that may be.
|
14
|
+
|
12
15
|
== FEATURES/PROBLEMS:
|
13
16
|
|
14
17
|
* Checks for bad style in Ruby files
|
@@ -33,12 +36,15 @@ http://wiki.github.com/turboladen/tailor.
|
|
33
36
|
* Name cases
|
34
37
|
* Snake case class & module names
|
35
38
|
* Camel case method names
|
39
|
+
* Valid Ruby (warns by default)
|
36
40
|
* Configurable
|
37
41
|
* Specify style in
|
38
42
|
* ~./tailorrc
|
39
43
|
* PROJECT_ROOT + .tailor
|
40
44
|
* as CLI options
|
41
|
-
* "File sets" allow for applying different styles to different
|
45
|
+
* "File sets" allow for applying different styles to different groups of files
|
46
|
+
* Set problems to :warn or :off instead of :fail
|
47
|
+
* Define custom "Rulers"
|
42
48
|
* CI/Build Integration
|
43
49
|
* (Well, this may be stretching things a bit, but...) Exit 1 on failures
|
44
50
|
|
@@ -56,8 +62,8 @@ At tailor's inception, there were some other static analysis tools for Ruby,
|
|
56
62
|
but none which checked style stuff; tailor started off as a means to fill this
|
57
63
|
gap. Since then, a number of those tools have dropped by the wayside due to
|
58
64
|
various Ruby 1.9 incompatibilities, and left a bigger tool gap for Rubyists.
|
59
|
-
Right now it's mostly a style-checker, but might
|
60
|
-
|
65
|
+
Right now it's mostly a style-checker, but might into a tool for analyzing other
|
66
|
+
aspects of your Ruby code.
|
61
67
|
|
62
68
|
=== Since 0.x...
|
63
69
|
|
@@ -85,8 +91,61 @@ Run tailor like:
|
|
85
91
|
|
86
92
|
$ tailor
|
87
93
|
|
88
|
-
|
89
|
-
|
94
|
+
==== On style...
|
95
|
+
|
96
|
+
The features list, above, shows some aspects of style that should be fairly
|
97
|
+
straightforward (as to their meaning and reason), however, others make some big
|
98
|
+
assumptions--particularly the indentation checking "ruler". There are a number
|
99
|
+
of popular indenting conventions... In the case of multi-line parameters to a
|
100
|
+
method, some like do this:
|
101
|
+
|
102
|
+
def a_really_freakin_long_method_name(my_really_long_first_parameter,
|
103
|
+
my_next_param)
|
104
|
+
# ...
|
105
|
+
end
|
106
|
+
|
107
|
+
...while others prefer:
|
108
|
+
|
109
|
+
def a_really_freakin_long_method_name(my_really_long_first_parameter,
|
110
|
+
my_next_param)
|
111
|
+
# ...
|
112
|
+
end
|
113
|
+
|
114
|
+
...and yet some others prefer:
|
115
|
+
|
116
|
+
def a_really_freakin_long_method_name(my_really_long_first_parameter,
|
117
|
+
my_next_param)
|
118
|
+
# ...
|
119
|
+
end
|
120
|
+
|
121
|
+
At this point, tailor only supports the style used in the first example. If
|
122
|
+
this style isn't to your liking, then definitely take a look at the
|
123
|
+
Configurable section here to see how to turn this off. Other styles will
|
124
|
+
probably be supported in the future.
|
125
|
+
|
126
|
+
All that to say, though, that this isn't the only case where tailor makes style
|
127
|
+
assumptions. Another discrepancy in popular styles is with regard to aligning
|
128
|
+
operators in different lines. Some like:
|
129
|
+
|
130
|
+
my_hash[:first][:thing] = 1
|
131
|
+
my_hash[:eleventy][:thing] = 2
|
132
|
+
|
133
|
+
...while others prefer:
|
134
|
+
|
135
|
+
my_hash[:first][:thing] = 1
|
136
|
+
my_hash[:eleventy][:thing] = 2
|
137
|
+
|
138
|
+
...and yet some others prefer:
|
139
|
+
|
140
|
+
my_hash[:first][:thing] = 1
|
141
|
+
my_hash[:eleventy][:thing] = 2
|
142
|
+
|
143
|
+
Again, tailor only supports the first example here.
|
144
|
+
|
145
|
+
The goal is certainly not to force you to use the style that tailor currently
|
146
|
+
uses; it just might not support your style yet. If tailor doesn't support your
|
147
|
+
style, please feel free to take a look at the issues list and make a request.
|
148
|
+
...or fork away!
|
90
149
|
|
91
150
|
=== Configurable:
|
92
151
|
|
@@ -113,15 +172,15 @@ are > 100 chars (instead of the default of 80):
|
|
113
172
|
|
114
173
|
$ tailor --max-line-length 100 lib/
|
115
174
|
|
116
|
-
If you want to simply disable a ruler, just pass +
|
175
|
+
If you want to simply disable a ruler, just pass +off+ to the option:
|
117
176
|
|
118
|
-
$ tailor --max-line-length
|
177
|
+
$ tailor --max-line-length off lib/
|
119
178
|
|
120
179
|
==== Configuration File
|
121
180
|
|
122
|
-
|
123
|
-
|
124
|
-
settings, do:
|
181
|
+
While you can drive most tailor options from the command line, configuration
|
182
|
+
files allow for some more flexibility with style rulers, file lists, and
|
183
|
+
(eventually) report formatters. To create one with default settings, do:
|
125
184
|
|
126
185
|
$ tailor --create-config
|
127
186
|
|
@@ -130,12 +189,12 @@ straightforward (if they're not, please let me know!). You don't have to specif
|
|
130
189
|
all of those settings in your config file--those are just rendered so you have
|
131
190
|
a starting ground to tweak with. If you only want to override a single value,
|
132
191
|
you can delete the rest of the code from your config. This would accomplish
|
133
|
-
the same as the
|
192
|
+
the same as the <tt>--max-line-length</tt> example above:
|
134
193
|
|
135
194
|
# .tailor
|
136
195
|
Tailor.config do |config|
|
137
|
-
config.file_set 'lib/**/*.rb' do
|
138
|
-
max_line_length 100
|
196
|
+
config.file_set 'lib/**/*.rb' do |style|
|
197
|
+
style.max_line_length 100
|
139
198
|
end
|
140
199
|
end
|
141
200
|
|
@@ -151,29 +210,120 @@ globs to use the default set of rulers... File sets allow for those sorts of
|
|
151
210
|
things.
|
152
211
|
|
153
212
|
In the default config file, you see a single parameter being passed to
|
154
|
-
<tt>config.file_set</tt>--this is the
|
213
|
+
<tt>config.file_set</tt>--this is the glob that defines the list of files for
|
214
|
+
that file set. While you don't see it, +config.file_set+ takes a second
|
215
|
+
optional parameter that allows you to _label_ your style properties, and thus
|
216
|
+
use different sets of style properties for differet sets of files. The label is
|
155
217
|
simply just a name to refer to that file set by; it will show in your report
|
156
218
|
(in the case that problems were found, of course) so you know what set of
|
157
|
-
rulers caused the problem to be found.
|
158
|
-
a second paramter: the file/directory/glob to apply the style to.
|
219
|
+
rulers caused the problem to be found.
|
159
220
|
|
160
221
|
# .tailor
|
161
222
|
Tailor.config do |config|
|
162
|
-
|
163
|
-
|
223
|
+
|
224
|
+
# All defaults; implies "default" label
|
225
|
+
config.file_set 'lib/**/*.rb
|
226
|
+
|
227
|
+
config.file_set 'app/**/*.rb', :rails_app do |style|
|
228
|
+
style.max_line_length 100
|
164
229
|
# All other rulers will use default values
|
165
230
|
end
|
166
231
|
|
167
|
-
|
232
|
+
# Uses default style, but labelled in the report with "features"
|
233
|
+
config.file_set 'features/**/*.rb', :features
|
168
234
|
|
169
|
-
config.file_set
|
170
|
-
spaces_after_lbrace false
|
171
|
-
spaces_before_lbrace false
|
172
|
-
spaces_before_rbrace false
|
235
|
+
config.file_set 'spec/**/*.rb', :rspec do |style|
|
236
|
+
style.spaces_after_lbrace false
|
237
|
+
style.spaces_before_lbrace false
|
238
|
+
style.spaces_before_rbrace false
|
173
239
|
# All other rulers will use default values
|
174
240
|
end
|
175
241
|
end
|
176
242
|
|
243
|
+
Similarly to the CLI, if you want to turn off a default Ruler, set its problem
|
244
|
+
level to +:off+:
|
245
|
+
|
246
|
+
# .tailor
|
247
|
+
Tailor.config do |config|
|
248
|
+
config.file_set 'lib/**/*.rb do |style|
|
249
|
+
style.indentation_spaces 2, level: :off
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
|
254
|
+
=== Define A Custom Ruler
|
255
|
+
|
256
|
+
While tailor provides a number of Rulers for checking style, it also provides a
|
257
|
+
way for you to add your own rulers without having to delve into its innards. To
|
258
|
+
do this, you need to do the following.
|
259
|
+
|
260
|
+
==== Create the Ruler
|
261
|
+
|
262
|
+
Before jumping in to this, take a look at {Tailor::Ruler} and any of the
|
263
|
+
existing Rulers in +lib/tailor/rulers/+. There are some key things a new Ruler
|
264
|
+
must have:
|
265
|
+
|
266
|
+
* the class name ends with "Ruler"
|
267
|
+
* it inherits {Tailor::Ruler}
|
268
|
+
* it's defined within the {Tailor::Rulers} module
|
269
|
+
* +#initialize+ defines two parameters:
|
270
|
+
1. +config+ sets +@config+ to the "golden rule" value for what you're measuring
|
271
|
+
2. +options+ is a Hash, that should at least be passed the :level => you want
|
272
|
+
the problem to be logged as
|
273
|
+
* +#add_lexer_observers+ gets passed a list of {Tailor::Lexer} event types that
|
274
|
+
the ruler should get notified on
|
275
|
+
* it defines call-back methods for {Tailor::Lexer} to call when it comes across
|
276
|
+
an event of interest
|
277
|
+
* it calls +#measure+ to assess if the criteria it's checking has been met
|
278
|
+
* it adds a {Tailor::Problem} to +@problems+ when one is found in +#measure+
|
279
|
+
|
280
|
+
==== Add the Ruler to the list of Styles
|
281
|
+
|
282
|
+
Internally, this all happens in +lib/tailor/configuration/style.rb+, but you can
|
283
|
+
add infomation about your ruler to your config file. If you created a Ruler:
|
284
|
+
|
285
|
+
# max_lines_in_block.rb
|
286
|
+
class Tailor
|
287
|
+
module Rulers
|
288
|
+
class MaxLinesInBlockRuler < Tailor::Ruler
|
289
|
+
def initialize(config, options)
|
290
|
+
super(config, options)
|
291
|
+
add_lexer_observers :ignored_nl, :kw
|
292
|
+
end
|
293
|
+
|
294
|
+
def ignored_nl_update(lexed_line, lineno, column)
|
295
|
+
# ...
|
296
|
+
end
|
297
|
+
|
298
|
+
def kw_update(token, lexed_line, lineno, column)
|
299
|
+
# ...
|
300
|
+
end
|
301
|
+
|
302
|
+
def measure
|
303
|
+
# ...
|
304
|
+
end
|
305
|
+
|
306
|
+
# ...
|
307
|
+
end
|
308
|
+
end
|
309
|
+
end
|
310
|
+
|
311
|
+
...then require this and add it to the Style list of properties:
|
312
|
+
|
313
|
+
# .tailor
|
314
|
+
require 'tailor/configuration/style'
|
315
|
+
require 'max_lines_in_block'
|
316
|
+
|
317
|
+
Tailor::Configuration::Style.define_property :max_lines_in_block
|
318
|
+
|
319
|
+
Tailor.config do |config|
|
320
|
+
config.file_set 'lib/**/*.rb' do |style|
|
321
|
+
style.max_lines_in_block 10, level: :error
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
325
|
+
Next time you run tailor, your Ruler will get initialized and used.
|
326
|
+
|
177
327
|
== REQUIREMENTS:
|
178
328
|
|
179
329
|
* Rubies (tested)
|
@@ -1,55 +1,35 @@
|
|
1
|
-
@wip
|
2
1
|
Feature: Configurable
|
3
2
|
As a Ruby developer
|
4
3
|
I want to be able to configure tailor to my style likings
|
5
4
|
So that tailor only detects the problems that I care about.
|
6
5
|
|
7
|
-
Scenario:
|
8
|
-
Given a file named ".
|
6
|
+
Scenario: Print configuration when no config file exists
|
7
|
+
Given a file named ".tailor" should not exist
|
9
8
|
When I successfully run `tailor --show-config`
|
10
|
-
Then the output should
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
| Indentation |
|
16
|
-
+---------------------------+------------------+
|
17
|
-
| spaces | 2 |
|
18
|
-
| allow_hard_tabs | false |
|
19
|
-
| continuation_spaces | 2 |
|
20
|
-
+---------------------------+------------------+
|
21
|
-
| Vertical whitespace |
|
22
|
-
+---------------------------+------------------+
|
23
|
-
| trailing_newlines | 1 |
|
24
|
-
+---------------------------+------------------+
|
25
|
-
"""
|
9
|
+
Then the output should match /Configuration/
|
10
|
+
And the output should match /Formatters.+|.+text.+|/
|
11
|
+
And the output should match /Label.+|.+default.+|/
|
12
|
+
And the output should match /Style.+|/
|
13
|
+
And the output should match /File List.+|/
|
26
14
|
And the exit status should be 0
|
27
15
|
|
28
|
-
Scenario:
|
16
|
+
Scenario: Print configuration when .tailor exists
|
29
17
|
Given a file named ".tailorrc" with:
|
30
18
|
"""
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
19
|
+
Tailor::Configuration::Style.define_property :some_ruler
|
20
|
+
|
21
|
+
Tailor.config do |config|
|
22
|
+
config.formatters 'test'
|
23
|
+
config.file_set 'test/**/*.rb' do |style|
|
24
|
+
style.some_ruler 1234
|
25
|
+
end
|
26
|
+
end
|
36
27
|
"""
|
37
28
|
When I successfully run `tailor --show-config`
|
38
|
-
Then the output should
|
39
|
-
|
40
|
-
+-------------------------+------------------+
|
41
|
-
| Configuration |
|
42
|
-
+-------------------------+------------------+
|
43
|
-
| Indentation |
|
44
|
-
+-------------------------+------------------+
|
45
|
-
| spaces | 5 |
|
46
|
-
+-------------------------+------------------+
|
47
|
-
| Vertical whitespace |
|
48
|
-
+-------------------------+------------------+
|
49
|
-
| trailing_newlines | 11 |
|
50
|
-
+-------------------------+------------------+
|
51
|
-
"""
|
29
|
+
Then the output should match /Formatters.+|.+test.+|/
|
30
|
+
And the output should match /some_ruler.+|.+1234.+|/
|
52
31
|
|
32
|
+
@wip
|
53
33
|
Scenario: Pass in configuration file at runtime
|
54
34
|
Given a file named "some_config.yml" with:
|
55
35
|
"""
|
@@ -6,8 +6,8 @@ Feature: Horizontal spacing detection
|
|
6
6
|
Given my configuration file ".tailor" looks like:
|
7
7
|
"""
|
8
8
|
Tailor.config do |config|
|
9
|
-
config.file_set do
|
10
|
-
trailing_newlines 0
|
9
|
+
config.file_set do |style|
|
10
|
+
style.trailing_newlines 0
|
11
11
|
end
|
12
12
|
end
|
13
13
|
"""
|
@@ -104,6 +104,7 @@ Feature: Horizontal spacing detection
|
|
104
104
|
| h_spacing/ok/space_after_comma_in_array |
|
105
105
|
| h_spacing/ok/trailing_comma |
|
106
106
|
| h_spacing/ok/trailing_comma_with_trailing_comment |
|
107
|
+
| h_spacing/ok/line_ends_with_backslash |
|
107
108
|
|
108
109
|
@good_files @braces
|
109
110
|
|
@@ -5,8 +5,8 @@ Feature: Indentation check on bad fails without trailing newlines
|
|
5
5
|
Given my configuration file ".tailor" looks like:
|
6
6
|
"""
|
7
7
|
Tailor.config do |config|
|
8
|
-
config.file_set do
|
9
|
-
trailing_newlines 0
|
8
|
+
config.file_set do |style|
|
9
|
+
style.trailing_newlines 0
|
10
10
|
end
|
11
11
|
end
|
12
12
|
"""
|
@@ -19,14 +19,14 @@ Feature: Indentation check on bad fails without trailing newlines
|
|
19
19
|
And the output should match /position: <Position>/
|
20
20
|
And the exit status should be 1
|
21
21
|
|
22
|
-
@multi_line
|
22
|
+
@multi_line @keywords
|
23
23
|
Scenarios: 1 problem with classes
|
24
24
|
| File | Position |
|
25
25
|
| indent/1/class_indented_end | 2:1 |
|
26
26
|
| indent/1/class_method_def_using_self_outdented | 2:1 |
|
27
27
|
|
28
28
|
|
29
|
-
@
|
29
|
+
@single_line @keywords
|
30
30
|
Scenarios: 1 problem with single-line statement
|
31
31
|
| File | Position |
|
32
32
|
| indent/1/class_indented_singlestatement | 2:3 |
|
@@ -34,14 +34,14 @@ Feature: Indentation check on bad fails without trailing newlines
|
|
34
34
|
| indent/1/class_outdented_singlestatement | 2:1 |
|
35
35
|
| indent/1/class_def_outdented_content | 3:3 |
|
36
36
|
|
37
|
-
@multi_line
|
37
|
+
@multi_line @keywords
|
38
38
|
Scenarios: 1 problem with def
|
39
39
|
| File | Position |
|
40
40
|
| indent/1/def_indented_end | 2:1 |
|
41
41
|
| indent/1/def_content_indented_end | 3:1 |
|
42
42
|
| indent/1/class_def_content_outdented_end | 4:1 |
|
43
43
|
|
44
|
-
@multi_line
|
44
|
+
@multi_line @keywords @continuations
|
45
45
|
Scenarios: 1 problem with case
|
46
46
|
| File | Position |
|
47
47
|
| indent/1/case_indented_whens_level | 2:3 |
|
@@ -51,7 +51,7 @@ Feature: Indentation check on bad fails without trailing newlines
|
|
51
51
|
| indent/1/case_when_outdented_whens_level | 3:1 |
|
52
52
|
| indent/1/case_indented_whens_in | 2:3 |
|
53
53
|
|
54
|
-
@multi_line
|
54
|
+
@multi_line @keywords
|
55
55
|
Scenarios: 1 problem with 'do' loop
|
56
56
|
| File | Position |
|
57
57
|
| indent/1/while_do_indented | 1:1 |
|
@@ -64,11 +64,12 @@ Feature: Indentation check on bad fails without trailing newlines
|
|
64
64
|
| indent/1/for_do_indented | 1:1 |
|
65
65
|
| indent/1/loop_do_indented | 1:1 |
|
66
66
|
|
67
|
-
@multi_line
|
67
|
+
@multi_line @strings
|
68
68
|
Scenarios: 1 problem with multi-line string
|
69
69
|
| File | Position |
|
70
70
|
| indent/1/multi_line_string_first_line_indented | 2:3 |
|
71
71
|
| indent/1/multi_line_string_first_line_indented_trailing_comment | 2:3 |
|
72
|
+
| indent/1/multi_line_tstring | 2:0 |
|
72
73
|
|
73
74
|
@multi_line
|
74
75
|
Scenarios: 1 problem with multi-line operator use
|