rubocop 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rubocop might be problematic. Click here for more details.
- data/.rubocop.yml +21 -0
- data/.travis.yml +1 -0
- data/Gemfile +7 -10
- data/Gemfile.lock +21 -19
- data/README.md +47 -2
- data/VERSION +1 -1
- data/lib/rubocop.rb +10 -0
- data/lib/rubocop/cli.rb +2 -0
- data/lib/rubocop/cop/class_and_module_camel_case.rb +20 -0
- data/lib/rubocop/cop/favor_unless_over_negated_if.rb +47 -0
- data/lib/rubocop/cop/grammar.rb +3 -2
- data/lib/rubocop/cop/method_and_variable_snake_case.rb +31 -0
- data/lib/rubocop/cop/new_lambda_literal.rb +17 -0
- data/lib/rubocop/cop/parentheses_around_condition.rb +24 -0
- data/lib/rubocop/cop/surrounding_space.rb +48 -47
- data/lib/rubocop/report/plain_text.rb +1 -1
- data/lib/rubocop/report/report.rb +5 -2
- data/rubocop.gemspec +32 -19
- data/spec/rubocop/cli_spec.rb +20 -15
- data/spec/rubocop/cops/class_and_module_camel_case_spec.rb +34 -0
- data/spec/rubocop/cops/favor_unless_over_negated_if_spec.rb +62 -0
- data/spec/rubocop/cops/favor_until_over_negated_while_spec.rb +45 -0
- data/spec/rubocop/cops/method_and_variable_snake_case_spec.rb +47 -0
- data/spec/rubocop/cops/new_lambda_literal_spec.rb +23 -0
- data/spec/rubocop/cops/parentheses_around_condition_spec.rb +64 -0
- data/spec/rubocop/cops/space_around_equals_in_default_parameter_spec.rb +22 -0
- data/spec/rubocop/cops/space_around_operators_spec.rb +25 -0
- metadata +51 -25
- data/.rbenv-version +0 -1
- data/.rvmrc +0 -1
@@ -16,8 +16,7 @@ module Rubocop
|
|
16
16
|
module_function :create
|
17
17
|
|
18
18
|
class Report
|
19
|
-
|
20
|
-
attr_accessor :filename
|
19
|
+
attr_reader :filename
|
21
20
|
|
22
21
|
# @param [String] the filename for this report
|
23
22
|
def initialize(filename)
|
@@ -33,6 +32,10 @@ module Rubocop
|
|
33
32
|
end
|
34
33
|
end
|
35
34
|
|
35
|
+
def entries
|
36
|
+
@entries.sort_by(&:line_number)
|
37
|
+
end
|
38
|
+
|
36
39
|
def empty?
|
37
40
|
entries.empty?
|
38
41
|
end
|
data/rubocop.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "rubocop"
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Bozhidar Batsov"]
|
12
|
-
s.date = "2013-
|
12
|
+
s.date = "2013-04-06"
|
13
13
|
s.description = "Automatic Ruby code style checking tool. Aims to enforce the community-driven Ruby Style Guide."
|
14
14
|
s.email = "bozhidar@batsov.com"
|
15
15
|
s.executables = ["rubocop"]
|
@@ -19,10 +19,8 @@ Gem::Specification.new do |s|
|
|
19
19
|
]
|
20
20
|
s.files = [
|
21
21
|
".document",
|
22
|
-
".rbenv-version",
|
23
22
|
".rspec",
|
24
23
|
".rubocop.yml",
|
25
|
-
".rvmrc",
|
26
24
|
".travis.yml",
|
27
25
|
"CONTRIBUTING.md",
|
28
26
|
"Gemfile",
|
@@ -40,20 +38,25 @@ Gem::Specification.new do |s|
|
|
40
38
|
"lib/rubocop/cop/align_parameters.rb",
|
41
39
|
"lib/rubocop/cop/ampersands_pipes_vs_and_or.rb",
|
42
40
|
"lib/rubocop/cop/blocks.rb",
|
41
|
+
"lib/rubocop/cop/class_and_module_camel_case.rb",
|
43
42
|
"lib/rubocop/cop/cop.rb",
|
44
43
|
"lib/rubocop/cop/def_parentheses.rb",
|
45
44
|
"lib/rubocop/cop/empty_lines.rb",
|
46
45
|
"lib/rubocop/cop/encoding.rb",
|
47
46
|
"lib/rubocop/cop/end_of_line.rb",
|
48
47
|
"lib/rubocop/cop/favor_modifier.rb",
|
48
|
+
"lib/rubocop/cop/favor_unless_over_negated_if.rb",
|
49
49
|
"lib/rubocop/cop/grammar.rb",
|
50
50
|
"lib/rubocop/cop/hash_syntax.rb",
|
51
51
|
"lib/rubocop/cop/if_then_else.rb",
|
52
52
|
"lib/rubocop/cop/indentation.rb",
|
53
53
|
"lib/rubocop/cop/line_length.rb",
|
54
|
+
"lib/rubocop/cop/method_and_variable_snake_case.rb",
|
55
|
+
"lib/rubocop/cop/new_lambda_literal.rb",
|
54
56
|
"lib/rubocop/cop/numeric_literals.rb",
|
55
57
|
"lib/rubocop/cop/offence.rb",
|
56
58
|
"lib/rubocop/cop/parameter_lists.rb",
|
59
|
+
"lib/rubocop/cop/parentheses_around_condition.rb",
|
57
60
|
"lib/rubocop/cop/space_after_comma_etc.rb",
|
58
61
|
"lib/rubocop/cop/string_literals.rb",
|
59
62
|
"lib/rubocop/cop/surrounding_space.rb",
|
@@ -70,6 +73,7 @@ Gem::Specification.new do |s|
|
|
70
73
|
"spec/rubocop/cli_spec.rb",
|
71
74
|
"spec/rubocop/cops/align_parameters_spec.rb",
|
72
75
|
"spec/rubocop/cops/ampersands_pipes_vs_and_or_spec.rb",
|
76
|
+
"spec/rubocop/cops/class_and_module_camel_case_spec.rb",
|
73
77
|
"spec/rubocop/cops/cop_spec.rb",
|
74
78
|
"spec/rubocop/cops/def_with_parentheses_spec.rb",
|
75
79
|
"spec/rubocop/cops/def_without_parentheses_spec.rb",
|
@@ -77,22 +81,28 @@ Gem::Specification.new do |s|
|
|
77
81
|
"spec/rubocop/cops/encoding_spec.rb",
|
78
82
|
"spec/rubocop/cops/end_of_line_spec.rb",
|
79
83
|
"spec/rubocop/cops/favor_modifier_spec.rb",
|
84
|
+
"spec/rubocop/cops/favor_unless_over_negated_if_spec.rb",
|
85
|
+
"spec/rubocop/cops/favor_until_over_negated_while_spec.rb",
|
80
86
|
"spec/rubocop/cops/grammar_spec.rb",
|
81
87
|
"spec/rubocop/cops/hash_syntax_spec.rb",
|
82
88
|
"spec/rubocop/cops/if_with_semicolon_spec.rb",
|
83
89
|
"spec/rubocop/cops/indentation_spec.rb",
|
84
90
|
"spec/rubocop/cops/line_length_spec.rb",
|
91
|
+
"spec/rubocop/cops/method_and_variable_snake_case_spec.rb",
|
85
92
|
"spec/rubocop/cops/multiline_blocks_spec.rb",
|
86
93
|
"spec/rubocop/cops/multiline_if_then_spec.rb",
|
94
|
+
"spec/rubocop/cops/new_lambda_literal_spec.rb",
|
87
95
|
"spec/rubocop/cops/numeric_literals_spec.rb",
|
88
96
|
"spec/rubocop/cops/offence_spec.rb",
|
89
97
|
"spec/rubocop/cops/one_line_conditional_spec.rb",
|
90
98
|
"spec/rubocop/cops/parameter_lists_spec.rb",
|
99
|
+
"spec/rubocop/cops/parentheses_around_condition_spec.rb",
|
91
100
|
"spec/rubocop/cops/single_line_blocks_spec.rb",
|
92
101
|
"spec/rubocop/cops/space_after_colon_spec.rb",
|
93
102
|
"spec/rubocop/cops/space_after_comma_spec.rb",
|
94
103
|
"spec/rubocop/cops/space_after_semicolon_spec.rb",
|
95
104
|
"spec/rubocop/cops/space_around_braces_spec.rb",
|
105
|
+
"spec/rubocop/cops/space_around_equals_in_default_parameter_spec.rb",
|
96
106
|
"spec/rubocop/cops/space_around_operators_spec.rb",
|
97
107
|
"spec/rubocop/cops/space_inside_brackets_spec.rb",
|
98
108
|
"spec/rubocop/cops/space_inside_parens_spec.rb",
|
@@ -116,26 +126,29 @@ Gem::Specification.new do |s|
|
|
116
126
|
s.specification_version = 3
|
117
127
|
|
118
128
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
119
|
-
s.
|
120
|
-
s.add_development_dependency(%q<
|
121
|
-
s.add_development_dependency(%q<
|
122
|
-
s.add_development_dependency(%q<
|
123
|
-
s.add_development_dependency(%q<
|
129
|
+
s.add_runtime_dependency(%q<term-ansicolor>, [">= 0"])
|
130
|
+
s.add_development_dependency(%q<rake>, [">= 0"])
|
131
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
132
|
+
s.add_development_dependency(%q<yard>, [">= 0"])
|
133
|
+
s.add_development_dependency(%q<bundler>, [">= 0"])
|
134
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
124
135
|
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
125
136
|
else
|
126
|
-
s.add_dependency(%q<
|
127
|
-
s.add_dependency(%q<
|
128
|
-
s.add_dependency(%q<
|
129
|
-
s.add_dependency(%q<
|
130
|
-
s.add_dependency(%q<
|
137
|
+
s.add_dependency(%q<term-ansicolor>, [">= 0"])
|
138
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
139
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
140
|
+
s.add_dependency(%q<yard>, [">= 0"])
|
141
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
142
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
131
143
|
s.add_dependency(%q<simplecov>, [">= 0"])
|
132
144
|
end
|
133
145
|
else
|
134
|
-
s.add_dependency(%q<
|
135
|
-
s.add_dependency(%q<
|
136
|
-
s.add_dependency(%q<
|
137
|
-
s.add_dependency(%q<
|
138
|
-
s.add_dependency(%q<
|
146
|
+
s.add_dependency(%q<term-ansicolor>, [">= 0"])
|
147
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
148
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
149
|
+
s.add_dependency(%q<yard>, [">= 0"])
|
150
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
151
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
139
152
|
s.add_dependency(%q<simplecov>, [">= 0"])
|
140
153
|
end
|
141
154
|
end
|
data/spec/rubocop/cli_spec.rb
CHANGED
@@ -10,8 +10,8 @@ module Rubocop
|
|
10
10
|
after(:each) { $stdout = STDOUT }
|
11
11
|
|
12
12
|
it 'exits cleanly when -h is used' do
|
13
|
-
|
14
|
-
|
13
|
+
-> { cli.run ['-h'] }.should exit_with_code(0)
|
14
|
+
-> { cli.run ['--help'] }.should exit_with_code(0)
|
15
15
|
message = ['Usage: rubocop [options] [file1, file2, ...]',
|
16
16
|
' -v, --[no-]verbose Run verbosely',
|
17
17
|
' -e, --emacs Emacs style output',
|
@@ -27,7 +27,8 @@ module Rubocop
|
|
27
27
|
end
|
28
28
|
begin
|
29
29
|
cli.run(['example.rb']).should == 0
|
30
|
-
$stdout.string.should ==
|
30
|
+
$stdout.string.uncolored.should ==
|
31
|
+
"\n1 files inspected, 0 offences detected\n"
|
31
32
|
ensure
|
32
33
|
File.delete 'example.rb'
|
33
34
|
end
|
@@ -40,28 +41,31 @@ module Rubocop
|
|
40
41
|
end
|
41
42
|
begin
|
42
43
|
cli.run(['example.rb']).should == 1
|
43
|
-
$stdout.string.should ==
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
44
|
+
$stdout.string.uncolored.should ==
|
45
|
+
['== example.rb ==',
|
46
|
+
'C: 2: Trailing whitespace detected.',
|
47
|
+
'',
|
48
|
+
'1 files inspected, 1 offences detected',
|
49
|
+
''].join("\n")
|
48
50
|
ensure
|
49
51
|
File.delete 'example.rb'
|
50
52
|
end
|
51
53
|
end
|
52
54
|
|
53
55
|
it 'can report in emacs style' do
|
54
|
-
File.open('example1.rb', 'w') { |f| f.puts 'x
|
56
|
+
File.open('example1.rb', 'w') { |f| f.puts 'x= 0 ', 'y ' }
|
55
57
|
File.open('example2.rb', 'w') { |f| f.puts "\tx = 0" }
|
56
58
|
begin
|
57
59
|
cli.run(['--emacs', 'example1.rb', 'example2.rb']).should == 1
|
58
|
-
$stdout.string.should ==
|
60
|
+
$stdout.string.uncolored.should ==
|
59
61
|
['example1.rb:1: C: Missing encoding comment.',
|
60
62
|
'example1.rb:1: C: Trailing whitespace detected.',
|
63
|
+
"example1.rb:1: C: Surrounding space missing for operator '='.",
|
64
|
+
'example1.rb:2: C: Trailing whitespace detected.',
|
61
65
|
'example2.rb:1: C: Missing encoding comment.',
|
62
66
|
'example2.rb:1: C: Tab detected.',
|
63
67
|
'',
|
64
|
-
'2 files inspected,
|
68
|
+
'2 files inspected, 6 offences detected',
|
65
69
|
''].join("\n")
|
66
70
|
ensure
|
67
71
|
File.delete 'example1.rb'
|
@@ -100,7 +104,7 @@ module Rubocop
|
|
100
104
|
end
|
101
105
|
begin
|
102
106
|
return_code = cli.run(['-c', 'rubocop.yml', 'example1.rb'])
|
103
|
-
$stdout.string.should ==
|
107
|
+
$stdout.string.uncolored.should ==
|
104
108
|
['== example1.rb ==',
|
105
109
|
'C: 1: Trailing whitespace detected.',
|
106
110
|
'',
|
@@ -125,7 +129,7 @@ module Rubocop
|
|
125
129
|
end
|
126
130
|
begin
|
127
131
|
return_code = cli.run(['example_src/example1.rb'])
|
128
|
-
$stdout.string.should ==
|
132
|
+
$stdout.string.uncolored.should ==
|
129
133
|
['== example_src/example1.rb ==',
|
130
134
|
'C: 1: Trailing whitespace detected.',
|
131
135
|
'',
|
@@ -147,7 +151,7 @@ module Rubocop
|
|
147
151
|
end
|
148
152
|
begin
|
149
153
|
return_code = cli.run(['example_src/example1.rb'])
|
150
|
-
$stdout.string.should ==
|
154
|
+
$stdout.string.uncolored.should ==
|
151
155
|
['== example_src/example1.rb ==',
|
152
156
|
'C: 1: Missing encoding comment.',
|
153
157
|
'',
|
@@ -161,7 +165,8 @@ module Rubocop
|
|
161
165
|
|
162
166
|
it 'finds no violations when checking the rubocop source code' do
|
163
167
|
cli.run
|
164
|
-
$stdout.string.should =~
|
168
|
+
$stdout.string.uncolored.should =~
|
169
|
+
/files inspected, 0 offences detected\n/
|
165
170
|
end
|
166
171
|
|
167
172
|
it 'can process a file with an invalide UTF-8 byte sequence' do
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
module Rubocop
|
6
|
+
module Cop
|
7
|
+
describe ClassAndModuleCamelCase do
|
8
|
+
let (:camel_case) { ClassAndModuleCamelCase.new }
|
9
|
+
|
10
|
+
it 'registers an offence for underscore in class and module name' do
|
11
|
+
inspect_source(camel_case, 'file.rb',
|
12
|
+
['class My_Class',
|
13
|
+
'end',
|
14
|
+
'',
|
15
|
+
'module My_Module',
|
16
|
+
'end',
|
17
|
+
])
|
18
|
+
camel_case.offences.map(&:message).should ==
|
19
|
+
['Use CamelCase for classes and modules.'] * 2
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'accepts CamelCase names' do
|
23
|
+
inspect_source(camel_case, 'file.rb',
|
24
|
+
['class MyClass',
|
25
|
+
'end',
|
26
|
+
'',
|
27
|
+
'module Mine',
|
28
|
+
'end',
|
29
|
+
])
|
30
|
+
camel_case.offences.map(&:message).should == []
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
module Rubocop
|
6
|
+
module Cop
|
7
|
+
describe FavorUnlessOverNegatedIf do
|
8
|
+
let (:fav_unless) { FavorUnlessOverNegatedIf.new }
|
9
|
+
|
10
|
+
it 'registers an offence for if with exclamation point condition' do
|
11
|
+
inspect_source(fav_unless, 'file.rb',
|
12
|
+
['if !a_condition',
|
13
|
+
' some_method',
|
14
|
+
'end',
|
15
|
+
'some_method if !a_condition',
|
16
|
+
])
|
17
|
+
fav_unless.offences.map(&:message).should ==
|
18
|
+
['Favor unless (or control flow or) over if for negative ' +
|
19
|
+
'conditions.'] * 2
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'registers an offence for if with "not" condition' do
|
23
|
+
inspect_source(fav_unless, 'file.rb',
|
24
|
+
['if not a_condition',
|
25
|
+
' some_method',
|
26
|
+
'end',
|
27
|
+
'some_method if not a_condition'])
|
28
|
+
fav_unless.offences.map(&:message).should ==
|
29
|
+
['Favor unless (or control flow or) over if for negative ' +
|
30
|
+
'conditions.'] * 2
|
31
|
+
fav_unless.offences.map(&:line_number).should == [1, 4]
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'accepts an if/else with negative condition' do
|
35
|
+
inspect_source(fav_unless, 'file.rb',
|
36
|
+
['if !a_condition',
|
37
|
+
' some_method',
|
38
|
+
'else',
|
39
|
+
' something_else',
|
40
|
+
'end',
|
41
|
+
'if not a_condition',
|
42
|
+
' some_method',
|
43
|
+
'elsif other_condition',
|
44
|
+
' something_else',
|
45
|
+
'end'])
|
46
|
+
fav_unless.offences.map(&:message).should == []
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'accepts an if where only part of the contition is negated' do
|
50
|
+
inspect_source(fav_unless, 'file.rb',
|
51
|
+
['if !a_condition && another_condition',
|
52
|
+
' some_method',
|
53
|
+
'end',
|
54
|
+
'if not a_condition or another_condition',
|
55
|
+
' some_method',
|
56
|
+
'end',
|
57
|
+
'some_method if not a_condition or another_condition'])
|
58
|
+
fav_unless.offences.map(&:message).should == []
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
module Rubocop
|
6
|
+
module Cop
|
7
|
+
describe FavorUntilOverNegatedWhile do
|
8
|
+
let (:fav_until) { FavorUntilOverNegatedWhile.new }
|
9
|
+
|
10
|
+
it 'registers an offence for while with exclamation point condition' do
|
11
|
+
inspect_source(fav_until, 'file.rb',
|
12
|
+
['while !a_condition',
|
13
|
+
' some_method',
|
14
|
+
'end',
|
15
|
+
'some_method while !a_condition',
|
16
|
+
])
|
17
|
+
fav_until.offences.map(&:message).should ==
|
18
|
+
['Favor until over while for negative conditions.'] * 2
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'registers an offence for while with "not" condition' do
|
22
|
+
inspect_source(fav_until, 'file.rb',
|
23
|
+
['while (not a_condition)',
|
24
|
+
' some_method',
|
25
|
+
'end',
|
26
|
+
'some_method while not a_condition'])
|
27
|
+
fav_until.offences.map(&:message).should ==
|
28
|
+
['Favor until over while for negative conditions.'] * 2
|
29
|
+
fav_until.offences.map(&:line_number).should == [1, 4]
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'accepts an while where only part of the contition is negated' do
|
33
|
+
inspect_source(fav_until, 'file.rb',
|
34
|
+
['while !a_condition && another_condition',
|
35
|
+
' some_method',
|
36
|
+
'end',
|
37
|
+
'while not a_condition or another_condition',
|
38
|
+
' some_method',
|
39
|
+
'end',
|
40
|
+
'some_method while not a_condition or other_cond'])
|
41
|
+
fav_until.offences.map(&:message).should == []
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
module Rubocop
|
6
|
+
module Cop
|
7
|
+
describe MethodAndVariableSnakeCase do
|
8
|
+
let (:snake_case) { MethodAndVariableSnakeCase.new }
|
9
|
+
|
10
|
+
it 'registers an offence for camel case in names' do
|
11
|
+
inspect_source(snake_case, 'file.rb',
|
12
|
+
['def myMethod',
|
13
|
+
' myLocal = 1',
|
14
|
+
' self.mySetter = 2',
|
15
|
+
' @myAttribute = 3',
|
16
|
+
'end',
|
17
|
+
])
|
18
|
+
snake_case.offences.map(&:message).should ==
|
19
|
+
['Use snake_case for methods and variables.'] * 4
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'accepts snake case in names' do
|
23
|
+
inspect_source(snake_case, 'file.rb',
|
24
|
+
['def my_method',
|
25
|
+
' my_local_html = 1',
|
26
|
+
' self.my_setter = 2',
|
27
|
+
' @my_attribute = 3',
|
28
|
+
'end',
|
29
|
+
])
|
30
|
+
snake_case.offences.map(&:message).should == []
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'registers an offence for mixed snake case and camel case' do
|
34
|
+
inspect_source(snake_case, 'file.rb',
|
35
|
+
['def visit_Arel_Nodes_SelectStatement',
|
36
|
+
'end'])
|
37
|
+
snake_case.offences.map(&:message).should ==
|
38
|
+
['Use snake_case for methods and variables.']
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'accepts screaming snake case globals' do
|
42
|
+
inspect_source(snake_case, 'file.rb', ['$MY_GLOBAL = 0'])
|
43
|
+
snake_case.offences.map(&:message).should == []
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|