ridecharge-rubocop 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (219) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +22 -0
  3. data/.rspec +1 -0
  4. data/.travis.yml +14 -0
  5. data/CHANGELOG.md +0 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +35 -0
  9. data/Rakefile +22 -0
  10. data/bin/ridecharge-rubocop +49 -0
  11. data/config/0default.yml +8 -0
  12. data/config/fleet-magic-todo.yml +380 -0
  13. data/config/rc-todo.yml +190 -0
  14. data/config/ridecharge-rubocop_todo.yml +73 -0
  15. data/config/rubocop/default.yml +308 -0
  16. data/config/rubocop/disabled.yml +9 -0
  17. data/config/rubocop/enabled.yml +648 -0
  18. data/config/standard-todo.yml +24 -0
  19. data/config/tabs.yml +15 -0
  20. data/config/vehicle-todo.yml +195 -0
  21. data/lib/ridecharge/rubocop.rb +2 -0
  22. data/lib/ridecharge/rubocop/version.rb +5 -0
  23. data/lib/rubocop/config_loader_monkeypatch.rb +117 -0
  24. data/lib/rubocop/ridecharge.rb +1 -0
  25. data/ridecharge-rubocop.gemspec +25 -0
  26. data/spec/isolated_environment_spec.rb +24 -0
  27. data/spec/project_spec.rb +118 -0
  28. data/spec/rubocop/cli_spec.rb +1385 -0
  29. data/spec/rubocop/config_loader_spec.rb +328 -0
  30. data/spec/rubocop/config_spec.rb +179 -0
  31. data/spec/rubocop/config_store_spec.rb +53 -0
  32. data/spec/rubocop/cop/commissioner_spec.rb +83 -0
  33. data/spec/rubocop/cop/cop_spec.rb +114 -0
  34. data/spec/rubocop/cop/corrector_spec.rb +59 -0
  35. data/spec/rubocop/cop/lint/ambiguous_operator_spec.rb +113 -0
  36. data/spec/rubocop/cop/lint/ambiguous_regexp_literal_spec.rb +35 -0
  37. data/spec/rubocop/cop/lint/assignment_in_condition_spec.rb +107 -0
  38. data/spec/rubocop/cop/lint/block_alignment_spec.rb +411 -0
  39. data/spec/rubocop/cop/lint/condition_position_spec.rb +49 -0
  40. data/spec/rubocop/cop/lint/debugger_spec.rb +39 -0
  41. data/spec/rubocop/cop/lint/else_layout_spec.rb +65 -0
  42. data/spec/rubocop/cop/lint/empty_ensure_spec.rb +27 -0
  43. data/spec/rubocop/cop/lint/end_alignment_spec.rb +136 -0
  44. data/spec/rubocop/cop/lint/end_in_method_spec.rb +29 -0
  45. data/spec/rubocop/cop/lint/ensure_return_spec.rb +39 -0
  46. data/spec/rubocop/cop/lint/eval_spec.rb +35 -0
  47. data/spec/rubocop/cop/lint/handle_exceptions_spec.rb +30 -0
  48. data/spec/rubocop/cop/lint/invalid_character_literal_spec.rb +33 -0
  49. data/spec/rubocop/cop/lint/literal_in_condition_spec.rb +63 -0
  50. data/spec/rubocop/cop/lint/loop_spec.rb +27 -0
  51. data/spec/rubocop/cop/lint/parentheses_as_grouped_expression_spec.rb +57 -0
  52. data/spec/rubocop/cop/lint/require_parentheses_spec.rb +82 -0
  53. data/spec/rubocop/cop/lint/rescue_exception_spec.rb +131 -0
  54. data/spec/rubocop/cop/lint/shadowing_outer_local_variable_spec.rb +237 -0
  55. data/spec/rubocop/cop/lint/syntax_spec.rb +34 -0
  56. data/spec/rubocop/cop/lint/unreachable_code_spec.rb +63 -0
  57. data/spec/rubocop/cop/lint/useless_assignment_spec.rb +1570 -0
  58. data/spec/rubocop/cop/lint/useless_comparison_spec.rb +30 -0
  59. data/spec/rubocop/cop/lint/useless_else_without_rescue_spec.rb +48 -0
  60. data/spec/rubocop/cop/lint/useless_setter_call_spec.rb +149 -0
  61. data/spec/rubocop/cop/lint/void_spec.rb +57 -0
  62. data/spec/rubocop/cop/offence_spec.rb +133 -0
  63. data/spec/rubocop/cop/rails/default_scope_spec.rb +37 -0
  64. data/spec/rubocop/cop/rails/has_and_belongs_to_many_spec.rb +13 -0
  65. data/spec/rubocop/cop/rails/output_spec.rb +41 -0
  66. data/spec/rubocop/cop/rails/read_attribute_spec.rb +13 -0
  67. data/spec/rubocop/cop/rails/validation_spec.rb +21 -0
  68. data/spec/rubocop/cop/style/access_modifier_indentation_spec.rb +361 -0
  69. data/spec/rubocop/cop/style/accessor_method_name_spec.rb +81 -0
  70. data/spec/rubocop/cop/style/alias_spec.rb +59 -0
  71. data/spec/rubocop/cop/style/align_array_spec.rb +75 -0
  72. data/spec/rubocop/cop/style/align_hash_spec.rb +310 -0
  73. data/spec/rubocop/cop/style/align_parameters_spec.rb +222 -0
  74. data/spec/rubocop/cop/style/and_or_spec.rb +57 -0
  75. data/spec/rubocop/cop/style/ascii_comments_spec.rb +22 -0
  76. data/spec/rubocop/cop/style/ascii_identifiers_spec.rb +36 -0
  77. data/spec/rubocop/cop/style/attr_spec.rb +19 -0
  78. data/spec/rubocop/cop/style/begin_block_spec.rb +13 -0
  79. data/spec/rubocop/cop/style/block_comments_spec.rb +21 -0
  80. data/spec/rubocop/cop/style/block_nesting_spec.rb +156 -0
  81. data/spec/rubocop/cop/style/blocks_spec.rb +99 -0
  82. data/spec/rubocop/cop/style/braces_around_hash_parameters_spec.rb +284 -0
  83. data/spec/rubocop/cop/style/case_equality_spec.rb +12 -0
  84. data/spec/rubocop/cop/style/case_indentation_spec.rb +289 -0
  85. data/spec/rubocop/cop/style/character_literal_spec.rb +37 -0
  86. data/spec/rubocop/cop/style/class_and_module_camel_case_spec.rb +40 -0
  87. data/spec/rubocop/cop/style/class_length_spec.rb +131 -0
  88. data/spec/rubocop/cop/style/class_methods_spec.rb +45 -0
  89. data/spec/rubocop/cop/style/class_vars_spec.rb +19 -0
  90. data/spec/rubocop/cop/style/collection_methods_spec.rb +48 -0
  91. data/spec/rubocop/cop/style/colon_method_call_spec.rb +60 -0
  92. data/spec/rubocop/cop/style/comment_annotation_spec.rb +86 -0
  93. data/spec/rubocop/cop/style/constant_name_spec.rb +65 -0
  94. data/spec/rubocop/cop/style/cyclomatic_complexity_spec.rb +204 -0
  95. data/spec/rubocop/cop/style/def_with_parentheses_spec.rb +39 -0
  96. data/spec/rubocop/cop/style/documentation_spec.rb +123 -0
  97. data/spec/rubocop/cop/style/dot_position_spec.rb +94 -0
  98. data/spec/rubocop/cop/style/empty_line_between_defs_spec.rb +127 -0
  99. data/spec/rubocop/cop/style/empty_lines_around_access_modifier_spec.rb +56 -0
  100. data/spec/rubocop/cop/style/empty_lines_around_body_spec.rb +131 -0
  101. data/spec/rubocop/cop/style/empty_lines_spec.rb +40 -0
  102. data/spec/rubocop/cop/style/empty_literal_spec.rb +100 -0
  103. data/spec/rubocop/cop/style/encoding_spec.rb +56 -0
  104. data/spec/rubocop/cop/style/end_block_spec.rb +13 -0
  105. data/spec/rubocop/cop/style/end_of_line_spec.rb +47 -0
  106. data/spec/rubocop/cop/style/even_odd_spec.rb +75 -0
  107. data/spec/rubocop/cop/style/favor_join_spec.rb +31 -0
  108. data/spec/rubocop/cop/style/favor_sprintf_spec.rb +47 -0
  109. data/spec/rubocop/cop/style/favor_unless_over_negated_if_spec.rb +76 -0
  110. data/spec/rubocop/cop/style/favor_until_over_negated_while_spec.rb +41 -0
  111. data/spec/rubocop/cop/style/final_newline_spec.rb +30 -0
  112. data/spec/rubocop/cop/style/flip_flop_spec.rb +23 -0
  113. data/spec/rubocop/cop/style/for_spec.rb +105 -0
  114. data/spec/rubocop/cop/style/global_vars_spec.rb +34 -0
  115. data/spec/rubocop/cop/style/hash_methods_spec.rb +45 -0
  116. data/spec/rubocop/cop/style/hash_syntax_spec.rb +131 -0
  117. data/spec/rubocop/cop/style/if_unless_modifier_spec.rb +128 -0
  118. data/spec/rubocop/cop/style/if_with_semicolon_spec.rb +19 -0
  119. data/spec/rubocop/cop/style/indentation_consistency_spec.rb +490 -0
  120. data/spec/rubocop/cop/style/indentation_width_spec.rb +470 -0
  121. data/spec/rubocop/cop/style/lambda_call_spec.rb +65 -0
  122. data/spec/rubocop/cop/style/lambda_spec.rb +41 -0
  123. data/spec/rubocop/cop/style/leading_comment_space_spec.rb +64 -0
  124. data/spec/rubocop/cop/style/line_end_concatenation_spec.rb +34 -0
  125. data/spec/rubocop/cop/style/line_length_spec.rb +20 -0
  126. data/spec/rubocop/cop/style/method_call_parentheses_spec.rb +59 -0
  127. data/spec/rubocop/cop/style/method_called_on_do_end_block_spec.rb +60 -0
  128. data/spec/rubocop/cop/style/method_def_parentheses_spec.rb +106 -0
  129. data/spec/rubocop/cop/style/method_length_spec.rb +147 -0
  130. data/spec/rubocop/cop/style/method_name_spec.rb +125 -0
  131. data/spec/rubocop/cop/style/module_function_spec.rb +24 -0
  132. data/spec/rubocop/cop/style/multiline_block_chain_spec.rb +78 -0
  133. data/spec/rubocop/cop/style/multiline_if_then_spec.rb +107 -0
  134. data/spec/rubocop/cop/style/multiline_ternary_operator_spec.rb +18 -0
  135. data/spec/rubocop/cop/style/nested_ternary_operator_spec.rb +21 -0
  136. data/spec/rubocop/cop/style/nil_comparison_spec.rb +30 -0
  137. data/spec/rubocop/cop/style/not_spec.rb +22 -0
  138. data/spec/rubocop/cop/style/numeric_literals_spec.rb +64 -0
  139. data/spec/rubocop/cop/style/one_line_conditional_spec.rb +13 -0
  140. data/spec/rubocop/cop/style/op_method_spec.rb +74 -0
  141. data/spec/rubocop/cop/style/parameter_lists_spec.rb +44 -0
  142. data/spec/rubocop/cop/style/parentheses_around_condition_spec.rb +122 -0
  143. data/spec/rubocop/cop/style/perl_backrefs_spec.rb +17 -0
  144. data/spec/rubocop/cop/style/predicate_name_spec.rb +25 -0
  145. data/spec/rubocop/cop/style/proc_spec.rb +27 -0
  146. data/spec/rubocop/cop/style/raise_args_spec.rb +82 -0
  147. data/spec/rubocop/cop/style/redundant_begin_spec.rb +57 -0
  148. data/spec/rubocop/cop/style/redundant_exception_spec.rb +27 -0
  149. data/spec/rubocop/cop/style/redundant_return_spec.rb +171 -0
  150. data/spec/rubocop/cop/style/redundant_self_spec.rb +142 -0
  151. data/spec/rubocop/cop/style/regexp_literal_spec.rb +83 -0
  152. data/spec/rubocop/cop/style/rescue_modifier_spec.rb +116 -0
  153. data/spec/rubocop/cop/style/semicolon_spec.rb +100 -0
  154. data/spec/rubocop/cop/style/signal_exception_spec.rb +266 -0
  155. data/spec/rubocop/cop/style/single_line_block_params_spec.rb +68 -0
  156. data/spec/rubocop/cop/style/single_line_methods_spec.rb +52 -0
  157. data/spec/rubocop/cop/style/space_after_colon_spec.rb +38 -0
  158. data/spec/rubocop/cop/style/space_after_comma_spec.rb +30 -0
  159. data/spec/rubocop/cop/style/space_after_control_keyword_spec.rb +84 -0
  160. data/spec/rubocop/cop/style/space_after_method_name_spec.rb +70 -0
  161. data/spec/rubocop/cop/style/space_after_not_spec.rb +22 -0
  162. data/spec/rubocop/cop/style/space_after_semicolon_spec.rb +23 -0
  163. data/spec/rubocop/cop/style/space_around_block_braces_spec.rb +283 -0
  164. data/spec/rubocop/cop/style/space_around_equals_in_parameter_default_spec.rb +33 -0
  165. data/spec/rubocop/cop/style/space_around_operators_spec.rb +325 -0
  166. data/spec/rubocop/cop/style/space_before_modifier_keyword_spec.rb +70 -0
  167. data/spec/rubocop/cop/style/space_inside_brackets_spec.rb +52 -0
  168. data/spec/rubocop/cop/style/space_inside_hash_literal_braces_spec.rb +138 -0
  169. data/spec/rubocop/cop/style/space_inside_parens_spec.rb +34 -0
  170. data/spec/rubocop/cop/style/special_global_vars_spec.rb +56 -0
  171. data/spec/rubocop/cop/style/string_literals_spec.rb +212 -0
  172. data/spec/rubocop/cop/style/symbol_array_spec.rb +37 -0
  173. data/spec/rubocop/cop/style/tab_spec.rb +17 -0
  174. data/spec/rubocop/cop/style/trailing_blank_lines_spec.rb +43 -0
  175. data/spec/rubocop/cop/style/trailing_comma_spec.rb +230 -0
  176. data/spec/rubocop/cop/style/trailing_whitespace_spec.rb +30 -0
  177. data/spec/rubocop/cop/style/trivial_accessors_spec.rb +415 -0
  178. data/spec/rubocop/cop/style/unless_else_spec.rb +25 -0
  179. data/spec/rubocop/cop/style/variable_interpolation_spec.rb +47 -0
  180. data/spec/rubocop/cop/style/variable_name_spec.rb +107 -0
  181. data/spec/rubocop/cop/style/when_then_spec.rb +41 -0
  182. data/spec/rubocop/cop/style/while_until_do_spec.rb +53 -0
  183. data/spec/rubocop/cop/style/while_until_modifier_spec.rb +75 -0
  184. data/spec/rubocop/cop/style/word_array_spec.rb +97 -0
  185. data/spec/rubocop/cop/team_spec.rb +156 -0
  186. data/spec/rubocop/cop/util_spec.rb +49 -0
  187. data/spec/rubocop/cop/variable_inspector/assignment_spec.rb +213 -0
  188. data/spec/rubocop/cop/variable_inspector/locatable_spec.rb +734 -0
  189. data/spec/rubocop/cop/variable_inspector/scope_spec.rb +184 -0
  190. data/spec/rubocop/cop/variable_inspector/variable_spec.rb +73 -0
  191. data/spec/rubocop/cop/variable_inspector/variable_table_spec.rb +269 -0
  192. data/spec/rubocop/cop/variable_inspector_spec.rb +29 -0
  193. data/spec/rubocop/file_inspector_spec.rb +78 -0
  194. data/spec/rubocop/formatter/base_formatter_spec.rb +191 -0
  195. data/spec/rubocop/formatter/clang_style_formatter_spec.rb +114 -0
  196. data/spec/rubocop/formatter/colorizable_spec.rb +107 -0
  197. data/spec/rubocop/formatter/disabled_config_formatter_spec.rb +50 -0
  198. data/spec/rubocop/formatter/emacs_style_formatter_spec.rb +62 -0
  199. data/spec/rubocop/formatter/file_list_formatter_spec.rb +33 -0
  200. data/spec/rubocop/formatter/formatter_set_spec.rb +132 -0
  201. data/spec/rubocop/formatter/json_formatter_spec.rb +148 -0
  202. data/spec/rubocop/formatter/offence_count_formatter_spec.rb +52 -0
  203. data/spec/rubocop/formatter/progress_formatter_spec.rb +182 -0
  204. data/spec/rubocop/formatter/simple_text_formatter_spec.rb +123 -0
  205. data/spec/rubocop/options_spec.rb +145 -0
  206. data/spec/rubocop/path_util_spec.rb +42 -0
  207. data/spec/rubocop/processed_source_spec.rb +114 -0
  208. data/spec/rubocop/source_parser_spec.rb +139 -0
  209. data/spec/rubocop/target_finder_spec.rb +180 -0
  210. data/spec/rubocop/token_spec.rb +25 -0
  211. data/spec/spec_helper.rb +136 -0
  212. data/spec/support/ast_helper.rb +15 -0
  213. data/spec/support/file_helper.rb +21 -0
  214. data/spec/support/isolated_environment.rb +34 -0
  215. data/spec/support/mri_syntax_checker.rb +73 -0
  216. data/spec/support/shared_context.rb +22 -0
  217. data/spec/support/shared_examples.rb +33 -0
  218. data/spec/support/statement_modifier_helper.rb +41 -0
  219. metadata +511 -0
@@ -0,0 +1,25 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Rubocop::Token do
6
+ describe '.from_parser_token' do
7
+ subject(:token) { described_class.from_parser_token(parser_token) }
8
+ let(:parser_token) { [type, [text, range]] }
9
+ let(:type) { :kDEF }
10
+ let(:text) { 'def' }
11
+ let(:range) { double('range') }
12
+
13
+ it "sets parser token's type to rubocop token's type" do
14
+ expect(token.type).to eq(type)
15
+ end
16
+
17
+ it "sets parser token's text to rubocop token's text" do
18
+ expect(token.text).to eq(text)
19
+ end
20
+
21
+ it "sets parser token's range to rubocop token's pos" do
22
+ expect(token.pos).to eq(range)
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,136 @@
1
+ # encoding: utf-8
2
+
3
+ if ENV['TRAVIS'] && RUBY_ENGINE == 'jruby'
4
+ # Force JRuby not to select working directory
5
+ # as temporary directory on Travis CI.
6
+ # https://github.com/jruby/jruby/issues/405
7
+ require 'fileutils'
8
+ tmp_dir = ENV['TMPDIR'] || ENV['TMP'] || ENV['TEMP'] ||
9
+ Etc.systmpdir || '/tmp'
10
+ non_world_writable_tmp_dir = File.join(tmp_dir, 'rubocop')
11
+ FileUtils.makedirs(non_world_writable_tmp_dir, mode: 0700)
12
+ ENV['TMPDIR'] = non_world_writable_tmp_dir
13
+ end
14
+
15
+ # From rubocop's spec/spec_helper.
16
+ =begin
17
+ if ENV['TRAVIS'] || ENV['COVERAGE']
18
+ require 'simplecov'
19
+
20
+ if ENV['TRAVIS']
21
+ require 'coveralls'
22
+ SimpleCov.formatter = Coveralls::SimpleCov::Formatter
23
+ end
24
+
25
+ SimpleCov.start do
26
+ add_filter '/spec/'
27
+ add_filter '/vendor/bundle/'
28
+ end
29
+ end
30
+ =end
31
+
32
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
33
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
34
+ require 'rspec'
35
+ require 'rubocop'
36
+ require 'rubocop/cli'
37
+
38
+ # disable colors in specs
39
+ Rainbow.enabled = false
40
+
41
+ module ExitCodeMatchers
42
+ RSpec::Matchers.define :exit_with_code do |code|
43
+ actual = nil
44
+ match do |block|
45
+ begin
46
+ block.call
47
+ rescue SystemExit => e
48
+ actual = e.status
49
+ end
50
+ actual && actual == code
51
+ end
52
+ failure_message_for_should do |block|
53
+ "expected block to call exit(#{code}) but exit" +
54
+ (actual.nil? ? ' not called' : "(#{actual}) was called")
55
+ end
56
+ failure_message_for_should_not do |block|
57
+ "expected block not to call exit(#{code})"
58
+ end
59
+ description do
60
+ "expect block to call exit(#{code})"
61
+ end
62
+ end
63
+ end
64
+
65
+ RSpec.configure do |config|
66
+ broken_filter = lambda do |v|
67
+ v.is_a?(Symbol) ? RUBY_ENGINE == v.to_s : v
68
+ end
69
+ config.filter_run_excluding ruby: ->(v) { !RUBY_VERSION.start_with?(v.to_s) }
70
+ config.filter_run_excluding broken: broken_filter
71
+ config.treat_symbols_as_metadata_keys_with_true_values = true
72
+
73
+ config.expect_with :rspec do |c|
74
+ c.syntax = :expect # disables `should`
75
+ end
76
+
77
+ config.mock_with :rspec do |c|
78
+ c.syntax = :expect # disables `should_receive` and `stub`
79
+ end
80
+
81
+ config.include(ExitCodeMatchers)
82
+ end
83
+
84
+ def inspect_source_file(cop, source)
85
+ Tempfile.open('tmp') { |f| inspect_source(cop, source, f) }
86
+ end
87
+
88
+ def inspect_source(cop, source, file = nil)
89
+ Rubocop::Formatter::DisabledConfigFormatter.config_to_allow_offences = {}
90
+ processed_source = parse_source(source, file)
91
+ fail 'Error parsing example code' unless processed_source.valid_syntax?
92
+ _investigate(cop, processed_source)
93
+ end
94
+
95
+ def parse_source(source, file = nil)
96
+ source = source.join($RS) if source.is_a?(Array)
97
+ if file.is_a? String
98
+ Rubocop::SourceParser.parse(source, file)
99
+ elsif file
100
+ file.write(source)
101
+ file.rewind
102
+ Rubocop::SourceParser.parse(source, file.path)
103
+ else
104
+ Rubocop::SourceParser.parse(source)
105
+ end
106
+ end
107
+
108
+ def autocorrect_source(cop, source)
109
+ cop.instance_variable_get(:@options)[:auto_correct] = true
110
+ processed_source = parse_source(source)
111
+ _investigate(cop, processed_source)
112
+
113
+ corrector =
114
+ Rubocop::Cop::Corrector.new(processed_source.buffer, cop.corrections)
115
+ corrector.rewrite
116
+ end
117
+
118
+ def _investigate(cop, processed_source)
119
+ commissioner = Rubocop::Cop::Commissioner.new([cop], raise_error: true)
120
+ commissioner.investigate(processed_source)
121
+ commissioner
122
+ end
123
+
124
+ class Rubocop::Cop::Cop
125
+ def messages
126
+ offences.sort.map(&:message)
127
+ end
128
+
129
+ def highlights
130
+ offences.sort.map { |o| o.location.source }
131
+ end
132
+ end
133
+
134
+ # Requires supporting files with custom matchers and macros, etc,
135
+ # in ./support/ and its subdirectories.
136
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
@@ -0,0 +1,15 @@
1
+ # encoding: utf-8
2
+
3
+ module ASTHelper
4
+ def scan_node(node, options = {}, &block)
5
+ yield node if options[:include_origin_node]
6
+
7
+ node.children.each do |child|
8
+ next unless child.is_a?(Parser::AST::Node)
9
+ yield child
10
+ scan_node(child, &block)
11
+ end
12
+
13
+ nil
14
+ end
15
+ end
@@ -0,0 +1,21 @@
1
+ # encoding: utf-8
2
+
3
+ require 'fileutils'
4
+
5
+ module FileHelper
6
+ def create_file(file_path, content)
7
+ file_path = File.expand_path(file_path)
8
+
9
+ dir_path = File.dirname(file_path)
10
+ FileUtils.makedirs dir_path unless File.exists?(dir_path)
11
+
12
+ File.open(file_path, 'w') do |file|
13
+ case content
14
+ when String
15
+ file.puts content
16
+ when Array
17
+ file.puts content.join("\n")
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,34 @@
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
+ # Make sure to expand all symlinks in the path first. Otherwise we may
12
+ # get mismatched pathnames when loading config files later on.
13
+ tmpdir = File.realpath(tmpdir)
14
+
15
+ # Make upwards search for .rubocop.yml files stop at this directory.
16
+ Rubocop::ConfigLoader.root_level = tmpdir
17
+
18
+ begin
19
+ virtual_home = File.expand_path(File.join(tmpdir, 'home'))
20
+ Dir.mkdir(virtual_home)
21
+ ENV['HOME'] = virtual_home
22
+
23
+ working_dir = File.join(tmpdir, 'work')
24
+ Dir.mkdir(working_dir)
25
+
26
+ Dir.chdir(working_dir) do
27
+ example.run
28
+ end
29
+ ensure
30
+ ENV['HOME'] = original_home
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,73 @@
1
+ # encoding: utf-8
2
+
3
+ require 'open3'
4
+
5
+ # The reincarnation of syntax cop :)
6
+ module MRISyntaxChecker
7
+ module_function
8
+
9
+ def offences_for_source(source, fake_cop_name = 'Syntax', grep_message = nil)
10
+ if source.is_a?(Array)
11
+ source_lines = source
12
+ source = source_lines.join("\n")
13
+ else
14
+ source_lines = source.each_line.to_a
15
+ end
16
+
17
+ source_buffer = Parser::Source::Buffer.new('test', 1)
18
+ source_buffer.source = source
19
+
20
+ offences = check_syntax(source).each_line.map do |line|
21
+ check_line(line, source_lines, source_buffer, fake_cop_name,
22
+ grep_message)
23
+ end
24
+
25
+ offences.compact
26
+ end
27
+
28
+ def check_line(line, source_lines, source_buffer, fake_cop_name,
29
+ grep_message)
30
+ line_number, severity, message = process_line(line)
31
+ return unless line_number
32
+ return if grep_message && !message.include?(grep_message)
33
+ begin_pos = source_lines[0...(line_number - 1)].reduce(0) do |a, e|
34
+ a + e.length + "\n".length
35
+ end
36
+ Rubocop::Cop::Offence.new(severity,
37
+ Parser::Source::Range.new(source_buffer,
38
+ begin_pos,
39
+ begin_pos + 1),
40
+ message.capitalize,
41
+ fake_cop_name)
42
+ end
43
+
44
+ def check_syntax(source)
45
+ fail 'Must be running with MRI' unless RUBY_ENGINE == 'ruby'
46
+
47
+ stdin, stderr, thread = nil
48
+
49
+ # It's extremely important to run the syntax check in a
50
+ # clean environment - otherwise it will be extremely slow.
51
+ if defined? Bundler
52
+ Bundler.with_clean_env do
53
+ stdin, _, stderr, thread = Open3.popen3('ruby', '-cw')
54
+ end
55
+ else
56
+ stdin, _, stderr, thread = Open3.popen3('ruby', '-cw')
57
+ end
58
+
59
+ stdin.write(source)
60
+ stdin.close
61
+ thread.join
62
+
63
+ stderr.read
64
+ end
65
+
66
+ def process_line(line)
67
+ match_data = line.match(/.+:(\d+): (warning: )?(.+)/)
68
+ return nil unless match_data
69
+ line_number, warning, message = match_data.captures
70
+ severity = warning ? :warning : :error
71
+ [line_number.to_i, severity, message]
72
+ end
73
+ end
@@ -0,0 +1,22 @@
1
+ # encoding: utf-8
2
+
3
+ # `cop_config` must be declared with #let.
4
+ shared_context 'config', :config do
5
+ let(:config) do
6
+ # Module#<
7
+ unless described_class < Rubocop::Cop::Cop
8
+ fail '`config` must be used in `describe SomeCopClass do .. end`'
9
+ end
10
+
11
+ unless cop_config.is_a?(Hash)
12
+ fail '`cop_config` must be declared with #let'
13
+ end
14
+
15
+ cop_name = described_class.cop_name
16
+ hash = {
17
+ cop_name =>
18
+ Rubocop::ConfigLoader.default_configuration[cop_name].merge(cop_config)
19
+ }
20
+ Rubocop::Config.new(hash)
21
+ end
22
+ end
@@ -0,0 +1,33 @@
1
+ # encoding: utf-8
2
+
3
+ # `cop` and `source` must be declared with #let.
4
+
5
+ shared_examples_for 'accepts' do
6
+ it 'accepts' do
7
+ inspect_source(cop, source)
8
+ expect(cop.offences).to be_empty
9
+ end
10
+ end
11
+
12
+ shared_examples_for 'mimics MRI 2.1' do |grep_mri_warning|
13
+ if RUBY_ENGINE == 'ruby' && RUBY_VERSION.start_with?('2.1')
14
+ it "mimics MRI #{RUBY_VERSION} built-in syntax checking" do
15
+ inspect_source(cop, source)
16
+ offences_by_mri = MRISyntaxChecker.offences_for_source(
17
+ source, cop.name, grep_mri_warning
18
+ )
19
+
20
+ # Compare objects before comparing counts for clear failure output.
21
+ cop.offences.each_with_index do |offence_by_cop, index|
22
+ offence_by_mri = offences_by_mri[index]
23
+ # Exclude column attribute since MRI does not
24
+ # output column number.
25
+ [:severity, :line, :cop_name].each do |a|
26
+ expect(offence_by_cop.send(a)).to eq(offence_by_mri.send(a))
27
+ end
28
+ end
29
+
30
+ expect(cop.offences.count).to eq(offences_by_mri.count)
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,41 @@
1
+ # encoding: utf-8
2
+
3
+ module StatementModifierHelper
4
+ def check_empty(cop, keyword)
5
+ inspect_source(cop, ["#{keyword} cond",
6
+ 'end'])
7
+ expect(cop.offences).to be_empty
8
+ end
9
+
10
+ def check_really_short(cop, keyword)
11
+ inspect_source(cop, ["#{keyword} a",
12
+ ' b',
13
+ 'end'])
14
+ expect(cop.messages).to eq(
15
+ ["Favor modifier #{keyword} usage when you have a single-line body."])
16
+ expect(cop.offences.map { |o| o.location.source }).to eq([keyword])
17
+ end
18
+
19
+ def check_too_long(cop, keyword)
20
+ # This statement is one character too long to fit.
21
+ condition = 'a' * (40 - keyword.length)
22
+ body = 'b' * 36
23
+ expect(" #{body} #{keyword} #{condition}".length).to eq(80)
24
+
25
+ inspect_source(cop,
26
+ [" #{keyword} #{condition}",
27
+ " #{body}",
28
+ ' end'])
29
+
30
+ expect(cop.offences).to be_empty
31
+ end
32
+
33
+ def check_short_multiline(cop, keyword)
34
+ inspect_source(cop,
35
+ ["#{keyword} ENV['COVERAGE']",
36
+ " require 'simplecov'",
37
+ ' SimpleCov.start',
38
+ 'end'])
39
+ expect(cop.messages).to be_empty
40
+ end
41
+ end
metadata ADDED
@@ -0,0 +1,511 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ridecharge-rubocop
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Tim Snowhite
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-07-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rubocop
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.18.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.18.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.6'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.14'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.14'
69
+ description: our special blend of crazy
70
+ email:
71
+ - tsnowhite@taximagic.com
72
+ executables:
73
+ - ridecharge-rubocop
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - ".rspec"
79
+ - ".travis.yml"
80
+ - CHANGELOG.md
81
+ - Gemfile
82
+ - LICENSE.txt
83
+ - README.md
84
+ - Rakefile
85
+ - bin/ridecharge-rubocop
86
+ - config/0default.yml
87
+ - config/fleet-magic-todo.yml
88
+ - config/rc-todo.yml
89
+ - config/ridecharge-rubocop_todo.yml
90
+ - config/rubocop/default.yml
91
+ - config/rubocop/disabled.yml
92
+ - config/rubocop/enabled.yml
93
+ - config/standard-todo.yml
94
+ - config/tabs.yml
95
+ - config/vehicle-todo.yml
96
+ - lib/ridecharge/rubocop.rb
97
+ - lib/ridecharge/rubocop/version.rb
98
+ - lib/rubocop/config_loader_monkeypatch.rb
99
+ - lib/rubocop/ridecharge.rb
100
+ - ridecharge-rubocop.gemspec
101
+ - spec/isolated_environment_spec.rb
102
+ - spec/project_spec.rb
103
+ - spec/rubocop/cli_spec.rb
104
+ - spec/rubocop/config_loader_spec.rb
105
+ - spec/rubocop/config_spec.rb
106
+ - spec/rubocop/config_store_spec.rb
107
+ - spec/rubocop/cop/commissioner_spec.rb
108
+ - spec/rubocop/cop/cop_spec.rb
109
+ - spec/rubocop/cop/corrector_spec.rb
110
+ - spec/rubocop/cop/lint/ambiguous_operator_spec.rb
111
+ - spec/rubocop/cop/lint/ambiguous_regexp_literal_spec.rb
112
+ - spec/rubocop/cop/lint/assignment_in_condition_spec.rb
113
+ - spec/rubocop/cop/lint/block_alignment_spec.rb
114
+ - spec/rubocop/cop/lint/condition_position_spec.rb
115
+ - spec/rubocop/cop/lint/debugger_spec.rb
116
+ - spec/rubocop/cop/lint/else_layout_spec.rb
117
+ - spec/rubocop/cop/lint/empty_ensure_spec.rb
118
+ - spec/rubocop/cop/lint/end_alignment_spec.rb
119
+ - spec/rubocop/cop/lint/end_in_method_spec.rb
120
+ - spec/rubocop/cop/lint/ensure_return_spec.rb
121
+ - spec/rubocop/cop/lint/eval_spec.rb
122
+ - spec/rubocop/cop/lint/handle_exceptions_spec.rb
123
+ - spec/rubocop/cop/lint/invalid_character_literal_spec.rb
124
+ - spec/rubocop/cop/lint/literal_in_condition_spec.rb
125
+ - spec/rubocop/cop/lint/loop_spec.rb
126
+ - spec/rubocop/cop/lint/parentheses_as_grouped_expression_spec.rb
127
+ - spec/rubocop/cop/lint/require_parentheses_spec.rb
128
+ - spec/rubocop/cop/lint/rescue_exception_spec.rb
129
+ - spec/rubocop/cop/lint/shadowing_outer_local_variable_spec.rb
130
+ - spec/rubocop/cop/lint/syntax_spec.rb
131
+ - spec/rubocop/cop/lint/unreachable_code_spec.rb
132
+ - spec/rubocop/cop/lint/useless_assignment_spec.rb
133
+ - spec/rubocop/cop/lint/useless_comparison_spec.rb
134
+ - spec/rubocop/cop/lint/useless_else_without_rescue_spec.rb
135
+ - spec/rubocop/cop/lint/useless_setter_call_spec.rb
136
+ - spec/rubocop/cop/lint/void_spec.rb
137
+ - spec/rubocop/cop/offence_spec.rb
138
+ - spec/rubocop/cop/rails/default_scope_spec.rb
139
+ - spec/rubocop/cop/rails/has_and_belongs_to_many_spec.rb
140
+ - spec/rubocop/cop/rails/output_spec.rb
141
+ - spec/rubocop/cop/rails/read_attribute_spec.rb
142
+ - spec/rubocop/cop/rails/validation_spec.rb
143
+ - spec/rubocop/cop/style/access_modifier_indentation_spec.rb
144
+ - spec/rubocop/cop/style/accessor_method_name_spec.rb
145
+ - spec/rubocop/cop/style/alias_spec.rb
146
+ - spec/rubocop/cop/style/align_array_spec.rb
147
+ - spec/rubocop/cop/style/align_hash_spec.rb
148
+ - spec/rubocop/cop/style/align_parameters_spec.rb
149
+ - spec/rubocop/cop/style/and_or_spec.rb
150
+ - spec/rubocop/cop/style/ascii_comments_spec.rb
151
+ - spec/rubocop/cop/style/ascii_identifiers_spec.rb
152
+ - spec/rubocop/cop/style/attr_spec.rb
153
+ - spec/rubocop/cop/style/begin_block_spec.rb
154
+ - spec/rubocop/cop/style/block_comments_spec.rb
155
+ - spec/rubocop/cop/style/block_nesting_spec.rb
156
+ - spec/rubocop/cop/style/blocks_spec.rb
157
+ - spec/rubocop/cop/style/braces_around_hash_parameters_spec.rb
158
+ - spec/rubocop/cop/style/case_equality_spec.rb
159
+ - spec/rubocop/cop/style/case_indentation_spec.rb
160
+ - spec/rubocop/cop/style/character_literal_spec.rb
161
+ - spec/rubocop/cop/style/class_and_module_camel_case_spec.rb
162
+ - spec/rubocop/cop/style/class_length_spec.rb
163
+ - spec/rubocop/cop/style/class_methods_spec.rb
164
+ - spec/rubocop/cop/style/class_vars_spec.rb
165
+ - spec/rubocop/cop/style/collection_methods_spec.rb
166
+ - spec/rubocop/cop/style/colon_method_call_spec.rb
167
+ - spec/rubocop/cop/style/comment_annotation_spec.rb
168
+ - spec/rubocop/cop/style/constant_name_spec.rb
169
+ - spec/rubocop/cop/style/cyclomatic_complexity_spec.rb
170
+ - spec/rubocop/cop/style/def_with_parentheses_spec.rb
171
+ - spec/rubocop/cop/style/documentation_spec.rb
172
+ - spec/rubocop/cop/style/dot_position_spec.rb
173
+ - spec/rubocop/cop/style/empty_line_between_defs_spec.rb
174
+ - spec/rubocop/cop/style/empty_lines_around_access_modifier_spec.rb
175
+ - spec/rubocop/cop/style/empty_lines_around_body_spec.rb
176
+ - spec/rubocop/cop/style/empty_lines_spec.rb
177
+ - spec/rubocop/cop/style/empty_literal_spec.rb
178
+ - spec/rubocop/cop/style/encoding_spec.rb
179
+ - spec/rubocop/cop/style/end_block_spec.rb
180
+ - spec/rubocop/cop/style/end_of_line_spec.rb
181
+ - spec/rubocop/cop/style/even_odd_spec.rb
182
+ - spec/rubocop/cop/style/favor_join_spec.rb
183
+ - spec/rubocop/cop/style/favor_sprintf_spec.rb
184
+ - spec/rubocop/cop/style/favor_unless_over_negated_if_spec.rb
185
+ - spec/rubocop/cop/style/favor_until_over_negated_while_spec.rb
186
+ - spec/rubocop/cop/style/final_newline_spec.rb
187
+ - spec/rubocop/cop/style/flip_flop_spec.rb
188
+ - spec/rubocop/cop/style/for_spec.rb
189
+ - spec/rubocop/cop/style/global_vars_spec.rb
190
+ - spec/rubocop/cop/style/hash_methods_spec.rb
191
+ - spec/rubocop/cop/style/hash_syntax_spec.rb
192
+ - spec/rubocop/cop/style/if_unless_modifier_spec.rb
193
+ - spec/rubocop/cop/style/if_with_semicolon_spec.rb
194
+ - spec/rubocop/cop/style/indentation_consistency_spec.rb
195
+ - spec/rubocop/cop/style/indentation_width_spec.rb
196
+ - spec/rubocop/cop/style/lambda_call_spec.rb
197
+ - spec/rubocop/cop/style/lambda_spec.rb
198
+ - spec/rubocop/cop/style/leading_comment_space_spec.rb
199
+ - spec/rubocop/cop/style/line_end_concatenation_spec.rb
200
+ - spec/rubocop/cop/style/line_length_spec.rb
201
+ - spec/rubocop/cop/style/method_call_parentheses_spec.rb
202
+ - spec/rubocop/cop/style/method_called_on_do_end_block_spec.rb
203
+ - spec/rubocop/cop/style/method_def_parentheses_spec.rb
204
+ - spec/rubocop/cop/style/method_length_spec.rb
205
+ - spec/rubocop/cop/style/method_name_spec.rb
206
+ - spec/rubocop/cop/style/module_function_spec.rb
207
+ - spec/rubocop/cop/style/multiline_block_chain_spec.rb
208
+ - spec/rubocop/cop/style/multiline_if_then_spec.rb
209
+ - spec/rubocop/cop/style/multiline_ternary_operator_spec.rb
210
+ - spec/rubocop/cop/style/nested_ternary_operator_spec.rb
211
+ - spec/rubocop/cop/style/nil_comparison_spec.rb
212
+ - spec/rubocop/cop/style/not_spec.rb
213
+ - spec/rubocop/cop/style/numeric_literals_spec.rb
214
+ - spec/rubocop/cop/style/one_line_conditional_spec.rb
215
+ - spec/rubocop/cop/style/op_method_spec.rb
216
+ - spec/rubocop/cop/style/parameter_lists_spec.rb
217
+ - spec/rubocop/cop/style/parentheses_around_condition_spec.rb
218
+ - spec/rubocop/cop/style/perl_backrefs_spec.rb
219
+ - spec/rubocop/cop/style/predicate_name_spec.rb
220
+ - spec/rubocop/cop/style/proc_spec.rb
221
+ - spec/rubocop/cop/style/raise_args_spec.rb
222
+ - spec/rubocop/cop/style/redundant_begin_spec.rb
223
+ - spec/rubocop/cop/style/redundant_exception_spec.rb
224
+ - spec/rubocop/cop/style/redundant_return_spec.rb
225
+ - spec/rubocop/cop/style/redundant_self_spec.rb
226
+ - spec/rubocop/cop/style/regexp_literal_spec.rb
227
+ - spec/rubocop/cop/style/rescue_modifier_spec.rb
228
+ - spec/rubocop/cop/style/semicolon_spec.rb
229
+ - spec/rubocop/cop/style/signal_exception_spec.rb
230
+ - spec/rubocop/cop/style/single_line_block_params_spec.rb
231
+ - spec/rubocop/cop/style/single_line_methods_spec.rb
232
+ - spec/rubocop/cop/style/space_after_colon_spec.rb
233
+ - spec/rubocop/cop/style/space_after_comma_spec.rb
234
+ - spec/rubocop/cop/style/space_after_control_keyword_spec.rb
235
+ - spec/rubocop/cop/style/space_after_method_name_spec.rb
236
+ - spec/rubocop/cop/style/space_after_not_spec.rb
237
+ - spec/rubocop/cop/style/space_after_semicolon_spec.rb
238
+ - spec/rubocop/cop/style/space_around_block_braces_spec.rb
239
+ - spec/rubocop/cop/style/space_around_equals_in_parameter_default_spec.rb
240
+ - spec/rubocop/cop/style/space_around_operators_spec.rb
241
+ - spec/rubocop/cop/style/space_before_modifier_keyword_spec.rb
242
+ - spec/rubocop/cop/style/space_inside_brackets_spec.rb
243
+ - spec/rubocop/cop/style/space_inside_hash_literal_braces_spec.rb
244
+ - spec/rubocop/cop/style/space_inside_parens_spec.rb
245
+ - spec/rubocop/cop/style/special_global_vars_spec.rb
246
+ - spec/rubocop/cop/style/string_literals_spec.rb
247
+ - spec/rubocop/cop/style/symbol_array_spec.rb
248
+ - spec/rubocop/cop/style/tab_spec.rb
249
+ - spec/rubocop/cop/style/trailing_blank_lines_spec.rb
250
+ - spec/rubocop/cop/style/trailing_comma_spec.rb
251
+ - spec/rubocop/cop/style/trailing_whitespace_spec.rb
252
+ - spec/rubocop/cop/style/trivial_accessors_spec.rb
253
+ - spec/rubocop/cop/style/unless_else_spec.rb
254
+ - spec/rubocop/cop/style/variable_interpolation_spec.rb
255
+ - spec/rubocop/cop/style/variable_name_spec.rb
256
+ - spec/rubocop/cop/style/when_then_spec.rb
257
+ - spec/rubocop/cop/style/while_until_do_spec.rb
258
+ - spec/rubocop/cop/style/while_until_modifier_spec.rb
259
+ - spec/rubocop/cop/style/word_array_spec.rb
260
+ - spec/rubocop/cop/team_spec.rb
261
+ - spec/rubocop/cop/util_spec.rb
262
+ - spec/rubocop/cop/variable_inspector/assignment_spec.rb
263
+ - spec/rubocop/cop/variable_inspector/locatable_spec.rb
264
+ - spec/rubocop/cop/variable_inspector/scope_spec.rb
265
+ - spec/rubocop/cop/variable_inspector/variable_spec.rb
266
+ - spec/rubocop/cop/variable_inspector/variable_table_spec.rb
267
+ - spec/rubocop/cop/variable_inspector_spec.rb
268
+ - spec/rubocop/file_inspector_spec.rb
269
+ - spec/rubocop/formatter/base_formatter_spec.rb
270
+ - spec/rubocop/formatter/clang_style_formatter_spec.rb
271
+ - spec/rubocop/formatter/colorizable_spec.rb
272
+ - spec/rubocop/formatter/disabled_config_formatter_spec.rb
273
+ - spec/rubocop/formatter/emacs_style_formatter_spec.rb
274
+ - spec/rubocop/formatter/file_list_formatter_spec.rb
275
+ - spec/rubocop/formatter/formatter_set_spec.rb
276
+ - spec/rubocop/formatter/json_formatter_spec.rb
277
+ - spec/rubocop/formatter/offence_count_formatter_spec.rb
278
+ - spec/rubocop/formatter/progress_formatter_spec.rb
279
+ - spec/rubocop/formatter/simple_text_formatter_spec.rb
280
+ - spec/rubocop/options_spec.rb
281
+ - spec/rubocop/path_util_spec.rb
282
+ - spec/rubocop/processed_source_spec.rb
283
+ - spec/rubocop/source_parser_spec.rb
284
+ - spec/rubocop/target_finder_spec.rb
285
+ - spec/rubocop/token_spec.rb
286
+ - spec/spec_helper.rb
287
+ - spec/support/ast_helper.rb
288
+ - spec/support/file_helper.rb
289
+ - spec/support/isolated_environment.rb
290
+ - spec/support/mri_syntax_checker.rb
291
+ - spec/support/shared_context.rb
292
+ - spec/support/shared_examples.rb
293
+ - spec/support/statement_modifier_helper.rb
294
+ homepage: ''
295
+ licenses:
296
+ - MIT
297
+ metadata: {}
298
+ post_install_message:
299
+ rdoc_options: []
300
+ require_paths:
301
+ - lib
302
+ required_ruby_version: !ruby/object:Gem::Requirement
303
+ requirements:
304
+ - - ">="
305
+ - !ruby/object:Gem::Version
306
+ version: '0'
307
+ required_rubygems_version: !ruby/object:Gem::Requirement
308
+ requirements:
309
+ - - ">="
310
+ - !ruby/object:Gem::Version
311
+ version: '0'
312
+ requirements: []
313
+ rubyforge_project:
314
+ rubygems_version: 2.2.2
315
+ signing_key:
316
+ specification_version: 4
317
+ summary: Ridecharge Rubocop configuration
318
+ test_files:
319
+ - spec/isolated_environment_spec.rb
320
+ - spec/project_spec.rb
321
+ - spec/rubocop/cli_spec.rb
322
+ - spec/rubocop/config_loader_spec.rb
323
+ - spec/rubocop/config_spec.rb
324
+ - spec/rubocop/config_store_spec.rb
325
+ - spec/rubocop/cop/commissioner_spec.rb
326
+ - spec/rubocop/cop/cop_spec.rb
327
+ - spec/rubocop/cop/corrector_spec.rb
328
+ - spec/rubocop/cop/lint/ambiguous_operator_spec.rb
329
+ - spec/rubocop/cop/lint/ambiguous_regexp_literal_spec.rb
330
+ - spec/rubocop/cop/lint/assignment_in_condition_spec.rb
331
+ - spec/rubocop/cop/lint/block_alignment_spec.rb
332
+ - spec/rubocop/cop/lint/condition_position_spec.rb
333
+ - spec/rubocop/cop/lint/debugger_spec.rb
334
+ - spec/rubocop/cop/lint/else_layout_spec.rb
335
+ - spec/rubocop/cop/lint/empty_ensure_spec.rb
336
+ - spec/rubocop/cop/lint/end_alignment_spec.rb
337
+ - spec/rubocop/cop/lint/end_in_method_spec.rb
338
+ - spec/rubocop/cop/lint/ensure_return_spec.rb
339
+ - spec/rubocop/cop/lint/eval_spec.rb
340
+ - spec/rubocop/cop/lint/handle_exceptions_spec.rb
341
+ - spec/rubocop/cop/lint/invalid_character_literal_spec.rb
342
+ - spec/rubocop/cop/lint/literal_in_condition_spec.rb
343
+ - spec/rubocop/cop/lint/loop_spec.rb
344
+ - spec/rubocop/cop/lint/parentheses_as_grouped_expression_spec.rb
345
+ - spec/rubocop/cop/lint/require_parentheses_spec.rb
346
+ - spec/rubocop/cop/lint/rescue_exception_spec.rb
347
+ - spec/rubocop/cop/lint/shadowing_outer_local_variable_spec.rb
348
+ - spec/rubocop/cop/lint/syntax_spec.rb
349
+ - spec/rubocop/cop/lint/unreachable_code_spec.rb
350
+ - spec/rubocop/cop/lint/useless_assignment_spec.rb
351
+ - spec/rubocop/cop/lint/useless_comparison_spec.rb
352
+ - spec/rubocop/cop/lint/useless_else_without_rescue_spec.rb
353
+ - spec/rubocop/cop/lint/useless_setter_call_spec.rb
354
+ - spec/rubocop/cop/lint/void_spec.rb
355
+ - spec/rubocop/cop/offence_spec.rb
356
+ - spec/rubocop/cop/rails/default_scope_spec.rb
357
+ - spec/rubocop/cop/rails/has_and_belongs_to_many_spec.rb
358
+ - spec/rubocop/cop/rails/output_spec.rb
359
+ - spec/rubocop/cop/rails/read_attribute_spec.rb
360
+ - spec/rubocop/cop/rails/validation_spec.rb
361
+ - spec/rubocop/cop/style/access_modifier_indentation_spec.rb
362
+ - spec/rubocop/cop/style/accessor_method_name_spec.rb
363
+ - spec/rubocop/cop/style/alias_spec.rb
364
+ - spec/rubocop/cop/style/align_array_spec.rb
365
+ - spec/rubocop/cop/style/align_hash_spec.rb
366
+ - spec/rubocop/cop/style/align_parameters_spec.rb
367
+ - spec/rubocop/cop/style/and_or_spec.rb
368
+ - spec/rubocop/cop/style/ascii_comments_spec.rb
369
+ - spec/rubocop/cop/style/ascii_identifiers_spec.rb
370
+ - spec/rubocop/cop/style/attr_spec.rb
371
+ - spec/rubocop/cop/style/begin_block_spec.rb
372
+ - spec/rubocop/cop/style/block_comments_spec.rb
373
+ - spec/rubocop/cop/style/block_nesting_spec.rb
374
+ - spec/rubocop/cop/style/blocks_spec.rb
375
+ - spec/rubocop/cop/style/braces_around_hash_parameters_spec.rb
376
+ - spec/rubocop/cop/style/case_equality_spec.rb
377
+ - spec/rubocop/cop/style/case_indentation_spec.rb
378
+ - spec/rubocop/cop/style/character_literal_spec.rb
379
+ - spec/rubocop/cop/style/class_and_module_camel_case_spec.rb
380
+ - spec/rubocop/cop/style/class_length_spec.rb
381
+ - spec/rubocop/cop/style/class_methods_spec.rb
382
+ - spec/rubocop/cop/style/class_vars_spec.rb
383
+ - spec/rubocop/cop/style/collection_methods_spec.rb
384
+ - spec/rubocop/cop/style/colon_method_call_spec.rb
385
+ - spec/rubocop/cop/style/comment_annotation_spec.rb
386
+ - spec/rubocop/cop/style/constant_name_spec.rb
387
+ - spec/rubocop/cop/style/cyclomatic_complexity_spec.rb
388
+ - spec/rubocop/cop/style/def_with_parentheses_spec.rb
389
+ - spec/rubocop/cop/style/documentation_spec.rb
390
+ - spec/rubocop/cop/style/dot_position_spec.rb
391
+ - spec/rubocop/cop/style/empty_line_between_defs_spec.rb
392
+ - spec/rubocop/cop/style/empty_lines_around_access_modifier_spec.rb
393
+ - spec/rubocop/cop/style/empty_lines_around_body_spec.rb
394
+ - spec/rubocop/cop/style/empty_lines_spec.rb
395
+ - spec/rubocop/cop/style/empty_literal_spec.rb
396
+ - spec/rubocop/cop/style/encoding_spec.rb
397
+ - spec/rubocop/cop/style/end_block_spec.rb
398
+ - spec/rubocop/cop/style/end_of_line_spec.rb
399
+ - spec/rubocop/cop/style/even_odd_spec.rb
400
+ - spec/rubocop/cop/style/favor_join_spec.rb
401
+ - spec/rubocop/cop/style/favor_sprintf_spec.rb
402
+ - spec/rubocop/cop/style/favor_unless_over_negated_if_spec.rb
403
+ - spec/rubocop/cop/style/favor_until_over_negated_while_spec.rb
404
+ - spec/rubocop/cop/style/final_newline_spec.rb
405
+ - spec/rubocop/cop/style/flip_flop_spec.rb
406
+ - spec/rubocop/cop/style/for_spec.rb
407
+ - spec/rubocop/cop/style/global_vars_spec.rb
408
+ - spec/rubocop/cop/style/hash_methods_spec.rb
409
+ - spec/rubocop/cop/style/hash_syntax_spec.rb
410
+ - spec/rubocop/cop/style/if_unless_modifier_spec.rb
411
+ - spec/rubocop/cop/style/if_with_semicolon_spec.rb
412
+ - spec/rubocop/cop/style/indentation_consistency_spec.rb
413
+ - spec/rubocop/cop/style/indentation_width_spec.rb
414
+ - spec/rubocop/cop/style/lambda_call_spec.rb
415
+ - spec/rubocop/cop/style/lambda_spec.rb
416
+ - spec/rubocop/cop/style/leading_comment_space_spec.rb
417
+ - spec/rubocop/cop/style/line_end_concatenation_spec.rb
418
+ - spec/rubocop/cop/style/line_length_spec.rb
419
+ - spec/rubocop/cop/style/method_call_parentheses_spec.rb
420
+ - spec/rubocop/cop/style/method_called_on_do_end_block_spec.rb
421
+ - spec/rubocop/cop/style/method_def_parentheses_spec.rb
422
+ - spec/rubocop/cop/style/method_length_spec.rb
423
+ - spec/rubocop/cop/style/method_name_spec.rb
424
+ - spec/rubocop/cop/style/module_function_spec.rb
425
+ - spec/rubocop/cop/style/multiline_block_chain_spec.rb
426
+ - spec/rubocop/cop/style/multiline_if_then_spec.rb
427
+ - spec/rubocop/cop/style/multiline_ternary_operator_spec.rb
428
+ - spec/rubocop/cop/style/nested_ternary_operator_spec.rb
429
+ - spec/rubocop/cop/style/nil_comparison_spec.rb
430
+ - spec/rubocop/cop/style/not_spec.rb
431
+ - spec/rubocop/cop/style/numeric_literals_spec.rb
432
+ - spec/rubocop/cop/style/one_line_conditional_spec.rb
433
+ - spec/rubocop/cop/style/op_method_spec.rb
434
+ - spec/rubocop/cop/style/parameter_lists_spec.rb
435
+ - spec/rubocop/cop/style/parentheses_around_condition_spec.rb
436
+ - spec/rubocop/cop/style/perl_backrefs_spec.rb
437
+ - spec/rubocop/cop/style/predicate_name_spec.rb
438
+ - spec/rubocop/cop/style/proc_spec.rb
439
+ - spec/rubocop/cop/style/raise_args_spec.rb
440
+ - spec/rubocop/cop/style/redundant_begin_spec.rb
441
+ - spec/rubocop/cop/style/redundant_exception_spec.rb
442
+ - spec/rubocop/cop/style/redundant_return_spec.rb
443
+ - spec/rubocop/cop/style/redundant_self_spec.rb
444
+ - spec/rubocop/cop/style/regexp_literal_spec.rb
445
+ - spec/rubocop/cop/style/rescue_modifier_spec.rb
446
+ - spec/rubocop/cop/style/semicolon_spec.rb
447
+ - spec/rubocop/cop/style/signal_exception_spec.rb
448
+ - spec/rubocop/cop/style/single_line_block_params_spec.rb
449
+ - spec/rubocop/cop/style/single_line_methods_spec.rb
450
+ - spec/rubocop/cop/style/space_after_colon_spec.rb
451
+ - spec/rubocop/cop/style/space_after_comma_spec.rb
452
+ - spec/rubocop/cop/style/space_after_control_keyword_spec.rb
453
+ - spec/rubocop/cop/style/space_after_method_name_spec.rb
454
+ - spec/rubocop/cop/style/space_after_not_spec.rb
455
+ - spec/rubocop/cop/style/space_after_semicolon_spec.rb
456
+ - spec/rubocop/cop/style/space_around_block_braces_spec.rb
457
+ - spec/rubocop/cop/style/space_around_equals_in_parameter_default_spec.rb
458
+ - spec/rubocop/cop/style/space_around_operators_spec.rb
459
+ - spec/rubocop/cop/style/space_before_modifier_keyword_spec.rb
460
+ - spec/rubocop/cop/style/space_inside_brackets_spec.rb
461
+ - spec/rubocop/cop/style/space_inside_hash_literal_braces_spec.rb
462
+ - spec/rubocop/cop/style/space_inside_parens_spec.rb
463
+ - spec/rubocop/cop/style/special_global_vars_spec.rb
464
+ - spec/rubocop/cop/style/string_literals_spec.rb
465
+ - spec/rubocop/cop/style/symbol_array_spec.rb
466
+ - spec/rubocop/cop/style/tab_spec.rb
467
+ - spec/rubocop/cop/style/trailing_blank_lines_spec.rb
468
+ - spec/rubocop/cop/style/trailing_comma_spec.rb
469
+ - spec/rubocop/cop/style/trailing_whitespace_spec.rb
470
+ - spec/rubocop/cop/style/trivial_accessors_spec.rb
471
+ - spec/rubocop/cop/style/unless_else_spec.rb
472
+ - spec/rubocop/cop/style/variable_interpolation_spec.rb
473
+ - spec/rubocop/cop/style/variable_name_spec.rb
474
+ - spec/rubocop/cop/style/when_then_spec.rb
475
+ - spec/rubocop/cop/style/while_until_do_spec.rb
476
+ - spec/rubocop/cop/style/while_until_modifier_spec.rb
477
+ - spec/rubocop/cop/style/word_array_spec.rb
478
+ - spec/rubocop/cop/team_spec.rb
479
+ - spec/rubocop/cop/util_spec.rb
480
+ - spec/rubocop/cop/variable_inspector/assignment_spec.rb
481
+ - spec/rubocop/cop/variable_inspector/locatable_spec.rb
482
+ - spec/rubocop/cop/variable_inspector/scope_spec.rb
483
+ - spec/rubocop/cop/variable_inspector/variable_spec.rb
484
+ - spec/rubocop/cop/variable_inspector/variable_table_spec.rb
485
+ - spec/rubocop/cop/variable_inspector_spec.rb
486
+ - spec/rubocop/file_inspector_spec.rb
487
+ - spec/rubocop/formatter/base_formatter_spec.rb
488
+ - spec/rubocop/formatter/clang_style_formatter_spec.rb
489
+ - spec/rubocop/formatter/colorizable_spec.rb
490
+ - spec/rubocop/formatter/disabled_config_formatter_spec.rb
491
+ - spec/rubocop/formatter/emacs_style_formatter_spec.rb
492
+ - spec/rubocop/formatter/file_list_formatter_spec.rb
493
+ - spec/rubocop/formatter/formatter_set_spec.rb
494
+ - spec/rubocop/formatter/json_formatter_spec.rb
495
+ - spec/rubocop/formatter/offence_count_formatter_spec.rb
496
+ - spec/rubocop/formatter/progress_formatter_spec.rb
497
+ - spec/rubocop/formatter/simple_text_formatter_spec.rb
498
+ - spec/rubocop/options_spec.rb
499
+ - spec/rubocop/path_util_spec.rb
500
+ - spec/rubocop/processed_source_spec.rb
501
+ - spec/rubocop/source_parser_spec.rb
502
+ - spec/rubocop/target_finder_spec.rb
503
+ - spec/rubocop/token_spec.rb
504
+ - spec/spec_helper.rb
505
+ - spec/support/ast_helper.rb
506
+ - spec/support/file_helper.rb
507
+ - spec/support/isolated_environment.rb
508
+ - spec/support/mri_syntax_checker.rb
509
+ - spec/support/shared_context.rb
510
+ - spec/support/shared_examples.rb
511
+ - spec/support/statement_modifier_helper.rb