tailor 0.0.3 → 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 (44) hide show
  1. data/History.txt +8 -0
  2. data/Manifest.txt +22 -2
  3. data/PostInstall.txt +4 -0
  4. data/README.rdoc +7 -6
  5. data/Rakefile +7 -1
  6. data/bin/tailor +21 -5
  7. data/features/indentation.feature +22 -0
  8. data/features/spacing.feature +13 -18
  9. data/features/spacing/commas.feature +44 -0
  10. data/features/step_definitions/indentation_steps.rb +139 -0
  11. data/features/step_definitions/spacing/commas_steps.rb +14 -0
  12. data/features/step_definitions/spacing_steps.rb +1 -36
  13. data/features/support/1_file_with_bad_comma_spacing/bad_comma_spacing.rb +43 -5
  14. data/features/support/1_file_with_bad_curly_brace_spacing/bad_curly_brace_spacing.rb +60 -0
  15. data/features/support/1_file_with_bad_operator_spacing/bad_op_spacing.rb +31 -0
  16. data/features/support/1_file_with_bad_parenthesis/bad_parenthesis.rb +1 -3
  17. data/features/support/1_file_with_bad_square_brackets/bad_square_brackets.rb +62 -0
  18. data/features/support/1_file_with_bad_ternary_colon_spacing/bad_ternary_colon_spacing.rb +31 -0
  19. data/features/support/1_good_simple_file/simple_project.rb +5 -0
  20. data/features/support/1_long_file_with_indentation/my_project.rb +56 -0
  21. data/features/support/common.rb +74 -1
  22. data/features/support/env.rb +3 -1
  23. data/features/support/world.rb +0 -52
  24. data/lib/tailor.rb +132 -41
  25. data/lib/tailor/file_line.rb +66 -177
  26. data/lib/tailor/indentation.rb +251 -0
  27. data/lib/tailor/spacing.rb +243 -0
  28. data/lib/tasks/metrics.rake +23 -0
  29. data/lib/tasks/stats.rake +11 -0
  30. data/logic.txt +30 -0
  31. data/ruby-style-checker.rb +77 -46
  32. data/spec/file_line_spec.rb +18 -193
  33. data/spec/indentation_spec.rb +259 -0
  34. data/spec/spacing/colon_spacing_spec.rb +71 -0
  35. data/spec/spacing/comma_spacing_spec.rb +159 -0
  36. data/spec/spacing/curly_brace_spacing_spec.rb +258 -0
  37. data/spec/spacing/parentheses_spacing_spec.rb +28 -0
  38. data/spec/spacing/square_bracket_spacing_spec.rb +116 -0
  39. data/spec/spacing_spec.rb +167 -0
  40. data/spec/spec_helper.rb +4 -0
  41. data/spec/tailor_spec.rb +2 -2
  42. metadata +73 -38
  43. data/features/support/1_good_simple_file/my_project.rb +0 -7
  44. data/lib/tailor/indentation_checker.rb +0 -27
@@ -8,3 +8,7 @@ end
8
8
 
9
9
  $:.unshift(File.dirname(__FILE__) + '/../lib')
10
10
  require 'tailor'
11
+
12
+ def create_file_line(string, line_number)
13
+ FileLine.new(string, Pathname.new(__FILE__), line_number)
14
+ end
@@ -2,8 +2,8 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
2
2
 
3
3
  describe Kernel do
4
4
  def self.get_requires
5
- Dir.chdir '../lib'
6
- filenames = Dir.glob 'Tailor/*.rb'
5
+ Dir.chdir File.expand_path(File.dirname(__FILE__)) + '/../lib'
6
+ filenames = Dir.glob 'tailor/*.rb'
7
7
  requires = filenames.each do |fn|
8
8
  fn.chomp!(File.extname(fn))
9
9
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tailor
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 27
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
8
+ - 1
7
9
  - 0
8
- - 3
9
- version: 0.0.3
10
+ version: 0.1.0
10
11
  platform: ruby
11
12
  authors:
12
13
  - Steve Loveless
@@ -14,109 +15,106 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-04-26 00:00:00 -07:00
18
+ date: 2010-06-28 00:00:00 -07:00
18
19
  default_executable:
19
20
  dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: rubyforge
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 2
29
- - 0
30
- - 4
31
- version: 2.0.4
32
- type: :development
33
- version_requirements: *id001
34
21
  - !ruby/object:Gem::Dependency
35
22
  name: hoe-yard
36
23
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
38
26
  requirements:
39
27
  - - ">="
40
28
  - !ruby/object:Gem::Version
29
+ hash: 31
41
30
  segments:
42
31
  - 0
43
32
  - 1
44
33
  - 2
45
34
  version: 0.1.2
46
35
  type: :development
47
- version_requirements: *id002
36
+ version_requirements: *id001
48
37
  - !ruby/object:Gem::Dependency
49
38
  name: rspec
50
39
  prerelease: false
51
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
52
42
  requirements:
53
43
  - - ">="
54
44
  - !ruby/object:Gem::Version
45
+ hash: 3
55
46
  segments:
56
47
  - 0
57
48
  version: "0"
58
49
  type: :development
59
- version_requirements: *id003
50
+ version_requirements: *id002
60
51
  - !ruby/object:Gem::Dependency
61
52
  name: yard
62
53
  prerelease: false
63
- requirement: &id004 !ruby/object:Gem::Requirement
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
64
56
  requirements:
65
57
  - - ">="
66
58
  - !ruby/object:Gem::Version
59
+ hash: 13
67
60
  segments:
68
61
  - 0
69
62
  - 5
70
63
  - 3
71
64
  version: 0.5.3
72
65
  type: :development
73
- version_requirements: *id004
66
+ version_requirements: *id003
74
67
  - !ruby/object:Gem::Dependency
75
68
  name: hoe-yard
76
69
  prerelease: false
77
- requirement: &id005 !ruby/object:Gem::Requirement
70
+ requirement: &id004 !ruby/object:Gem::Requirement
71
+ none: false
78
72
  requirements:
79
73
  - - ">="
80
74
  - !ruby/object:Gem::Version
75
+ hash: 31
81
76
  segments:
82
77
  - 0
83
78
  - 1
84
79
  - 2
85
80
  version: 0.1.2
86
81
  type: :development
87
- version_requirements: *id005
82
+ version_requirements: *id004
88
83
  - !ruby/object:Gem::Dependency
89
84
  name: cucumber
90
85
  prerelease: false
91
- requirement: &id006 !ruby/object:Gem::Requirement
86
+ requirement: &id005 !ruby/object:Gem::Requirement
87
+ none: false
92
88
  requirements:
93
89
  - - ">="
94
90
  - !ruby/object:Gem::Version
91
+ hash: 1
95
92
  segments:
96
93
  - 0
97
94
  - 6
98
95
  - 3
99
96
  version: 0.6.3
100
97
  type: :development
101
- version_requirements: *id006
98
+ version_requirements: *id005
102
99
  - !ruby/object:Gem::Dependency
103
100
  name: hoe
104
101
  prerelease: false
105
- requirement: &id007 !ruby/object:Gem::Requirement
102
+ requirement: &id006 !ruby/object:Gem::Requirement
103
+ none: false
106
104
  requirements:
107
105
  - - ">="
108
106
  - !ruby/object:Gem::Version
107
+ hash: 21
109
108
  segments:
110
109
  - 2
111
110
  - 6
112
- - 0
113
- version: 2.6.0
111
+ - 1
112
+ version: 2.6.1
114
113
  type: :development
115
- version_requirements: *id007
114
+ version_requirements: *id006
116
115
  description: |+
117
- tailor is an executable that recursively parses Ruby files in a
118
- directory and checks them for bad style. Rules for judging style are based on
119
- a number of style guides that are popular in the Ruby community. More on this
116
+ tailor recursively parses Ruby files in a directory and checks them for bad
117
+ style. Rules for judging style are based on a number of style guides that are popular in the Ruby community. More on this
120
118
  here http://wiki.github.com/turboladen/tailor.
121
119
 
122
120
  email:
@@ -129,6 +127,7 @@ extra_rdoc_files:
129
127
  - History.txt
130
128
  - Manifest.txt
131
129
  - PostInstall.txt
130
+ - logic.txt
132
131
  files:
133
132
  - .autotest
134
133
  - History.txt
@@ -139,12 +138,20 @@ files:
139
138
  - bin/tailor
140
139
  - features/case_checking.feature
141
140
  - features/development.feature
141
+ - features/indentation.feature
142
142
  - features/spacing.feature
143
+ - features/spacing/commas.feature
143
144
  - features/step_definitions/case_checking_steps.rb
144
145
  - features/step_definitions/common_steps.rb
146
+ - features/step_definitions/indentation_steps.rb
147
+ - features/step_definitions/spacing/commas_steps.rb
145
148
  - features/step_definitions/spacing_steps.rb
146
149
  - features/support/1_file_with_bad_comma_spacing/bad_comma_spacing.rb
150
+ - features/support/1_file_with_bad_curly_brace_spacing/bad_curly_brace_spacing.rb
151
+ - features/support/1_file_with_bad_operator_spacing/bad_op_spacing.rb
147
152
  - features/support/1_file_with_bad_parenthesis/bad_parenthesis.rb
153
+ - features/support/1_file_with_bad_square_brackets/bad_square_brackets.rb
154
+ - features/support/1_file_with_bad_ternary_colon_spacing/bad_ternary_colon_spacing.rb
148
155
  - features/support/1_file_with_camel_case_class/camel_case_class.rb
149
156
  - features/support/1_file_with_camel_case_method/camel_case_method.rb
150
157
  - features/support/1_file_with_hard_tabs/hard_tab.rb
@@ -152,19 +159,31 @@ files:
152
159
  - features/support/1_file_with_snake_case_class/snake_case_class.rb
153
160
  - features/support/1_file_with_snake_case_method/snake_case_method.rb
154
161
  - features/support/1_file_with_trailing_whitespace/trailing_whitespace.rb
155
- - features/support/1_good_simple_file/my_project.rb
162
+ - features/support/1_good_simple_file/simple_project.rb
163
+ - features/support/1_long_file_with_indentation/my_project.rb
156
164
  - features/support/common.rb
157
165
  - features/support/env.rb
158
166
  - features/support/matchers.rb
159
167
  - features/support/world.rb
160
168
  - lib/tailor.rb
161
169
  - lib/tailor/file_line.rb
162
- - lib/tailor/indentation_checker.rb
170
+ - lib/tailor/indentation.rb
171
+ - lib/tailor/spacing.rb
172
+ - lib/tasks/metrics.rake
173
+ - lib/tasks/stats.rake
174
+ - logic.txt
163
175
  - ruby-style-checker.rb
164
176
  - script/console
165
177
  - script/destroy
166
178
  - script/generate
167
179
  - spec/file_line_spec.rb
180
+ - spec/indentation_spec.rb
181
+ - spec/spacing/colon_spacing_spec.rb
182
+ - spec/spacing/comma_spacing_spec.rb
183
+ - spec/spacing/curly_brace_spacing_spec.rb
184
+ - spec/spacing/parentheses_spacing_spec.rb
185
+ - spec/spacing/square_bracket_spacing_spec.rb
186
+ - spec/spacing_spec.rb
168
187
  - spec/spec.opts
169
188
  - spec/spec_helper.rb
170
189
  - spec/tailor_spec.rb
@@ -177,6 +196,16 @@ post_install_message:
177
196
  - |
178
197
 
179
198
 
199
+ - |
200
+ Thanks for checking out Tailor. To run, simply do:
201
+
202
+ - " # tailor [directory to check]\n"
203
+ - |
204
+
205
+
206
+ - |
207
+
208
+
180
209
  - |
181
210
  For more information on tailor, see http://github.com/turboladen/tailor
182
211
 
@@ -192,33 +221,39 @@ rdoc_options:
192
221
  - - Manifest.txt
193
222
  - History.txt
194
223
  - --title
195
- - tailor Documentation (0.0.3)
224
+ - tailor Documentation (0.1.0)
196
225
  - --markup
197
226
  - :rdoc
198
227
  require_paths:
199
228
  - lib
200
229
  required_ruby_version: !ruby/object:Gem::Requirement
230
+ none: false
201
231
  requirements:
202
232
  - - ">="
203
233
  - !ruby/object:Gem::Version
234
+ hash: 3
204
235
  segments:
205
236
  - 0
206
237
  version: "0"
207
238
  required_rubygems_version: !ruby/object:Gem::Requirement
239
+ none: false
208
240
  requirements:
209
241
  - - ">="
210
242
  - !ruby/object:Gem::Version
243
+ hash: 3
211
244
  segments:
212
245
  - 0
213
246
  version: "0"
214
247
  requirements: []
215
248
 
216
249
  rubyforge_project: tailor
217
- rubygems_version: 1.3.6
250
+ rubygems_version: 1.3.7
218
251
  signing_key:
219
252
  specification_version: 3
220
253
  summary: Utility for checking style of Ruby files.
221
254
  test_files:
222
255
  - spec/file_line_spec.rb
256
+ - spec/indentation_spec.rb
257
+ - spec/spacing_spec.rb
223
258
  - spec/spec_helper.rb
224
259
  - spec/tailor_spec.rb
@@ -1,7 +0,0 @@
1
- # This file contains 1 method, no class, and is properly indented
2
- # in order to test a related scenario.
3
- def a_method
4
- an_array = Array.new
5
- a_hash = Hash.new
6
- end
7
-
@@ -1,27 +0,0 @@
1
- module Tailor
2
- module IndentationChecker
3
- def validate_indentation file
4
- results = Array.new
5
-
6
- source = File.open(file, 'r')
7
-
8
- # Start the line number at 1, not 0
9
- line_number = 1
10
-
11
- source.each_line do |line_of_code|
12
- line = FileLine.new(line_of_code)
13
-
14
- # Make sure the line isn't hard-tabbed
15
- #if line.soft_tabbed?
16
- # results << "Line #{line_number} is hard-tabbed."
17
- #end
18
-
19
- # Check for indentation
20
- #spaces = line.indented_spaces
21
- #current_depth_level = spaces / 2
22
-
23
- line_number =+ 1
24
- end
25
- end
26
- end
27
- end