rubocop 0.4.0 → 0.8.0
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.
- checksums.yaml +7 -0
- data/.gitignore +50 -0
- data/.rubocop.yml +5 -127
- data/.travis.yml +7 -1
- data/CHANGELOG.md +157 -0
- data/CONTRIBUTING.md +13 -6
- data/Gemfile +3 -8
- data/README.md +160 -9
- data/Rakefile +3 -17
- data/bin/rubocop +16 -10
- data/config/default.yml +46 -0
- data/config/disabled.yml +5 -0
- data/config/enabled.yml +322 -0
- data/lib/rubocop/cli.rb +248 -93
- data/lib/rubocop/config.rb +205 -0
- data/lib/rubocop/config_store.rb +37 -0
- data/lib/rubocop/cop/access_control.rb +41 -0
- data/lib/rubocop/cop/alias.rb +17 -0
- data/lib/rubocop/cop/align_parameters.rb +20 -95
- data/lib/rubocop/cop/and_or.rb +26 -0
- data/lib/rubocop/cop/ascii_comments.rb +13 -0
- data/lib/rubocop/cop/ascii_identifiers.rb +19 -0
- data/lib/rubocop/cop/avoid_class_vars.rb +15 -0
- data/lib/rubocop/cop/avoid_for.rb +17 -0
- data/lib/rubocop/cop/avoid_global_vars.rb +61 -0
- data/lib/rubocop/cop/avoid_perl_backrefs.rb +17 -0
- data/lib/rubocop/cop/avoid_perlisms.rb +47 -0
- data/lib/rubocop/cop/block_comments.rb +15 -0
- data/lib/rubocop/cop/blocks.rb +11 -47
- data/lib/rubocop/cop/case_indentation.rb +22 -0
- data/lib/rubocop/cop/class_and_module_camel_case.rb +20 -11
- data/lib/rubocop/cop/class_methods.rb +15 -0
- data/lib/rubocop/cop/collection_methods.rb +16 -16
- data/lib/rubocop/cop/colon_method_call.rb +20 -0
- data/lib/rubocop/cop/constant_name.rb +24 -0
- data/lib/rubocop/cop/cop.rb +34 -47
- data/lib/rubocop/cop/def_parentheses.rb +43 -35
- data/lib/rubocop/cop/empty_line_between_defs.rb +22 -0
- data/lib/rubocop/cop/empty_lines.rb +21 -13
- data/lib/rubocop/cop/empty_literal.rb +47 -0
- data/lib/rubocop/cop/encoding.rb +3 -3
- data/lib/rubocop/cop/end_of_line.rb +3 -3
- data/lib/rubocop/cop/ensure_return.rb +19 -0
- data/lib/rubocop/cop/eval.rb +19 -0
- data/lib/rubocop/cop/favor_join.rb +22 -0
- data/lib/rubocop/cop/favor_modifier.rb +38 -48
- data/lib/rubocop/cop/favor_percent_r.rb +19 -0
- data/lib/rubocop/cop/favor_sprintf.rb +21 -0
- data/lib/rubocop/cop/favor_unless_over_negated_if.rb +19 -17
- data/lib/rubocop/cop/handle_exceptions.rb +17 -0
- data/lib/rubocop/cop/hash_syntax.rb +29 -14
- data/lib/rubocop/cop/if_then_else.rb +32 -29
- data/lib/rubocop/cop/leading_comment_space.rb +17 -0
- data/lib/rubocop/cop/line_continuation.rb +15 -0
- data/lib/rubocop/cop/line_length.rb +4 -4
- data/lib/rubocop/cop/loop.rb +33 -0
- data/lib/rubocop/cop/method_and_variable_snake_case.rb +41 -17
- data/lib/rubocop/cop/method_length.rb +52 -0
- data/lib/rubocop/cop/new_lambda_literal.rb +8 -6
- data/lib/rubocop/cop/not.rb +21 -0
- data/lib/rubocop/cop/numeric_literals.rb +9 -7
- data/lib/rubocop/cop/offence.rb +12 -1
- data/lib/rubocop/cop/op_method.rb +26 -0
- data/lib/rubocop/cop/parameter_lists.rb +12 -6
- data/lib/rubocop/cop/parentheses_around_condition.rb +11 -11
- data/lib/rubocop/cop/percent_r.rb +19 -0
- data/lib/rubocop/cop/reduce_arguments.rb +29 -0
- data/lib/rubocop/cop/rescue_exception.rb +26 -0
- data/lib/rubocop/cop/rescue_modifier.rb +17 -0
- data/lib/rubocop/cop/semicolon.rb +31 -0
- data/lib/rubocop/cop/single_line_methods.rb +44 -0
- data/lib/rubocop/cop/space_after_comma_etc.rb +30 -10
- data/lib/rubocop/cop/space_after_control_keyword.rb +29 -0
- data/lib/rubocop/cop/string_literals.rb +9 -23
- data/lib/rubocop/cop/surrounding_space.rb +223 -83
- data/lib/rubocop/cop/symbol_array.rb +31 -0
- data/lib/rubocop/cop/symbol_name.rb +23 -0
- data/lib/rubocop/cop/syntax.rb +35 -5
- data/lib/rubocop/cop/tab.rb +3 -3
- data/lib/rubocop/cop/ternary_operator.rb +26 -24
- data/lib/rubocop/cop/trailing_whitespace.rb +3 -5
- data/lib/rubocop/cop/trivial_accessors.rb +26 -0
- data/lib/rubocop/cop/unless_else.rb +11 -7
- data/lib/rubocop/cop/util.rb +26 -0
- data/lib/rubocop/cop/variable_interpolation.rb +29 -0
- data/lib/rubocop/cop/when_then.rb +6 -14
- data/lib/rubocop/cop/word_array.rb +37 -0
- data/lib/rubocop/report/emacs_style.rb +2 -2
- data/lib/rubocop/report/plain_text.rb +1 -1
- data/lib/rubocop/version.rb +3 -1
- data/lib/rubocop.rb +48 -8
- data/rubocop.gemspec +32 -151
- data/spec/project_spec.rb +27 -0
- data/spec/rubocop/cli_spec.rb +573 -200
- data/spec/rubocop/config_spec.rb +409 -0
- data/spec/rubocop/config_store_spec.rb +66 -0
- data/spec/rubocop/cops/access_control_spec.rb +129 -0
- data/spec/rubocop/cops/alias_spec.rb +39 -0
- data/spec/rubocop/cops/align_parameters_spec.rb +66 -70
- data/spec/rubocop/cops/and_or_spec.rb +37 -0
- data/spec/rubocop/cops/ascii_comments_spec.rb +26 -0
- data/spec/rubocop/cops/ascii_identifiers_spec.rb +26 -0
- data/spec/rubocop/cops/avoid_class_vars_spec.rb +25 -0
- data/spec/rubocop/cops/avoid_for_spec.rb +35 -0
- data/spec/rubocop/cops/avoid_global_vars_spec.rb +32 -0
- data/spec/rubocop/cops/avoid_perl_backrefs_spec.rb +18 -0
- data/spec/rubocop/cops/avoid_perlisms_spec.rb +44 -0
- data/spec/rubocop/cops/block_comments_spec.rb +25 -0
- data/spec/rubocop/cops/blocks_spec.rb +33 -0
- data/spec/rubocop/cops/{indentation_spec.rb → case_indentation_spec.rb} +7 -7
- data/spec/rubocop/cops/class_and_module_camel_case_spec.rb +15 -5
- data/spec/rubocop/cops/class_methods_spec.rb +49 -0
- data/spec/rubocop/cops/collection_methods_spec.rb +9 -4
- data/spec/rubocop/cops/colon_method_call_spec.rb +53 -0
- data/spec/rubocop/cops/constant_name_spec.rb +42 -0
- data/spec/rubocop/cops/def_with_parentheses_spec.rb +13 -8
- data/spec/rubocop/cops/def_without_parentheses_spec.rb +11 -5
- data/spec/rubocop/cops/empty_line_between_defs_spec.rb +83 -0
- data/spec/rubocop/cops/empty_lines_spec.rb +14 -59
- data/spec/rubocop/cops/empty_literal_spec.rb +90 -0
- data/spec/rubocop/cops/encoding_spec.rb +11 -11
- data/spec/rubocop/cops/end_of_line_spec.rb +2 -2
- data/spec/rubocop/cops/ensure_return_spec.rb +35 -0
- data/spec/rubocop/cops/eval_spec.rb +39 -0
- data/spec/rubocop/cops/favor_join_spec.rb +35 -0
- data/spec/rubocop/cops/favor_modifier_spec.rb +16 -14
- data/spec/rubocop/cops/favor_percent_r_spec.rb +29 -0
- data/spec/rubocop/cops/favor_sprintf_spec.rb +51 -0
- data/spec/rubocop/cops/favor_unless_over_negated_if_spec.rb +4 -4
- data/spec/rubocop/cops/favor_until_over_negated_while_spec.rb +3 -3
- data/spec/rubocop/cops/handle_exceptions_spec.rb +34 -0
- data/spec/rubocop/cops/hash_syntax_spec.rb +11 -6
- data/spec/rubocop/cops/if_with_semicolon_spec.rb +7 -1
- data/spec/rubocop/cops/leading_comment_space_spec.rb +54 -0
- data/spec/rubocop/cops/line_continuation_spec.rb +24 -0
- data/spec/rubocop/cops/line_length_spec.rb +3 -2
- data/spec/rubocop/cops/loop_spec.rb +31 -0
- data/spec/rubocop/cops/method_and_variable_snake_case_spec.rb +55 -9
- data/spec/rubocop/cops/method_length_spec.rb +147 -0
- data/spec/rubocop/cops/multiline_if_then_spec.rb +15 -15
- data/spec/rubocop/cops/new_lambda_literal_spec.rb +5 -6
- data/spec/rubocop/cops/not_spec.rb +31 -0
- data/spec/rubocop/cops/numeric_literals_spec.rb +13 -13
- data/spec/rubocop/cops/offence_spec.rb +13 -0
- data/spec/rubocop/cops/one_line_conditional_spec.rb +1 -1
- data/spec/rubocop/cops/op_method_spec.rb +78 -0
- data/spec/rubocop/cops/parameter_lists_spec.rb +7 -7
- data/spec/rubocop/cops/parentheses_around_condition_spec.rb +41 -44
- data/spec/rubocop/cops/percent_r_spec.rb +29 -0
- data/spec/rubocop/cops/reduce_arguments_spec.rb +57 -0
- data/spec/rubocop/cops/rescue_exception_spec.rb +125 -0
- data/spec/rubocop/cops/rescue_modifier_spec.rb +37 -0
- data/spec/rubocop/cops/semicolon_spec.rb +88 -0
- data/spec/rubocop/cops/single_line_methods_spec.rb +50 -0
- data/spec/rubocop/cops/space_after_colon_spec.rb +3 -3
- data/spec/rubocop/cops/space_after_comma_spec.rb +14 -2
- data/spec/rubocop/cops/space_after_control_keyword_spec.rb +67 -0
- data/spec/rubocop/cops/space_after_semicolon_spec.rb +6 -1
- data/spec/rubocop/cops/space_around_braces_spec.rb +18 -3
- data/spec/rubocop/cops/space_around_equals_in_default_parameter_spec.rb +12 -2
- data/spec/rubocop/cops/space_around_operators_spec.rb +88 -26
- data/spec/rubocop/cops/space_inside_brackets_spec.rb +13 -7
- data/spec/rubocop/cops/space_inside_hash_literal_braces_spec.rb +79 -0
- data/spec/rubocop/cops/space_inside_parens_spec.rb +7 -3
- data/spec/rubocop/cops/string_literals_spec.rb +21 -6
- data/spec/rubocop/cops/symbol_array_spec.rb +41 -0
- data/spec/rubocop/cops/symbol_name_spec.rb +119 -0
- data/spec/rubocop/cops/syntax_spec.rb +28 -5
- data/spec/rubocop/cops/tab_spec.rb +2 -2
- data/spec/rubocop/cops/ternary_operator_spec.rb +13 -17
- data/spec/rubocop/cops/trailing_whitespace_spec.rb +3 -3
- data/spec/rubocop/cops/trivial_accessors_spec.rb +329 -0
- data/spec/rubocop/cops/unless_else_spec.rb +8 -8
- data/spec/rubocop/cops/variable_interpolation_spec.rb +49 -0
- data/spec/rubocop/cops/when_then_spec.rb +14 -14
- data/spec/rubocop/cops/word_array_spec.rb +47 -0
- data/spec/spec_helper.rb +30 -9
- data/spec/support/file_helper.rb +21 -0
- data/spec/support/isolated_environment.rb +27 -0
- metadata +235 -76
- data/.document +0 -5
- data/Gemfile.lock +0 -41
- data/VERSION +0 -1
- data/lib/rubocop/cop/ampersands_pipes_vs_and_or.rb +0 -25
- data/lib/rubocop/cop/grammar.rb +0 -135
- data/lib/rubocop/cop/indentation.rb +0 -44
- data/spec/rubocop/cops/ampersands_pipes_vs_and_or_spec.rb +0 -57
- data/spec/rubocop/cops/grammar_spec.rb +0 -71
- data/spec/rubocop/cops/multiline_blocks_spec.rb +0 -24
- data/spec/rubocop/cops/single_line_blocks_spec.rb +0 -22
@@ -0,0 +1,27 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'tmpdir'
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
shared_context 'isolated environment', :isolated_environment do
|
7
|
+
around do |example|
|
8
|
+
Dir.mktmpdir do |tmpdir|
|
9
|
+
original_home = ENV['HOME']
|
10
|
+
|
11
|
+
begin
|
12
|
+
virtual_home = File.expand_path(File.join(tmpdir, 'home'))
|
13
|
+
Dir.mkdir(virtual_home)
|
14
|
+
ENV['HOME'] = virtual_home
|
15
|
+
|
16
|
+
working_dir = File.join(tmpdir, 'work')
|
17
|
+
Dir.mkdir(working_dir)
|
18
|
+
|
19
|
+
Dir.chdir(working_dir) do
|
20
|
+
example.run
|
21
|
+
end
|
22
|
+
ensure
|
23
|
+
ENV['HOME'] = original_home
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
metadata
CHANGED
@@ -1,130 +1,116 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.8.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Bozhidar Batsov
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
11
|
+
date: 2013-04-17 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
14
|
+
name: rainbow
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
19
|
+
version: 1.1.4
|
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
|
-
version:
|
26
|
+
version: 1.1.4
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
|
-
name:
|
28
|
+
name: parser
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
38
|
-
type: :
|
33
|
+
version: 2.0.0.beta2
|
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
|
-
version:
|
40
|
+
version: 2.0.0.beta2
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
42
|
+
name: rake
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ~>
|
52
46
|
- !ruby/object:Gem::Version
|
53
|
-
version: '0'
|
47
|
+
version: '10.0'
|
54
48
|
type: :development
|
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
|
-
version: '0'
|
54
|
+
version: '10.0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
56
|
+
name: rspec
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - ~>
|
68
60
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
61
|
+
version: '2.13'
|
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
|
-
version: '
|
68
|
+
version: '2.13'
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
|
-
name:
|
70
|
+
name: yard
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - ~>
|
84
74
|
- !ruby/object:Gem::Version
|
85
|
-
version: '0'
|
75
|
+
version: '0.8'
|
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
|
-
version: '0'
|
82
|
+
version: '0.8'
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
|
-
name:
|
84
|
+
name: bundler
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
|
-
- -
|
87
|
+
- - ~>
|
100
88
|
- !ruby/object:Gem::Version
|
101
|
-
version: '
|
89
|
+
version: '1.3'
|
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
|
-
version: '
|
96
|
+
version: '1.3'
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: simplecov
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
|
-
- -
|
101
|
+
- - ~>
|
116
102
|
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
103
|
+
version: '0.7'
|
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
|
-
version: '0'
|
126
|
-
description:
|
127
|
-
|
110
|
+
version: '0.7'
|
111
|
+
description: |2
|
112
|
+
Automatic Ruby code style checking tool.
|
113
|
+
Aims to enforce the community-driven Ruby Style Guide.
|
128
114
|
email: bozhidar@batsov.com
|
129
115
|
executables:
|
130
116
|
- rubocop
|
@@ -133,130 +119,303 @@ extra_rdoc_files:
|
|
133
119
|
- LICENSE.txt
|
134
120
|
- README.md
|
135
121
|
files:
|
136
|
-
- .
|
122
|
+
- .gitignore
|
137
123
|
- .rspec
|
138
124
|
- .rubocop.yml
|
139
125
|
- .travis.yml
|
126
|
+
- CHANGELOG.md
|
140
127
|
- CONTRIBUTING.md
|
141
128
|
- Gemfile
|
142
|
-
- Gemfile.lock
|
143
129
|
- LICENSE.txt
|
144
130
|
- README.md
|
145
131
|
- Rakefile
|
146
|
-
- VERSION
|
147
132
|
- bin/rubocop
|
133
|
+
- config/default.yml
|
134
|
+
- config/disabled.yml
|
135
|
+
- config/enabled.yml
|
148
136
|
- lib/rubocop.rb
|
149
137
|
- lib/rubocop/cli.rb
|
138
|
+
- lib/rubocop/config.rb
|
139
|
+
- lib/rubocop/config_store.rb
|
140
|
+
- lib/rubocop/cop/access_control.rb
|
141
|
+
- lib/rubocop/cop/alias.rb
|
150
142
|
- lib/rubocop/cop/align_parameters.rb
|
151
|
-
- lib/rubocop/cop/
|
143
|
+
- lib/rubocop/cop/and_or.rb
|
144
|
+
- lib/rubocop/cop/ascii_comments.rb
|
145
|
+
- lib/rubocop/cop/ascii_identifiers.rb
|
146
|
+
- lib/rubocop/cop/avoid_class_vars.rb
|
147
|
+
- lib/rubocop/cop/avoid_for.rb
|
148
|
+
- lib/rubocop/cop/avoid_global_vars.rb
|
149
|
+
- lib/rubocop/cop/avoid_perl_backrefs.rb
|
150
|
+
- lib/rubocop/cop/avoid_perlisms.rb
|
151
|
+
- lib/rubocop/cop/block_comments.rb
|
152
152
|
- lib/rubocop/cop/blocks.rb
|
153
|
+
- lib/rubocop/cop/case_indentation.rb
|
153
154
|
- lib/rubocop/cop/class_and_module_camel_case.rb
|
155
|
+
- lib/rubocop/cop/class_methods.rb
|
154
156
|
- lib/rubocop/cop/collection_methods.rb
|
157
|
+
- lib/rubocop/cop/colon_method_call.rb
|
158
|
+
- lib/rubocop/cop/constant_name.rb
|
155
159
|
- lib/rubocop/cop/cop.rb
|
156
160
|
- lib/rubocop/cop/def_parentheses.rb
|
161
|
+
- lib/rubocop/cop/empty_line_between_defs.rb
|
157
162
|
- lib/rubocop/cop/empty_lines.rb
|
163
|
+
- lib/rubocop/cop/empty_literal.rb
|
158
164
|
- lib/rubocop/cop/encoding.rb
|
159
165
|
- lib/rubocop/cop/end_of_line.rb
|
166
|
+
- lib/rubocop/cop/ensure_return.rb
|
167
|
+
- lib/rubocop/cop/eval.rb
|
168
|
+
- lib/rubocop/cop/favor_join.rb
|
160
169
|
- lib/rubocop/cop/favor_modifier.rb
|
170
|
+
- lib/rubocop/cop/favor_percent_r.rb
|
171
|
+
- lib/rubocop/cop/favor_sprintf.rb
|
161
172
|
- lib/rubocop/cop/favor_unless_over_negated_if.rb
|
162
|
-
- lib/rubocop/cop/
|
173
|
+
- lib/rubocop/cop/handle_exceptions.rb
|
163
174
|
- lib/rubocop/cop/hash_syntax.rb
|
164
175
|
- lib/rubocop/cop/if_then_else.rb
|
165
|
-
- lib/rubocop/cop/
|
176
|
+
- lib/rubocop/cop/leading_comment_space.rb
|
177
|
+
- lib/rubocop/cop/line_continuation.rb
|
166
178
|
- lib/rubocop/cop/line_length.rb
|
179
|
+
- lib/rubocop/cop/loop.rb
|
167
180
|
- lib/rubocop/cop/method_and_variable_snake_case.rb
|
181
|
+
- lib/rubocop/cop/method_length.rb
|
168
182
|
- lib/rubocop/cop/new_lambda_literal.rb
|
183
|
+
- lib/rubocop/cop/not.rb
|
169
184
|
- lib/rubocop/cop/numeric_literals.rb
|
170
185
|
- lib/rubocop/cop/offence.rb
|
186
|
+
- lib/rubocop/cop/op_method.rb
|
171
187
|
- lib/rubocop/cop/parameter_lists.rb
|
172
188
|
- lib/rubocop/cop/parentheses_around_condition.rb
|
189
|
+
- lib/rubocop/cop/percent_r.rb
|
190
|
+
- lib/rubocop/cop/reduce_arguments.rb
|
191
|
+
- lib/rubocop/cop/rescue_exception.rb
|
192
|
+
- lib/rubocop/cop/rescue_modifier.rb
|
193
|
+
- lib/rubocop/cop/semicolon.rb
|
194
|
+
- lib/rubocop/cop/single_line_methods.rb
|
173
195
|
- lib/rubocop/cop/space_after_comma_etc.rb
|
196
|
+
- lib/rubocop/cop/space_after_control_keyword.rb
|
174
197
|
- lib/rubocop/cop/string_literals.rb
|
175
198
|
- lib/rubocop/cop/surrounding_space.rb
|
199
|
+
- lib/rubocop/cop/symbol_array.rb
|
200
|
+
- lib/rubocop/cop/symbol_name.rb
|
176
201
|
- lib/rubocop/cop/syntax.rb
|
177
202
|
- lib/rubocop/cop/tab.rb
|
178
203
|
- lib/rubocop/cop/ternary_operator.rb
|
179
204
|
- lib/rubocop/cop/trailing_whitespace.rb
|
205
|
+
- lib/rubocop/cop/trivial_accessors.rb
|
180
206
|
- lib/rubocop/cop/unless_else.rb
|
207
|
+
- lib/rubocop/cop/util.rb
|
208
|
+
- lib/rubocop/cop/variable_interpolation.rb
|
181
209
|
- lib/rubocop/cop/when_then.rb
|
210
|
+
- lib/rubocop/cop/word_array.rb
|
182
211
|
- lib/rubocop/report/emacs_style.rb
|
183
212
|
- lib/rubocop/report/plain_text.rb
|
184
213
|
- lib/rubocop/report/report.rb
|
185
214
|
- lib/rubocop/version.rb
|
186
215
|
- rubocop.gemspec
|
216
|
+
- spec/project_spec.rb
|
187
217
|
- spec/rubocop/cli_spec.rb
|
218
|
+
- spec/rubocop/config_spec.rb
|
219
|
+
- spec/rubocop/config_store_spec.rb
|
220
|
+
- spec/rubocop/cops/access_control_spec.rb
|
221
|
+
- spec/rubocop/cops/alias_spec.rb
|
188
222
|
- spec/rubocop/cops/align_parameters_spec.rb
|
189
|
-
- spec/rubocop/cops/
|
223
|
+
- spec/rubocop/cops/and_or_spec.rb
|
224
|
+
- spec/rubocop/cops/ascii_comments_spec.rb
|
225
|
+
- spec/rubocop/cops/ascii_identifiers_spec.rb
|
226
|
+
- spec/rubocop/cops/avoid_class_vars_spec.rb
|
227
|
+
- spec/rubocop/cops/avoid_for_spec.rb
|
228
|
+
- spec/rubocop/cops/avoid_global_vars_spec.rb
|
229
|
+
- spec/rubocop/cops/avoid_perl_backrefs_spec.rb
|
230
|
+
- spec/rubocop/cops/avoid_perlisms_spec.rb
|
231
|
+
- spec/rubocop/cops/block_comments_spec.rb
|
232
|
+
- spec/rubocop/cops/blocks_spec.rb
|
233
|
+
- spec/rubocop/cops/case_indentation_spec.rb
|
190
234
|
- spec/rubocop/cops/class_and_module_camel_case_spec.rb
|
235
|
+
- spec/rubocop/cops/class_methods_spec.rb
|
191
236
|
- spec/rubocop/cops/collection_methods_spec.rb
|
237
|
+
- spec/rubocop/cops/colon_method_call_spec.rb
|
238
|
+
- spec/rubocop/cops/constant_name_spec.rb
|
192
239
|
- spec/rubocop/cops/cop_spec.rb
|
193
240
|
- spec/rubocop/cops/def_with_parentheses_spec.rb
|
194
241
|
- spec/rubocop/cops/def_without_parentheses_spec.rb
|
242
|
+
- spec/rubocop/cops/empty_line_between_defs_spec.rb
|
195
243
|
- spec/rubocop/cops/empty_lines_spec.rb
|
244
|
+
- spec/rubocop/cops/empty_literal_spec.rb
|
196
245
|
- spec/rubocop/cops/encoding_spec.rb
|
197
246
|
- spec/rubocop/cops/end_of_line_spec.rb
|
247
|
+
- spec/rubocop/cops/ensure_return_spec.rb
|
248
|
+
- spec/rubocop/cops/eval_spec.rb
|
249
|
+
- spec/rubocop/cops/favor_join_spec.rb
|
198
250
|
- spec/rubocop/cops/favor_modifier_spec.rb
|
251
|
+
- spec/rubocop/cops/favor_percent_r_spec.rb
|
252
|
+
- spec/rubocop/cops/favor_sprintf_spec.rb
|
199
253
|
- spec/rubocop/cops/favor_unless_over_negated_if_spec.rb
|
200
254
|
- spec/rubocop/cops/favor_until_over_negated_while_spec.rb
|
201
|
-
- spec/rubocop/cops/
|
255
|
+
- spec/rubocop/cops/handle_exceptions_spec.rb
|
202
256
|
- spec/rubocop/cops/hash_syntax_spec.rb
|
203
257
|
- spec/rubocop/cops/if_with_semicolon_spec.rb
|
204
|
-
- spec/rubocop/cops/
|
258
|
+
- spec/rubocop/cops/leading_comment_space_spec.rb
|
259
|
+
- spec/rubocop/cops/line_continuation_spec.rb
|
205
260
|
- spec/rubocop/cops/line_length_spec.rb
|
261
|
+
- spec/rubocop/cops/loop_spec.rb
|
206
262
|
- spec/rubocop/cops/method_and_variable_snake_case_spec.rb
|
207
|
-
- spec/rubocop/cops/
|
263
|
+
- spec/rubocop/cops/method_length_spec.rb
|
208
264
|
- spec/rubocop/cops/multiline_if_then_spec.rb
|
209
265
|
- spec/rubocop/cops/new_lambda_literal_spec.rb
|
266
|
+
- spec/rubocop/cops/not_spec.rb
|
210
267
|
- spec/rubocop/cops/numeric_literals_spec.rb
|
211
268
|
- spec/rubocop/cops/offence_spec.rb
|
212
269
|
- spec/rubocop/cops/one_line_conditional_spec.rb
|
270
|
+
- spec/rubocop/cops/op_method_spec.rb
|
213
271
|
- spec/rubocop/cops/parameter_lists_spec.rb
|
214
272
|
- spec/rubocop/cops/parentheses_around_condition_spec.rb
|
215
|
-
- spec/rubocop/cops/
|
273
|
+
- spec/rubocop/cops/percent_r_spec.rb
|
274
|
+
- spec/rubocop/cops/reduce_arguments_spec.rb
|
275
|
+
- spec/rubocop/cops/rescue_exception_spec.rb
|
276
|
+
- spec/rubocop/cops/rescue_modifier_spec.rb
|
277
|
+
- spec/rubocop/cops/semicolon_spec.rb
|
278
|
+
- spec/rubocop/cops/single_line_methods_spec.rb
|
216
279
|
- spec/rubocop/cops/space_after_colon_spec.rb
|
217
280
|
- spec/rubocop/cops/space_after_comma_spec.rb
|
281
|
+
- spec/rubocop/cops/space_after_control_keyword_spec.rb
|
218
282
|
- spec/rubocop/cops/space_after_semicolon_spec.rb
|
219
283
|
- spec/rubocop/cops/space_around_braces_spec.rb
|
220
284
|
- spec/rubocop/cops/space_around_equals_in_default_parameter_spec.rb
|
221
285
|
- spec/rubocop/cops/space_around_operators_spec.rb
|
222
286
|
- spec/rubocop/cops/space_inside_brackets_spec.rb
|
287
|
+
- spec/rubocop/cops/space_inside_hash_literal_braces_spec.rb
|
223
288
|
- spec/rubocop/cops/space_inside_parens_spec.rb
|
224
289
|
- spec/rubocop/cops/string_literals_spec.rb
|
290
|
+
- spec/rubocop/cops/symbol_array_spec.rb
|
291
|
+
- spec/rubocop/cops/symbol_name_spec.rb
|
225
292
|
- spec/rubocop/cops/syntax_spec.rb
|
226
293
|
- spec/rubocop/cops/tab_spec.rb
|
227
294
|
- spec/rubocop/cops/ternary_operator_spec.rb
|
228
295
|
- spec/rubocop/cops/trailing_whitespace_spec.rb
|
296
|
+
- spec/rubocop/cops/trivial_accessors_spec.rb
|
229
297
|
- spec/rubocop/cops/unless_else_spec.rb
|
298
|
+
- spec/rubocop/cops/variable_interpolation_spec.rb
|
230
299
|
- spec/rubocop/cops/when_then_spec.rb
|
300
|
+
- spec/rubocop/cops/word_array_spec.rb
|
231
301
|
- spec/rubocop/reports/emacs_style_spec.rb
|
232
302
|
- spec/rubocop/reports/report_spec.rb
|
233
303
|
- spec/spec_helper.rb
|
304
|
+
- spec/support/file_helper.rb
|
305
|
+
- spec/support/isolated_environment.rb
|
234
306
|
homepage: http://github.com/bbatsov/rubocop
|
235
307
|
licenses:
|
236
308
|
- MIT
|
309
|
+
metadata: {}
|
237
310
|
post_install_message:
|
238
311
|
rdoc_options: []
|
239
312
|
require_paths:
|
240
313
|
- lib
|
241
314
|
required_ruby_version: !ruby/object:Gem::Requirement
|
242
|
-
none: false
|
243
315
|
requirements:
|
244
|
-
- -
|
316
|
+
- - '>='
|
245
317
|
- !ruby/object:Gem::Version
|
246
|
-
version:
|
247
|
-
segments:
|
248
|
-
- 0
|
249
|
-
hash: 1039361930821170753
|
318
|
+
version: 1.9.2
|
250
319
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
251
|
-
none: false
|
252
320
|
requirements:
|
253
|
-
- -
|
321
|
+
- - '>='
|
254
322
|
- !ruby/object:Gem::Version
|
255
323
|
version: '0'
|
256
324
|
requirements: []
|
257
325
|
rubyforge_project:
|
258
|
-
rubygems_version:
|
326
|
+
rubygems_version: 2.0.3
|
259
327
|
signing_key:
|
260
|
-
specification_version:
|
328
|
+
specification_version: 4
|
261
329
|
summary: Automatic Ruby code style checking tool.
|
262
|
-
test_files:
|
330
|
+
test_files:
|
331
|
+
- spec/project_spec.rb
|
332
|
+
- spec/rubocop/cli_spec.rb
|
333
|
+
- spec/rubocop/config_spec.rb
|
334
|
+
- spec/rubocop/config_store_spec.rb
|
335
|
+
- spec/rubocop/cops/access_control_spec.rb
|
336
|
+
- spec/rubocop/cops/alias_spec.rb
|
337
|
+
- spec/rubocop/cops/align_parameters_spec.rb
|
338
|
+
- spec/rubocop/cops/and_or_spec.rb
|
339
|
+
- spec/rubocop/cops/ascii_comments_spec.rb
|
340
|
+
- spec/rubocop/cops/ascii_identifiers_spec.rb
|
341
|
+
- spec/rubocop/cops/avoid_class_vars_spec.rb
|
342
|
+
- spec/rubocop/cops/avoid_for_spec.rb
|
343
|
+
- spec/rubocop/cops/avoid_global_vars_spec.rb
|
344
|
+
- spec/rubocop/cops/avoid_perl_backrefs_spec.rb
|
345
|
+
- spec/rubocop/cops/avoid_perlisms_spec.rb
|
346
|
+
- spec/rubocop/cops/block_comments_spec.rb
|
347
|
+
- spec/rubocop/cops/blocks_spec.rb
|
348
|
+
- spec/rubocop/cops/case_indentation_spec.rb
|
349
|
+
- spec/rubocop/cops/class_and_module_camel_case_spec.rb
|
350
|
+
- spec/rubocop/cops/class_methods_spec.rb
|
351
|
+
- spec/rubocop/cops/collection_methods_spec.rb
|
352
|
+
- spec/rubocop/cops/colon_method_call_spec.rb
|
353
|
+
- spec/rubocop/cops/constant_name_spec.rb
|
354
|
+
- spec/rubocop/cops/cop_spec.rb
|
355
|
+
- spec/rubocop/cops/def_with_parentheses_spec.rb
|
356
|
+
- spec/rubocop/cops/def_without_parentheses_spec.rb
|
357
|
+
- spec/rubocop/cops/empty_line_between_defs_spec.rb
|
358
|
+
- spec/rubocop/cops/empty_lines_spec.rb
|
359
|
+
- spec/rubocop/cops/empty_literal_spec.rb
|
360
|
+
- spec/rubocop/cops/encoding_spec.rb
|
361
|
+
- spec/rubocop/cops/end_of_line_spec.rb
|
362
|
+
- spec/rubocop/cops/ensure_return_spec.rb
|
363
|
+
- spec/rubocop/cops/eval_spec.rb
|
364
|
+
- spec/rubocop/cops/favor_join_spec.rb
|
365
|
+
- spec/rubocop/cops/favor_modifier_spec.rb
|
366
|
+
- spec/rubocop/cops/favor_percent_r_spec.rb
|
367
|
+
- spec/rubocop/cops/favor_sprintf_spec.rb
|
368
|
+
- spec/rubocop/cops/favor_unless_over_negated_if_spec.rb
|
369
|
+
- spec/rubocop/cops/favor_until_over_negated_while_spec.rb
|
370
|
+
- spec/rubocop/cops/handle_exceptions_spec.rb
|
371
|
+
- spec/rubocop/cops/hash_syntax_spec.rb
|
372
|
+
- spec/rubocop/cops/if_with_semicolon_spec.rb
|
373
|
+
- spec/rubocop/cops/leading_comment_space_spec.rb
|
374
|
+
- spec/rubocop/cops/line_continuation_spec.rb
|
375
|
+
- spec/rubocop/cops/line_length_spec.rb
|
376
|
+
- spec/rubocop/cops/loop_spec.rb
|
377
|
+
- spec/rubocop/cops/method_and_variable_snake_case_spec.rb
|
378
|
+
- spec/rubocop/cops/method_length_spec.rb
|
379
|
+
- spec/rubocop/cops/multiline_if_then_spec.rb
|
380
|
+
- spec/rubocop/cops/new_lambda_literal_spec.rb
|
381
|
+
- spec/rubocop/cops/not_spec.rb
|
382
|
+
- spec/rubocop/cops/numeric_literals_spec.rb
|
383
|
+
- spec/rubocop/cops/offence_spec.rb
|
384
|
+
- spec/rubocop/cops/one_line_conditional_spec.rb
|
385
|
+
- spec/rubocop/cops/op_method_spec.rb
|
386
|
+
- spec/rubocop/cops/parameter_lists_spec.rb
|
387
|
+
- spec/rubocop/cops/parentheses_around_condition_spec.rb
|
388
|
+
- spec/rubocop/cops/percent_r_spec.rb
|
389
|
+
- spec/rubocop/cops/reduce_arguments_spec.rb
|
390
|
+
- spec/rubocop/cops/rescue_exception_spec.rb
|
391
|
+
- spec/rubocop/cops/rescue_modifier_spec.rb
|
392
|
+
- spec/rubocop/cops/semicolon_spec.rb
|
393
|
+
- spec/rubocop/cops/single_line_methods_spec.rb
|
394
|
+
- spec/rubocop/cops/space_after_colon_spec.rb
|
395
|
+
- spec/rubocop/cops/space_after_comma_spec.rb
|
396
|
+
- spec/rubocop/cops/space_after_control_keyword_spec.rb
|
397
|
+
- spec/rubocop/cops/space_after_semicolon_spec.rb
|
398
|
+
- spec/rubocop/cops/space_around_braces_spec.rb
|
399
|
+
- spec/rubocop/cops/space_around_equals_in_default_parameter_spec.rb
|
400
|
+
- spec/rubocop/cops/space_around_operators_spec.rb
|
401
|
+
- spec/rubocop/cops/space_inside_brackets_spec.rb
|
402
|
+
- spec/rubocop/cops/space_inside_hash_literal_braces_spec.rb
|
403
|
+
- spec/rubocop/cops/space_inside_parens_spec.rb
|
404
|
+
- spec/rubocop/cops/string_literals_spec.rb
|
405
|
+
- spec/rubocop/cops/symbol_array_spec.rb
|
406
|
+
- spec/rubocop/cops/symbol_name_spec.rb
|
407
|
+
- spec/rubocop/cops/syntax_spec.rb
|
408
|
+
- spec/rubocop/cops/tab_spec.rb
|
409
|
+
- spec/rubocop/cops/ternary_operator_spec.rb
|
410
|
+
- spec/rubocop/cops/trailing_whitespace_spec.rb
|
411
|
+
- spec/rubocop/cops/trivial_accessors_spec.rb
|
412
|
+
- spec/rubocop/cops/unless_else_spec.rb
|
413
|
+
- spec/rubocop/cops/variable_interpolation_spec.rb
|
414
|
+
- spec/rubocop/cops/when_then_spec.rb
|
415
|
+
- spec/rubocop/cops/word_array_spec.rb
|
416
|
+
- spec/rubocop/reports/emacs_style_spec.rb
|
417
|
+
- spec/rubocop/reports/report_spec.rb
|
418
|
+
- spec/spec_helper.rb
|
419
|
+
- spec/support/file_helper.rb
|
420
|
+
- spec/support/isolated_environment.rb
|
421
|
+
has_rdoc:
|
data/.document
DELETED
data/Gemfile.lock
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://rubygems.org/
|
3
|
-
specs:
|
4
|
-
diff-lcs (1.2.2)
|
5
|
-
git (1.2.5)
|
6
|
-
jeweler (1.8.4)
|
7
|
-
bundler (~> 1.0)
|
8
|
-
git (>= 1.2.5)
|
9
|
-
rake
|
10
|
-
rdoc
|
11
|
-
json (1.7.7)
|
12
|
-
multi_json (1.7.2)
|
13
|
-
rake (10.0.4)
|
14
|
-
rdoc (4.0.1)
|
15
|
-
json (~> 1.4)
|
16
|
-
rspec (2.13.0)
|
17
|
-
rspec-core (~> 2.13.0)
|
18
|
-
rspec-expectations (~> 2.13.0)
|
19
|
-
rspec-mocks (~> 2.13.0)
|
20
|
-
rspec-core (2.13.1)
|
21
|
-
rspec-expectations (2.13.0)
|
22
|
-
diff-lcs (>= 1.1.3, < 2.0)
|
23
|
-
rspec-mocks (2.13.0)
|
24
|
-
simplecov (0.7.1)
|
25
|
-
multi_json (~> 1.0)
|
26
|
-
simplecov-html (~> 0.7.1)
|
27
|
-
simplecov-html (0.7.1)
|
28
|
-
term-ansicolor (1.1.4)
|
29
|
-
yard (0.8.5.2)
|
30
|
-
|
31
|
-
PLATFORMS
|
32
|
-
ruby
|
33
|
-
|
34
|
-
DEPENDENCIES
|
35
|
-
bundler
|
36
|
-
jeweler
|
37
|
-
rake
|
38
|
-
rspec
|
39
|
-
simplecov
|
40
|
-
term-ansicolor
|
41
|
-
yard
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.4.0
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
module Rubocop
|
4
|
-
module Cop
|
5
|
-
class AmpersandsPipesVsAndOr < Cop
|
6
|
-
ERROR_MESSAGE =
|
7
|
-
'Use &&/|| for boolean expressions, and/or for control flow.'
|
8
|
-
|
9
|
-
def inspect(file, source, tokens, sexp)
|
10
|
-
[:if, :unless, :while, :until].each { |keyword| check(keyword, sexp) }
|
11
|
-
end
|
12
|
-
|
13
|
-
def check(keyword, sexp)
|
14
|
-
each(keyword, sexp) do |sub_sexp|
|
15
|
-
condition = sub_sexp[1]
|
16
|
-
if condition[0] == :binary && [:and, :or].include?(condition[2])
|
17
|
-
add_offence(:convention,
|
18
|
-
sub_sexp.flatten.grep(Position).first.lineno,
|
19
|
-
ERROR_MESSAGE)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|