tailor 1.1.5 → 1.2.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 (54) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/.travis.yml +1 -0
  4. data/Gemfile +1 -1
  5. data/Gemfile.lock +23 -23
  6. data/History.rdoc +14 -0
  7. data/README.rdoc +42 -2
  8. data/Rakefile +7 -0
  9. data/features/continuous_integration.feature +28 -0
  10. data/lib/tailor/cli.rb +17 -4
  11. data/lib/tailor/cli/options.rb +6 -0
  12. data/lib/tailor/configuration.rb +19 -3
  13. data/lib/tailor/configuration/style.rb +7 -0
  14. data/lib/tailor/critic.rb +4 -2
  15. data/lib/tailor/formatters/yaml.rb +51 -0
  16. data/lib/tailor/lexer.rb +6 -4
  17. data/lib/tailor/rake_task.rb +44 -6
  18. data/lib/tailor/reporter.rb +9 -3
  19. data/lib/tailor/rulers/allow_invalid_ruby_ruler.rb +3 -3
  20. data/lib/tailor/rulers/indentation_spaces_ruler.rb +24 -6
  21. data/lib/tailor/rulers/indentation_spaces_ruler/indentation_manager.rb +2 -2
  22. data/lib/tailor/rulers/spaces_before_rbrace_ruler.rb +9 -6
  23. data/lib/tailor/rulers/spaces_in_empty_braces_ruler.rb +1 -1
  24. data/lib/tailor/version.rb +1 -1
  25. data/spec/functional/configuration_spec.rb +37 -0
  26. data/spec/functional/horizontal_spacing/braces_spec.rb +113 -113
  27. data/spec/functional/horizontal_spacing/brackets_spec.rb +39 -39
  28. data/spec/functional/horizontal_spacing/comma_spacing_spec.rb +27 -27
  29. data/spec/functional/horizontal_spacing/hard_tabs_spec.rb +42 -42
  30. data/spec/functional/horizontal_spacing/long_lines_spec.rb +16 -16
  31. data/spec/functional/horizontal_spacing/parens_spec.rb +48 -48
  32. data/spec/functional/horizontal_spacing/trailing_whitespace_spec.rb +23 -23
  33. data/spec/functional/horizontal_spacing_spec.rb +11 -11
  34. data/spec/functional/indentation_spacing/bad_indentation_spec.rb +212 -215
  35. data/spec/functional/indentation_spacing_spec.rb +8 -7
  36. data/spec/functional/naming/camel_case_methods_spec.rb +16 -16
  37. data/spec/functional/naming/screaming_snake_case_classes_spec.rb +30 -30
  38. data/spec/functional/naming_spec.rb +5 -4
  39. data/spec/functional/rake_task_spec.rb +56 -10
  40. data/spec/functional/vertical_spacing/class_length_spec.rb +16 -16
  41. data/spec/functional/vertical_spacing/method_length_spec.rb +16 -16
  42. data/spec/functional/vertical_spacing_spec.rb +5 -4
  43. data/spec/support/bad_indentation_cases.rb +35 -35
  44. data/spec/support/good_indentation_cases.rb +108 -108
  45. data/spec/support/horizontal_spacing_cases.rb +37 -37
  46. data/spec/support/naming_cases.rb +6 -6
  47. data/spec/support/vertical_spacing_cases.rb +4 -4
  48. data/spec/unit/tailor/cli_spec.rb +34 -12
  49. data/spec/unit/tailor/configuration_spec.rb +18 -0
  50. data/spec/unit/tailor/formatters/yaml_spec.rb +75 -0
  51. data/spec/unit/tailor/reporter_spec.rb +23 -4
  52. data/spec/unit/tailor/rulers/indentation_spaces_ruler_spec.rb +12 -10
  53. data/spec/unit/tailor/version_spec.rb +3 -2
  54. metadata +35 -63
@@ -4,32 +4,32 @@ require 'ripper'
4
4
 
5
5
  describe Tailor::Rulers::IndentationSpacesRuler do
6
6
  let!(:spaces) { 5 }
7
+ let(:lexed_line) { double "LexedLine" }
7
8
 
8
9
  subject do
9
10
  Tailor::Rulers::IndentationSpacesRuler.new(spaces, level: :error)
10
11
  end
11
12
 
12
13
  describe "#comment_update" do
13
- pending
14
14
  context "token does not contain a trailing newline" do
15
-
15
+ pending
16
16
  end
17
17
 
18
18
  context "token contains a trailing newline" do
19
19
  context "lexed_line is spaces then a comment" do
20
-
20
+ pending
21
21
  end
22
22
 
23
23
  context "lexed_line is no spaces and a comment" do
24
-
24
+ pending
25
25
  end
26
26
 
27
27
  context "lexed_line ends with an operator" do
28
-
28
+ pending
29
29
  end
30
30
 
31
31
  context "lexed_line ends with a comma" do
32
-
32
+ pending
33
33
  end
34
34
  end
35
35
  end
@@ -37,15 +37,19 @@ describe Tailor::Rulers::IndentationSpacesRuler do
37
37
  describe "#embexpr_beg_update" do
38
38
  it "sets @embexpr_nesting to [true]" do
39
39
  subject.instance_variable_set(:@embexpr_nesting, [])
40
- subject.embexpr_beg_update
40
+ subject.embexpr_beg_update(lexed_line, 1, 1)
41
41
  subject.instance_variable_get(:@embexpr_nesting).should == [true]
42
42
  end
43
43
  end
44
44
 
45
45
  describe "#embexpr_end_update" do
46
+ before do
47
+ lexed_line.should_receive(:only_on_embexpr_end?).and_return(false)
48
+ end
49
+
46
50
  it "pops @embexpr_nesting" do
47
51
  subject.instance_variable_set(:@embexpr_nesting, [true])
48
- subject.embexpr_end_update
52
+ subject.embexpr_end_update(lexed_line, 1, 1)
49
53
  subject.instance_variable_get(:@embexpr_nesting).should == []
50
54
  end
51
55
  end
@@ -91,7 +95,6 @@ describe Tailor::Rulers::IndentationSpacesRuler do
91
95
  end
92
96
 
93
97
  describe "#tstring_beg_update" do
94
- let(:lexed_line) { double "LexedLine" }
95
98
  let(:manager) { double "IndentationManager" }
96
99
 
97
100
  it "calls #stop on the indentation_manager object" do
@@ -112,7 +115,6 @@ describe Tailor::Rulers::IndentationSpacesRuler do
112
115
 
113
116
  describe "#tstring_end_update" do
114
117
  context "@tstring_nesting is not empty" do
115
- let(:lexed_line) { double "LexedLine" }
116
118
  let(:manager) { double "IndentationManager" }
117
119
 
118
120
  it "calls #start" do
@@ -1,6 +1,7 @@
1
- require_relative '../../spec_helper'
1
+ require 'spec_helper'
2
2
  require 'tailor/version'
3
3
 
4
+
4
5
  describe Tailor::VERSION do
5
- it { should == "1.1.5" }
6
+ it { should == '1.2.0' }
6
7
  end
metadata CHANGED
@@ -1,207 +1,177 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tailor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
5
- prerelease:
4
+ version: 1.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Steve Loveless
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-02 00:00:00.000000000 Z
11
+ date: 2013-03-08 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: log_switch
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: 0.3.0
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: 0.3.0
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: term-ansicolor
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: 1.0.5
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: 1.0.5
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: text-table
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: 1.2.2
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: 1.2.2
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: aruba
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: bundler
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - '>='
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - '>='
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: cucumber
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - '>='
100
88
  - !ruby/object:Gem::Version
101
89
  version: 1.0.2
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - '>='
108
95
  - !ruby/object:Gem::Version
109
96
  version: 1.0.2
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: fakefs
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
- - - ! '>='
101
+ - - '>='
116
102
  - !ruby/object:Gem::Version
117
103
  version: 0.4.2
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
- - - ! '>='
108
+ - - '>='
124
109
  - !ruby/object:Gem::Version
125
110
  version: 0.4.2
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: rake
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
- - - ! '>='
115
+ - - '>='
132
116
  - !ruby/object:Gem::Version
133
117
  version: '0'
134
118
  type: :development
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
- - - ! '>='
122
+ - - '>='
140
123
  - !ruby/object:Gem::Version
141
124
  version: '0'
142
125
  - !ruby/object:Gem::Dependency
143
126
  name: rspec
144
127
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
128
  requirements:
147
- - - ! '>='
129
+ - - '>='
148
130
  - !ruby/object:Gem::Version
149
131
  version: 2.5.0
150
132
  type: :development
151
133
  prerelease: false
152
134
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
135
  requirements:
155
- - - ! '>='
136
+ - - '>='
156
137
  - !ruby/object:Gem::Version
157
138
  version: 2.5.0
158
139
  - !ruby/object:Gem::Dependency
159
140
  name: simplecov
160
141
  requirement: !ruby/object:Gem::Requirement
161
- none: false
162
142
  requirements:
163
- - - ! '>='
143
+ - - '>='
164
144
  - !ruby/object:Gem::Version
165
145
  version: 0.4.0
166
146
  type: :development
167
147
  prerelease: false
168
148
  version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
149
  requirements:
171
- - - ! '>='
150
+ - - '>='
172
151
  - !ruby/object:Gem::Version
173
152
  version: 0.4.0
174
153
  - !ruby/object:Gem::Dependency
175
154
  name: yard
176
155
  requirement: !ruby/object:Gem::Requirement
177
- none: false
178
156
  requirements:
179
- - - ! '>='
157
+ - - '>='
180
158
  - !ruby/object:Gem::Version
181
159
  version: 0.7.0
182
160
  type: :development
183
161
  prerelease: false
184
162
  version_requirements: !ruby/object:Gem::Requirement
185
- none: false
186
163
  requirements:
187
- - - ! '>='
164
+ - - '>='
188
165
  - !ruby/object:Gem::Version
189
166
  version: 0.7.0
190
- description: ! 'tailor parses Ruby files and measures them with some style and static
191
- analysis
192
-
167
+ description: |
168
+ tailor parses Ruby files and measures them with some style and static analysis
193
169
  "rulers". Default values for the Rulers are based on a number of style guides
194
-
195
170
  in the Ruby community as well as what seems to be common. More on this here
196
-
197
171
  http://wiki.github.com/turboladen/tailor.
198
172
 
199
-
200
- tailor''s goal is to help you be consistent with your code, throughout your
201
-
173
+ tailor's goal is to help you be consistent with your code, throughout your
202
174
  project, whatever style that may be.
203
-
204
- '
205
175
  email: steve.loveless@gmail.com
206
176
  executables:
207
177
  - tailor
@@ -244,6 +214,7 @@ files:
244
214
  - lib/tailor/critic.rb
245
215
  - lib/tailor/formatter.rb
246
216
  - lib/tailor/formatters/text.rb
217
+ - lib/tailor/formatters/yaml.rb
247
218
  - lib/tailor/lexed_line.rb
248
219
  - lib/tailor/lexer.rb
249
220
  - lib/tailor/lexer/lexer_constants.rb
@@ -311,6 +282,7 @@ files:
311
282
  - spec/unit/tailor/configuration_spec.rb
312
283
  - spec/unit/tailor/critic_spec.rb
313
284
  - spec/unit/tailor/formatter_spec.rb
285
+ - spec/unit/tailor/formatters/yaml_spec.rb
314
286
  - spec/unit/tailor/lexed_line_spec.rb
315
287
  - spec/unit/tailor/lexer/token_spec.rb
316
288
  - spec/unit/tailor/lexer_spec.rb
@@ -330,27 +302,26 @@ files:
330
302
  - tailor.gemspec
331
303
  homepage: http://github.com/turboladen/tailor
332
304
  licenses: []
305
+ metadata: {}
333
306
  post_install_message:
334
307
  rdoc_options: []
335
308
  require_paths:
336
309
  - lib
337
310
  required_ruby_version: !ruby/object:Gem::Requirement
338
- none: false
339
311
  requirements:
340
- - - ! '>='
312
+ - - '>='
341
313
  - !ruby/object:Gem::Version
342
314
  version: '0'
343
315
  required_rubygems_version: !ruby/object:Gem::Requirement
344
- none: false
345
316
  requirements:
346
- - - ! '>='
317
+ - - '>='
347
318
  - !ruby/object:Gem::Version
348
319
  version: '0'
349
320
  requirements: []
350
321
  rubyforge_project:
351
- rubygems_version: 1.8.23
322
+ rubygems_version: 2.0.0
352
323
  signing_key:
353
- specification_version: 3
324
+ specification_version: 4
354
325
  summary: A Ruby style & complexity measurer
355
326
  test_files:
356
327
  - features/configurable.feature
@@ -397,6 +368,7 @@ test_files:
397
368
  - spec/unit/tailor/configuration_spec.rb
398
369
  - spec/unit/tailor/critic_spec.rb
399
370
  - spec/unit/tailor/formatter_spec.rb
371
+ - spec/unit/tailor/formatters/yaml_spec.rb
400
372
  - spec/unit/tailor/lexed_line_spec.rb
401
373
  - spec/unit/tailor/lexer/token_spec.rb
402
374
  - spec/unit/tailor/lexer_spec.rb