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.
- data/History.txt +8 -0
- data/Manifest.txt +22 -2
- data/PostInstall.txt +4 -0
- data/README.rdoc +7 -6
- data/Rakefile +7 -1
- data/bin/tailor +21 -5
- data/features/indentation.feature +22 -0
- data/features/spacing.feature +13 -18
- data/features/spacing/commas.feature +44 -0
- data/features/step_definitions/indentation_steps.rb +139 -0
- data/features/step_definitions/spacing/commas_steps.rb +14 -0
- data/features/step_definitions/spacing_steps.rb +1 -36
- data/features/support/1_file_with_bad_comma_spacing/bad_comma_spacing.rb +43 -5
- data/features/support/1_file_with_bad_curly_brace_spacing/bad_curly_brace_spacing.rb +60 -0
- data/features/support/1_file_with_bad_operator_spacing/bad_op_spacing.rb +31 -0
- data/features/support/1_file_with_bad_parenthesis/bad_parenthesis.rb +1 -3
- data/features/support/1_file_with_bad_square_brackets/bad_square_brackets.rb +62 -0
- data/features/support/1_file_with_bad_ternary_colon_spacing/bad_ternary_colon_spacing.rb +31 -0
- data/features/support/1_good_simple_file/simple_project.rb +5 -0
- data/features/support/1_long_file_with_indentation/my_project.rb +56 -0
- data/features/support/common.rb +74 -1
- data/features/support/env.rb +3 -1
- data/features/support/world.rb +0 -52
- data/lib/tailor.rb +132 -41
- data/lib/tailor/file_line.rb +66 -177
- data/lib/tailor/indentation.rb +251 -0
- data/lib/tailor/spacing.rb +243 -0
- data/lib/tasks/metrics.rake +23 -0
- data/lib/tasks/stats.rake +11 -0
- data/logic.txt +30 -0
- data/ruby-style-checker.rb +77 -46
- data/spec/file_line_spec.rb +18 -193
- data/spec/indentation_spec.rb +259 -0
- data/spec/spacing/colon_spacing_spec.rb +71 -0
- data/spec/spacing/comma_spacing_spec.rb +159 -0
- data/spec/spacing/curly_brace_spacing_spec.rb +258 -0
- data/spec/spacing/parentheses_spacing_spec.rb +28 -0
- data/spec/spacing/square_bracket_spacing_spec.rb +116 -0
- data/spec/spacing_spec.rb +167 -0
- data/spec/spec_helper.rb +4 -0
- data/spec/tailor_spec.rb +2 -2
- metadata +73 -38
- data/features/support/1_good_simple_file/my_project.rb +0 -7
- data/lib/tailor/indentation_checker.rb +0 -27
data/spec/spec_helper.rb
CHANGED
data/spec/tailor_spec.rb
CHANGED
@@ -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 '
|
6
|
-
filenames = Dir.glob '
|
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
|
-
|
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-
|
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: &
|
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: *
|
36
|
+
version_requirements: *id001
|
48
37
|
- !ruby/object:Gem::Dependency
|
49
38
|
name: rspec
|
50
39
|
prerelease: false
|
51
|
-
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: *
|
50
|
+
version_requirements: *id002
|
60
51
|
- !ruby/object:Gem::Dependency
|
61
52
|
name: yard
|
62
53
|
prerelease: false
|
63
|
-
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: *
|
66
|
+
version_requirements: *id003
|
74
67
|
- !ruby/object:Gem::Dependency
|
75
68
|
name: hoe-yard
|
76
69
|
prerelease: false
|
77
|
-
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: *
|
82
|
+
version_requirements: *id004
|
88
83
|
- !ruby/object:Gem::Dependency
|
89
84
|
name: cucumber
|
90
85
|
prerelease: false
|
91
|
-
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: *
|
98
|
+
version_requirements: *id005
|
102
99
|
- !ruby/object:Gem::Dependency
|
103
100
|
name: hoe
|
104
101
|
prerelease: false
|
105
|
-
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
|
-
-
|
113
|
-
version: 2.6.
|
111
|
+
- 1
|
112
|
+
version: 2.6.1
|
114
113
|
type: :development
|
115
|
-
version_requirements: *
|
114
|
+
version_requirements: *id006
|
116
115
|
description: |+
|
117
|
-
tailor
|
118
|
-
|
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/
|
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/
|
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
|
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.
|
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,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
|