tailor 0.1.5 → 1.0.0.alpha

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 (124) hide show
  1. data/.gitignore +9 -1
  2. data/.rspec +2 -1
  3. data/.tailor +6 -0
  4. data/Gemfile.lock +47 -78
  5. data/{ChangeLog.rdoc → History.rdoc} +0 -0
  6. data/README.rdoc +157 -24
  7. data/Rakefile +0 -9
  8. data/bin/tailor +16 -69
  9. data/features/configurable.feature +78 -0
  10. data/features/horizontal_spacing.feature +262 -0
  11. data/features/indentation.feature +17 -21
  12. data/features/indentation/bad_files_with_no_trailing_newline.feature +90 -0
  13. data/features/indentation/good_files_with_no_trailing_newline.feature +206 -0
  14. data/features/name_detection.feature +72 -0
  15. data/features/step_definitions/indentation_steps.rb +10 -133
  16. data/features/support/env.rb +7 -15
  17. data/features/support/file_cases/horizontal_spacing_cases.rb +265 -0
  18. data/features/support/file_cases/indentation_cases.rb +972 -0
  19. data/features/support/file_cases/naming_cases.rb +52 -0
  20. data/features/support/file_cases/vertical_spacing_cases.rb +70 -0
  21. data/features/support/hooks.rb +8 -0
  22. data/features/support/{1_file_with_bad_operator_spacing → legacy}/bad_op_spacing.rb +0 -0
  23. data/features/support/{1_file_with_bad_ternary_colon_spacing → legacy}/bad_ternary_colon_spacing.rb +0 -0
  24. data/features/support/{1_long_file_with_indentation/my_project.rb → legacy/long_file_with_indentation.rb} +1 -1
  25. data/features/support/world.rb +14 -0
  26. data/features/vertical_spacing.feature +114 -0
  27. data/lib/ext/string_ext.rb +5 -0
  28. data/lib/tailor.rb +6 -252
  29. data/lib/tailor/cli.rb +49 -0
  30. data/lib/tailor/cli/options.rb +251 -0
  31. data/lib/tailor/composite_observable.rb +56 -0
  32. data/lib/tailor/configuration.rb +263 -0
  33. data/lib/tailor/critic.rb +162 -0
  34. data/lib/tailor/formatters/text.rb +126 -0
  35. data/lib/tailor/lexed_line.rb +246 -0
  36. data/lib/tailor/lexer.rb +428 -0
  37. data/lib/tailor/lexer/token.rb +103 -0
  38. data/lib/tailor/lexer_constants.rb +75 -0
  39. data/lib/tailor/logger.rb +28 -0
  40. data/lib/tailor/problem.rb +100 -0
  41. data/lib/tailor/reporter.rb +48 -0
  42. data/lib/tailor/ruler.rb +39 -0
  43. data/lib/tailor/rulers.rb +7 -0
  44. data/lib/tailor/rulers/allow_camel_case_methods_ruler.rb +30 -0
  45. data/lib/tailor/rulers/allow_hard_tabs_ruler.rb +22 -0
  46. data/lib/tailor/rulers/allow_screaming_snake_case_classes_ruler.rb +32 -0
  47. data/lib/tailor/rulers/allow_trailing_line_spaces_ruler.rb +33 -0
  48. data/lib/tailor/rulers/indentation_spaces_ruler.rb +199 -0
  49. data/lib/tailor/rulers/indentation_spaces_ruler/indentation_manager.rb +362 -0
  50. data/lib/tailor/rulers/max_code_lines_in_class_ruler.rb +84 -0
  51. data/lib/tailor/rulers/max_code_lines_in_method_ruler.rb +84 -0
  52. data/lib/tailor/rulers/max_line_length_ruler.rb +31 -0
  53. data/lib/tailor/rulers/spaces_after_comma_ruler.rb +83 -0
  54. data/lib/tailor/rulers/spaces_after_lbrace_ruler.rb +114 -0
  55. data/lib/tailor/rulers/spaces_after_lbracket_ruler.rb +123 -0
  56. data/lib/tailor/rulers/spaces_after_lparen_ruler.rb +116 -0
  57. data/lib/tailor/rulers/spaces_before_comma_ruler.rb +67 -0
  58. data/lib/tailor/rulers/spaces_before_lbrace_ruler.rb +93 -0
  59. data/lib/tailor/rulers/spaces_before_rbrace_ruler.rb +98 -0
  60. data/lib/tailor/rulers/spaces_before_rbracket_ruler.rb +70 -0
  61. data/lib/tailor/rulers/spaces_before_rparen_ruler.rb +70 -0
  62. data/lib/tailor/rulers/spaces_in_empty_braces_ruler.rb +94 -0
  63. data/lib/tailor/rulers/trailing_newlines_ruler.rb +36 -0
  64. data/lib/tailor/runtime_error.rb +3 -0
  65. data/lib/tailor/tailorrc.erb +88 -0
  66. data/lib/tailor/version.rb +2 -2
  67. data/spec/spec_helper.rb +7 -5
  68. data/spec/tailor/cli_spec.rb +94 -0
  69. data/spec/tailor/configuration_spec.rb +147 -0
  70. data/spec/tailor/critic_spec.rb +63 -0
  71. data/spec/tailor/lexed_line_spec.rb +569 -0
  72. data/spec/tailor/lexer/token_spec.rb +46 -0
  73. data/spec/tailor/lexer_spec.rb +181 -0
  74. data/spec/tailor/options_spec.rb +6 -0
  75. data/spec/tailor/problem_spec.rb +74 -0
  76. data/spec/tailor/reporter_spec.rb +53 -0
  77. data/spec/tailor/ruler_spec.rb +56 -0
  78. data/spec/tailor/rulers/indentation_spaces_ruler/indentation_manager_spec.rb +454 -0
  79. data/spec/tailor/rulers/indentation_spaces_ruler_spec.rb +128 -0
  80. data/spec/tailor/rulers/spaces_after_comma_spec.rb +31 -0
  81. data/spec/tailor/rulers/spaces_after_lbrace_ruler_spec.rb +145 -0
  82. data/spec/tailor/rulers/spaces_before_lbrace_ruler_spec.rb +63 -0
  83. data/spec/tailor/rulers/spaces_before_rbrace_ruler_spec.rb +63 -0
  84. data/spec/tailor/rulers_spec.rb +9 -0
  85. data/spec/tailor/version_spec.rb +6 -0
  86. data/spec/tailor_spec.rb +9 -21
  87. data/tailor.gemspec +22 -35
  88. data/tasks/features.rake +7 -0
  89. data/tasks/roodi.rake +9 -0
  90. data/tasks/roodi_config.yaml +14 -0
  91. data/tasks/spec.rake +16 -0
  92. data/tasks/yard.rake +14 -0
  93. metadata +224 -77
  94. data/features/case_checking.feature +0 -38
  95. data/features/spacing.feature +0 -97
  96. data/features/spacing/commas.feature +0 -44
  97. data/features/step_definitions/case_checking_steps.rb +0 -42
  98. data/features/step_definitions/spacing_steps.rb +0 -156
  99. data/features/support/1_file_with_bad_comma_spacing/bad_comma_spacing.rb +0 -43
  100. data/features/support/1_file_with_bad_curly_brace_spacing/bad_curly_brace_spacing.rb +0 -60
  101. data/features/support/1_file_with_bad_parenthesis/bad_parenthesis.rb +0 -4
  102. data/features/support/1_file_with_bad_square_brackets/bad_square_brackets.rb +0 -62
  103. data/features/support/1_file_with_camel_case_class/camel_case_class.rb +0 -5
  104. data/features/support/1_file_with_camel_case_method/camel_case_method.rb +0 -3
  105. data/features/support/1_file_with_hard_tabs/hard_tab.rb +0 -3
  106. data/features/support/1_file_with_long_lines/long_lines.rb +0 -5
  107. data/features/support/1_file_with_snake_case_class/snake_case_class.rb +0 -5
  108. data/features/support/1_file_with_snake_case_method/snake_case_method.rb +0 -3
  109. data/features/support/1_file_with_trailing_whitespace/trailing_whitespace.rb +0 -5
  110. data/features/support/1_good_simple_file/simple_project.rb +0 -5
  111. data/features/support/common.rb +0 -102
  112. data/features/support/matchers.rb +0 -11
  113. data/lib/tailor/file_line.rb +0 -220
  114. data/lib/tailor/indentation.rb +0 -245
  115. data/lib/tailor/spacing.rb +0 -237
  116. data/spec/file_line_spec.rb +0 -70
  117. data/spec/indentation_spec.rb +0 -259
  118. data/spec/spacing/colon_spacing_spec.rb +0 -71
  119. data/spec/spacing/comma_spacing_spec.rb +0 -159
  120. data/spec/spacing/curly_brace_spacing_spec.rb +0 -257
  121. data/spec/spacing/parentheses_spacing_spec.rb +0 -28
  122. data/spec/spacing/square_bracket_spacing_spec.rb +0 -116
  123. data/spec/spacing_spec.rb +0 -167
  124. data/tasks/metrics.rake +0 -23
@@ -1,38 +0,0 @@
1
- Feature: Case checking
2
- In order to make sure certain words are upper or lower case as they should be
3
- As a Ruby developer
4
- I want to find out which files have words that aren't in the proper case
5
-
6
- Scenario: Method names that are camel-cased are detected
7
- Given I have a project directory "1_file_with_camel_case_method"
8
- And I have "1" file in my project
9
- And that file does not contain any "class" statements
10
- And the file contains only "1" "def" statement
11
- And the file contains a "method" that has a camel-cased name
12
- When I run the checker on the project
13
- Then the checker should tell me I have a camel-cased method name
14
-
15
- Scenario: Method names that are snake-cased are not reported
16
- Given I have a project directory "1_file_with_snake_case_method"
17
- And I have "1" file in my project
18
- And that file does not contain any "class" statements
19
- And the file contains only "1" "def" statement
20
- And the file contains a "method" that has a snake-cased name
21
- When I run the checker on the project
22
- Then the checker shouldn't tell me the method name is camel-case
23
-
24
- Scenario: Class names that are camel-cased are not reported
25
- Given I have a project directory "1_file_with_camel_case_class"
26
- And I have "1" file in my project
27
- And the file contains only "1" "class" statement
28
- And the file contains a "class" that has a camel-cased name
29
- When I run the checker on the project
30
- Then the checker shouldn't tell me the class name is camel-case
31
-
32
- Scenario: Class names that are snake-cased are detected
33
- Given I have a project directory "1_file_with_snake_case_class"
34
- And I have "1" file in my project
35
- And the file contains only "1" "class" statement
36
- And the file contains a "class" that has a snake-cased name
37
- When I run the checker on the project
38
- Then the checker should tell me the class name is not camel-case
@@ -1,97 +0,0 @@
1
- Feature: Spacing
2
- In order to determine if my Ruby file is spaced according to
3
- standards
4
- As a Ruby developer
5
- I want to find out which files have spacing problems,
6
- which lines those problems occur on,
7
- and what type of spacing they're missing
8
-
9
- Scenario: A single class-less file with hard tabs
10
- Given I have a project directory "1_file_with_hard_tabs"
11
- And I have 1 file in my project
12
- And that file does not contain any "class" statements
13
- And the file contains only 1 "def" statement
14
- And that file contains lines with hard tabs
15
- When I run the checker on the project
16
- Then the checker should tell me each line that has a hard tab
17
-
18
- Scenario: A single file that has all lines with trailing whitespace
19
- Given I have a project directory "1_file_with_trailing_whitespace"
20
- And I have 1 file in my project
21
- And that file contains lines with trailing whitespace
22
- When I run the checker on the project
23
- Then the checker should tell me each line has trailing whitespace
24
-
25
- Scenario: A single file that has a comment and a code line 90 characters long
26
- Given I have a project directory "1_file_with_long_lines"
27
- And I have 1 file in my project
28
- And that file contains lines longer than 80 characters
29
- When I run the checker on the project
30
- Then the checker should tell me each line is too long
31
-
32
- Scenario: A single file that has a comment, method name, and statement without spaces after the commas
33
- Given I have a project directory "1_file_with_bad_comma_spacing"
34
- And I have 1 file in my project
35
- And that file contains a "comment" line without spaces after commas
36
- And that file contains a "method" line without spaces after commas
37
- And that file contains a "statement" line without spaces after commas
38
- When I run the checker on the project
39
- Then the checker should tell me each line has commas without spaces after them
40
-
41
- Scenario: A single file that has a comment, method name, and statement with > 1 spaces after the commas
42
- Given I have a project directory "1_file_with_bad_comma_spacing"
43
- And I have 1 file in my project
44
- And that file contains a "comment" line with > 1 spaces after commas
45
- And that file contains a "method" line with > 1 spaces after commas
46
- And that file contains a "statement" line with > 1 spaces after commas
47
- When I run the checker on the project
48
- Then the checker should tell me each line has commas with > 1 spaces after them
49
-
50
- Scenario: A single file that has a comment, method name, and statement with spaces before the commas
51
- Given I have a project directory "1_file_with_bad_comma_spacing"
52
- And I have 1 file in my project
53
- And that file contains a "comment" line with spaces before commas
54
- And that file contains a "method" line with spaces before commas
55
- And that file contains a "statement" line with spaces before commas
56
- When I run the checker on the project
57
- Then the checker should tell me each line has commas with spaces before them
58
-
59
- Scenario: A single file that has a comment, method, and statement with spaces after open parentheses
60
- Given I have a project directory "1_file_with_bad_parenthesis"
61
- And I have 1 file in my project
62
- And that file contains a "comment" line with spaces after an open parenthesis
63
- And that file contains a "method" line with spaces after an open parenthesis
64
- And that file contains a "statement" line with spaces after an open parenthesis
65
- When I run the checker on the project
66
- Then the checker should tell me each line has open parentheses with spaces before them
67
-
68
- Scenario: A single file that has a comment, method, and statement with spaces after open brackets
69
- Given I have a project directory "1_file_with_bad_parenthesis"
70
- And I have 1 file in my project
71
- And that file contains a "comment" line with spaces after an open bracket
72
- And that file contains a "method" line with spaces after an open bracket
73
- And that file contains a "statement" line with spaces after an open bracket
74
- When I run the checker on the project
75
- Then the checker should tell me each line has open brackets with spaces before them
76
-
77
- Scenario: A single file that has a comment, method, and statement with spaces before closed parentheses
78
- Given I have a project directory "1_file_with_bad_parenthesis"
79
- And I have 1 file in my project
80
- And that file contains a "comment" line with spaces after an open parenthesis
81
- And that file contains a "method" line with spaces after an open parenthesis
82
- And that file contains a "statement" line with spaces after an open parenthesis
83
- When I run the checker on the project
84
- Then the checker should tell me each line has closed parentheses with spaces before them
85
-
86
- Scenario: A single file that has a comment, method, and statement with spaces before closed brackets
87
- Given I have a project directory "1_file_with_bad_parenthesis"
88
- And I have 1 file in my project
89
- And that file contains a "comment" line with spaces after an open bracket
90
- And that file contains a "method" line with spaces after an open bracket
91
- And that file contains a "statement" line with spaces after an open bracket
92
- When I run the checker on the project
93
- Then the checker should tell me each line has closed brackets with spaces before them
94
-
95
- Scenario: A single file that has a comment, method, and statement with each operator
96
- Given I have a project directory "1_file_with_bad_operator_spacing"
97
- And I have 1 file in my project
@@ -1,44 +0,0 @@
1
- Feature: Detect bad spacing around commas
2
- As a Ruby developer
3
- I want to detect bad spacing around commas in my code
4
- So that it's easy to read and maintain
5
-
6
- Scenario: More than 1 space after a comma
7
- Given a file with 1 space after a comma in a:
8
- | Type |
9
- | comment |
10
- | method |
11
- | Array |
12
- | Hash |
13
-
14
- Scenario: 0 spaces after a comma
15
- Given a file with 0 spaces after a comma in a:
16
- | Type |
17
- | comment |
18
- | method |
19
- | Array |
20
- | Hash |
21
-
22
- Scenario: 1 space after a comma
23
- Given a file with 1 space after a comma in a:
24
- | Type |
25
- | comment |
26
- | method |
27
- | Array |
28
- | Hash |
29
-
30
- Scenario: More than 0 spaces before a comma
31
- Given a file with more than 0 spaces before a comma in a:
32
- | Type |
33
- | comment |
34
- | method |
35
- | Array |
36
- | Hash |
37
-
38
- Scenario: 0 spaces before a comma
39
- Given a file with 0 spaces before a comma in a:
40
- | Type |
41
- | comment |
42
- | method |
43
- | Array |
44
- | Hash |
@@ -1,42 +0,0 @@
1
- require 'tailor/file_line'
2
-
3
- def contains_camel_case? keyword
4
- @ruby_source = File.open(@file_list[0], 'r')
5
-
6
- contains_camel_case = false
7
- @ruby_source.each_line do |source_line|
8
- line = FileLine.new source_line
9
-
10
- if keyword.eql? "method"
11
- line.snake_case_method? ? (return false) : (return false)
12
- elsif keyword.eql? "class"
13
- line.camel_case_class? ? (return true) : (return false)
14
- end
15
- end
16
- end
17
-
18
- Given /^the file contains a "([^\"]*)" that has a camel\-cased name$/ do
19
- |keyword|
20
- contains_camel_case?(keyword).should be_true
21
- end
22
-
23
- Given /^the file contains a "([^\"]*)" that has a snake\-cased name$/ do
24
- |keyword|
25
- contains_camel_case?(keyword).should be_false
26
- end
27
-
28
- Then /^the checker should tell me I have a camel\-cased method name$/ do
29
- @result.should include("Method name uses camel case")
30
- end
31
-
32
- Then /^the checker shouldn't tell me the method name is camel\-case$/ do
33
- @result.should_not include("Method name uses camel case")
34
- end
35
-
36
- Then /^the checker shouldn't tell me the class name is camel\-case$/ do
37
- @result.should_not include("Class name uses camel case")
38
- end
39
-
40
- Then /^the checker should tell me the class name is not camel\-case$/ do
41
- @result.should include("Class name does NOT use camel case")
42
- end
@@ -1,156 +0,0 @@
1
- require 'tailor/file_line'
2
-
3
- def check_spacing method_name, line_type
4
- is_line_type = false
5
- bad_spacing = false
6
- line_number = 1
7
-
8
- file_path = Pathname.new(File.expand_path(@file_list[0]))
9
-
10
- check_file do |line|
11
- source_line = Tailor::FileLine.new(line, file_path, line_number)
12
-
13
- is_line_type = source_line.send("#{line_type}_line?")
14
- bad_spacing = source_line.send(method_name)
15
-
16
- break line if is_line_type == true and bad_spacing == true
17
-
18
- line_number += 1
19
- end
20
-
21
- is_line_type.should be_true
22
- bad_spacing.should be_true
23
- end
24
-
25
- #-----------------------------------------------------------------------------
26
- # "Given" statements
27
- #-----------------------------------------------------------------------------
28
- Given /^that file contains lines with hard tabs$/ do
29
- contains_hard_tabs = false
30
- line_number = 1
31
-
32
- file_path = Pathname.new(File.expand_path(@file_list[0]))
33
-
34
- check_file do |line|
35
- source_line = Tailor::FileLine.new(line, file_path, line_number)
36
- if source_line.hard_tabbed?
37
- contains_hard_tabs = true
38
- break
39
- end
40
- line_number += 1
41
- end
42
-
43
- contains_hard_tabs.should be_true
44
- end
45
-
46
- Given /^that file contains lines with trailing whitespace$/ do
47
- line_number = 1
48
-
49
- file_path = Pathname.new(File.expand_path(@file_list[0]))
50
-
51
- check_file do |line|
52
- source_line = Tailor::FileLine.new(line, file_path, line_number)
53
-
54
- @whitespace_count = source_line.trailing_whitespace_count
55
-
56
- @whitespace_count.should > 0
57
-
58
- line_number += 1
59
- end
60
- end
61
-
62
- Given /^that file contains lines longer than 80 characters$/ do
63
- line_number = 1
64
-
65
- file_path = Pathname.new(File.expand_path(@file_list[0]))
66
-
67
- check_file do |line|
68
- source_line = Tailor::FileLine.new(line, file_path, line_number)
69
-
70
- if source_line.too_long?
71
- too_long = true
72
- break
73
- else
74
- too_long = false
75
- end
76
-
77
- too_long.should be_true
78
-
79
- line_number += 1
80
- end
81
- end
82
-
83
- Given /^that file contains a "([^\"]*)" line without spaces after commas$/ do |line_type|
84
- check_spacing("no_space_after_comma?", line_type)
85
- end
86
-
87
- Given /^that file contains a "([^\"]*)" line with > 1 spaces after commas$/ do |line_type|
88
- check_spacing("more_than_one_space_after_comma?", line_type)
89
- end
90
-
91
- Given /^that file contains a "([^\"]*)" line with spaces before commas$/ do |line_type|
92
- check_spacing("space_before_comma?", line_type)
93
- end
94
-
95
- Given /^that file contains a "([^\"]*)" line with spaces after open parentheses$/ do |line_type|
96
- check_spacing("space_after_open_parenthesis?", line_type)
97
- end
98
-
99
- Given /^that file contains a "([^\"]*)" line with spaces after an open bracket$/ do |line_type|
100
- check_spacing("space_after_open_bracket?", line_type)
101
- end
102
-
103
- Given /^that file contains a "([^\"]*)" line with spaces after an open parenthesis$/ do |line_type|
104
- check_spacing("space_before_closed_parenthesis?", line_type)
105
- end
106
-
107
- #-----------------------------------------------------------------------------
108
- # "Then" statements
109
- #-----------------------------------------------------------------------------
110
- Then /^the checker should tell me each line that has a hard tab$/ do
111
- @result.should include("Line contains hard tabs")
112
- end
113
-
114
- Then /^the checker should tell me each line has trailing whitespace$/ do
115
- @result.should include("Line contains #{@whitespace_count} trailing whitespace(s)")
116
- end
117
-
118
- Then /^the checker should tell me each line is too long$/ do
119
- message = "Line is >#{Tailor::FileLine::LINE_LENGTH_MAX} characters"
120
- @result.should include(message)
121
- end
122
-
123
- Then /^the checker should tell me each line has commas without spaces after them$/ do
124
- message = "Line has a comma with 0 spaces after it"
125
- @result.should include(message)
126
- end
127
-
128
- Then /^the checker should tell me each line has commas with spaces before them$/ do
129
- message = "Line has at least one space before a comma"
130
- @result.should include(message)
131
- end
132
-
133
- Then /^the checker should tell me each line has commas with > 1 spaces after them$/ do
134
- message = "Line has a comma with > 1 space after it"
135
- @result.should include(message)
136
- end
137
-
138
- Then /^the checker should tell me each line has open parentheses with spaces before them$/ do
139
- message = "Line has an open parenthesis with spaces after it"
140
- @result.should include(message)
141
- end
142
-
143
- Then /^the checker should tell me each line has open brackets with spaces before them$/ do
144
- message = "Line has an open bracket with spaces after it"
145
- @result.should include(message)
146
- end
147
-
148
- Then /^the checker should tell me each line has closed parentheses with spaces before them$/ do
149
- message = "Line has a closed parenthesis with spaces before it"
150
- @result.should include(message)
151
- end
152
-
153
- Then /^the checker should tell me each line has closed brackets with spaces before them$/ do
154
- message = "Line has a closed bracket with spaces before it"
155
- @result.should include(message)
156
- end
@@ -1,43 +0,0 @@
1
- # Perfect spacing after a comma, in comment and method
2
- def do_something this, that, other
3
- puts "We, I mean I, am doing, er, something!"
4
- end
5
-
6
- # More than one space, after a comma, in a comment & method
7
- def do_something this, that, other
8
- puts "We, I mean I, am doing, er, something!"
9
- end
10
-
11
- # No space,after a comma,in a comment & method
12
- def do_something this,that,other
13
- puts "We,I mean I ,am doing,er ,something!"
14
- end
15
-
16
- # Spaces , before a comma ,in a comment & method
17
- def do_something this , that ,other
18
- puts "We , I mean I ,am doing ,er , something!"
19
- end
20
-
21
- # Perfect spacing around a comma, in an array
22
- thing = [ 1, 2, 3 ]
23
-
24
- # More than one space, after elements in an array
25
- thing = [ 1, 2, 3 ]
26
-
27
- # No space, after elements in an array
28
- thing = [ 1,2,3 ]
29
-
30
- # Spaces, before elements in an array
31
- thing = [ 1 , 2 ,3 ]
32
-
33
- # Perfect spacing around a comma, in a hash
34
- thing = { :one => 1, :two => 2, :three => 3 }
35
-
36
- # More than one space, after elements in a hash
37
- thing = { :one => 1, :two => 2, :three => 3 }
38
-
39
- # No space, after elements in an array
40
- thing = { :one => 1,:two => 2,:three => 3 }
41
-
42
- # Spaces, before elements in an array
43
- thing = { :one => 1 , :two => 2 , :three => 3 }
@@ -1,60 +0,0 @@
1
- # Blocks...
2
- # No space after {
3
- 1..10.times {|number| puts number }
4
-
5
- # No space before {
6
- 1..10.times{ |number| puts number }
7
-
8
- # No space before or after {
9
- 1..10.times{|number| puts number }
10
-
11
- # No space before }
12
- 1..10.times { |number| puts number}
13
-
14
- # No space before or after { and }
15
- 1..10.times{|number| puts number}
16
-
17
- # >1 space before {
18
- 1..10.times { |number| puts number }
19
-
20
- # >1 space after {
21
- 1..10.times { |number| puts number }
22
-
23
- # >1 space before, no spaces after {
24
- 1..10.times {|number| puts number }
25
-
26
- # >1 space after, no spaces before {
27
- 1..10.times{ |number| puts number }
28
-
29
- # >1 space before }
30
- 1..10.times { |number| puts number }
31
-
32
- # Perfect
33
- 1..10.times { |number| puts number }
34
-
35
-
36
- # Hashes...
37
- # No space after {
38
- thing = {:one => 1 }
39
-
40
- # No space before {
41
- thing ={ :one => 1 }
42
-
43
- # No space before or after {
44
- thing ={:one => 1 }
45
-
46
- # No space before }
47
- thing = { :one => 1}
48
-
49
- # No space before or after { and }
50
- thing ={:one => 1}
51
-
52
- # Perfect
53
- thing = { :one => 1 }
54
-
55
- # Skip on default params in methods...
56
- def a_method; one={}; end
57
-
58
- # Skip on strings...
59
- a_string = "This is a #{thing}..."
60
- b_string = "This has #{Class.methods}"