rubocop 0.23.0 → 0.24.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.

Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/CHANGELOG.md +35 -1
  4. data/CONTRIBUTING.md +1 -1
  5. data/README.md +6 -6
  6. data/config/default.yml +25 -6
  7. data/config/enabled.yml +20 -0
  8. data/lib/rubocop.rb +10 -13
  9. data/lib/rubocop/cli.rb +23 -20
  10. data/lib/rubocop/cop/lint/def_end_alignment.rb +47 -0
  11. data/lib/rubocop/cop/lint/end_alignment.rb +18 -65
  12. data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +1 -1
  13. data/lib/rubocop/cop/lint/syntax.rb +28 -4
  14. data/lib/rubocop/cop/lint/underscore_prefixed_variable_name.rb +1 -1
  15. data/lib/rubocop/cop/lint/unused_block_argument.rb +13 -1
  16. data/lib/rubocop/cop/lint/useless_access_modifier.rb +3 -2
  17. data/lib/rubocop/cop/lint/useless_assignment.rb +1 -9
  18. data/lib/rubocop/cop/lint/useless_setter_call.rb +28 -20
  19. data/lib/rubocop/cop/mixin/access_modifier_node.rb +18 -0
  20. data/lib/rubocop/cop/mixin/autocorrect_unless_changing_ast.rb +4 -2
  21. data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +42 -0
  22. data/lib/rubocop/cop/mixin/space_before_punctuation.rb +32 -0
  23. data/lib/rubocop/cop/mixin/surrounding_space.rb +7 -8
  24. data/lib/rubocop/cop/mixin/unused_argument.rb +1 -1
  25. data/lib/rubocop/cop/offense.rb +27 -14
  26. data/lib/rubocop/cop/style/access_modifier_indentation.rb +2 -9
  27. data/lib/rubocop/cop/style/attr.rb +3 -1
  28. data/lib/rubocop/cop/style/class_check.rb +42 -0
  29. data/lib/rubocop/cop/style/each_with_object.rb +5 -1
  30. data/lib/rubocop/cop/style/empty_lines.rb +1 -4
  31. data/lib/rubocop/cop/style/empty_lines_around_access_modifier.rb +2 -8
  32. data/lib/rubocop/cop/style/empty_lines_around_body.rb +1 -4
  33. data/lib/rubocop/cop/style/encoding.rb +3 -5
  34. data/lib/rubocop/cop/style/end_of_line.rb +2 -5
  35. data/lib/rubocop/cop/style/file_name.rb +2 -4
  36. data/lib/rubocop/cop/style/if_with_semicolon.rb +2 -1
  37. data/lib/rubocop/cop/style/indentation_consistency.rb +2 -1
  38. data/lib/rubocop/cop/style/indentation_width.rb +25 -5
  39. data/lib/rubocop/cop/style/line_length.rb +59 -5
  40. data/lib/rubocop/cop/style/next.rb +18 -18
  41. data/lib/rubocop/cop/style/numeric_literals.rb +22 -9
  42. data/lib/rubocop/cop/style/parentheses_around_condition.rb +1 -0
  43. data/lib/rubocop/cop/style/redundant_self.rb +1 -1
  44. data/lib/rubocop/cop/style/semicolon.rb +1 -3
  45. data/lib/rubocop/cop/style/space_after_colon.rb +7 -3
  46. data/lib/rubocop/cop/style/space_around_equals_in_parameter_default.rb +3 -1
  47. data/lib/rubocop/cop/style/space_before_comma.rb +16 -0
  48. data/lib/rubocop/cop/style/space_before_semicolon.rb +16 -0
  49. data/lib/rubocop/cop/style/tab.rb +6 -5
  50. data/lib/rubocop/cop/style/trailing_comma.rb +33 -6
  51. data/lib/rubocop/cop/style/trailing_whitespace.rb +4 -3
  52. data/lib/rubocop/cop/style/unneeded_capital_w.rb +6 -0
  53. data/lib/rubocop/cop/style/unneeded_percent_q.rb +45 -0
  54. data/lib/rubocop/cop/style/unneeded_percent_x.rb +2 -3
  55. data/lib/rubocop/cop/style/word_array.rb +1 -1
  56. data/lib/rubocop/cop/team.rb +6 -12
  57. data/lib/rubocop/cop/util.rb +26 -8
  58. data/lib/rubocop/cop/variable_force.rb +3 -6
  59. data/lib/rubocop/cop/variable_force/variable.rb +7 -3
  60. data/lib/rubocop/processed_source.rb +52 -12
  61. data/lib/rubocop/{file_inspector.rb → runner.rb} +50 -59
  62. data/lib/rubocop/version.rb +1 -1
  63. data/relnotes/v0.24.0.md +77 -0
  64. data/rubocop.gemspec +4 -4
  65. data/spec/rubocop/cli_spec.rb +38 -21
  66. data/spec/rubocop/config_loader_spec.rb +7 -6
  67. data/spec/rubocop/config_spec.rb +8 -8
  68. data/spec/rubocop/cop/cop_spec.rb +1 -1
  69. data/spec/rubocop/cop/lint/def_end_alignment_spec.rb +108 -0
  70. data/spec/rubocop/cop/lint/end_alignment_spec.rb +0 -47
  71. data/spec/rubocop/cop/lint/invalid_character_literal_spec.rb +6 -7
  72. data/spec/rubocop/cop/lint/unused_block_argument_spec.rb +19 -0
  73. data/spec/rubocop/cop/lint/useless_assignment_spec.rb +8 -18
  74. data/spec/rubocop/cop/lint/useless_setter_call_spec.rb +99 -51
  75. data/spec/rubocop/cop/offense_spec.rb +3 -3
  76. data/spec/rubocop/cop/rails/delegate_spec.rb +1 -1
  77. data/spec/rubocop/cop/style/access_modifier_indentation_spec.rb +12 -0
  78. data/spec/rubocop/cop/style/align_hash_spec.rb +4 -4
  79. data/spec/rubocop/cop/style/align_parameters_spec.rb +1 -1
  80. data/spec/rubocop/cop/style/attr_spec.rb +12 -2
  81. data/spec/rubocop/cop/style/class_check_spec.rb +41 -0
  82. data/spec/rubocop/cop/style/each_with_object_spec.rb +5 -0
  83. data/spec/rubocop/cop/style/if_with_semicolon_spec.rb +5 -0
  84. data/spec/rubocop/cop/style/indentation_width_spec.rb +95 -0
  85. data/spec/rubocop/cop/style/line_length_spec.rb +75 -0
  86. data/spec/rubocop/cop/style/next_spec.rb +28 -0
  87. data/spec/rubocop/cop/style/numeric_literals_spec.rb +10 -0
  88. data/spec/rubocop/cop/style/parentheses_around_condition_spec.rb +5 -0
  89. data/spec/rubocop/cop/style/space_after_colon_spec.rb +17 -0
  90. data/spec/rubocop/cop/style/space_around_equals_in_parameter_default_spec.rb +11 -0
  91. data/spec/rubocop/cop/style/space_around_operators_spec.rb +1 -0
  92. data/spec/rubocop/cop/style/space_before_comma_spec.rb +42 -0
  93. data/spec/rubocop/cop/style/space_before_semicolon_spec.rb +28 -0
  94. data/spec/rubocop/cop/style/trailing_comma_spec.rb +37 -15
  95. data/spec/rubocop/cop/style/unneeded_capital_w_spec.rb +8 -10
  96. data/spec/rubocop/cop/style/unneeded_percent_q_spec.rb +72 -0
  97. data/spec/rubocop/cop/style/word_array_spec.rb +6 -0
  98. data/spec/rubocop/cop/team_spec.rb +8 -8
  99. data/spec/rubocop/cop/util_spec.rb +10 -0
  100. data/spec/rubocop/cop/variable_force/assignment_spec.rb +1 -1
  101. data/spec/rubocop/cop/variable_force/locatable_spec.rb +1 -1
  102. data/spec/rubocop/cop/variable_force/scope_spec.rb +1 -1
  103. data/spec/rubocop/cop/variable_force/variable_spec.rb +4 -4
  104. data/spec/rubocop/formatter/base_formatter_spec.rb +5 -5
  105. data/spec/rubocop/formatter/colorizable_spec.rb +2 -2
  106. data/spec/rubocop/formatter/json_formatter_spec.rb +1 -1
  107. data/spec/rubocop/path_util_spec.rb +15 -15
  108. data/spec/rubocop/processed_source_spec.rb +104 -50
  109. data/spec/rubocop/runner_spec.rb +64 -0
  110. data/spec/spec_helper.rb +8 -10
  111. data/spec/support/shared_examples.rb +22 -0
  112. metadata +39 -15
  113. data/lib/rubocop/source_parser.rb +0 -47
  114. data/spec/rubocop/file_inspector_spec.rb +0 -84
  115. data/spec/rubocop/source_parser_spec.rb +0 -85
@@ -121,14 +121,24 @@ module RuboCop
121
121
  end
122
122
  end
123
123
 
124
- def source_range(source_buffer, preceding_lines, begin_column,
125
- column_count)
126
- newline_length = 1
127
- begin_pos = preceding_lines.reduce(0) do |a, e|
128
- a + e.length + newline_length
129
- end + begin_column
130
- Parser::Source::Range.new(source_buffer, begin_pos,
131
- begin_pos + column_count)
124
+ def source_range(source_buffer, line_number, column, length = 1)
125
+ if column.is_a?(Range)
126
+ column_index = column.begin
127
+ length = numeric_range_size(column)
128
+ else
129
+ column_index = column
130
+ end
131
+
132
+ preceding_line_numbers = (1...line_number)
133
+
134
+ line_begin_pos = preceding_line_numbers.reduce(0) do |pos, line|
135
+ pos + source_buffer.source_line(line).length + 1
136
+ end
137
+
138
+ begin_pos = line_begin_pos + column_index
139
+ end_pos = begin_pos + length
140
+
141
+ Parser::Source::Range.new(source_buffer, begin_pos, end_pos)
132
142
  end
133
143
 
134
144
  def range_with_surrounding_space(range, side = :both)
@@ -160,6 +170,14 @@ module RuboCop
160
170
  end
161
171
  node
162
172
  end
173
+
174
+ # Range#size is not avaialable prior to Ruby 2.0.
175
+ def numeric_range_size(range)
176
+ size = range.end - range.begin
177
+ size += 1 unless range.exclude_end?
178
+ size = 0 if size < 0
179
+ size
180
+ end
163
181
  end
164
182
  end
165
183
  end
@@ -31,12 +31,9 @@ module RuboCop
31
31
  ARGUMENT_DECLARATION_TYPES = [
32
32
  :arg, :optarg, :restarg,
33
33
  :kwarg, :kwoptarg, :kwrestarg,
34
- :blockarg # This doen't mean block argument, it's block-pass (&block).
34
+ :blockarg, # This doen't mean block argument, it's block-pass (&block).
35
+ :shadowarg # This means block local variable (obj.each { |arg; this| }).
35
36
  ].freeze
36
- BLOCK_LOCAL_VARIABLE_DECLARATION_TYPE = :shadowarg
37
- DECLARATION_TYPES = (
38
- ARGUMENT_DECLARATION_TYPES + [BLOCK_LOCAL_VARIABLE_DECLARATION_TYPE]
39
- ).freeze
40
37
 
41
38
  LOGICAL_OPERATOR_ASSIGNMENT_TYPES = [:or_asgn, :and_asgn].freeze
42
39
  OPERATOR_ASSIGNMENT_TYPES =
@@ -105,7 +102,7 @@ module RuboCop
105
102
  # rubocop:disable Style/MethodLength, Style/CyclomaticComplexity
106
103
  def dispatch_node(node)
107
104
  case node.type
108
- when *DECLARATION_TYPES
105
+ when *ARGUMENT_DECLARATION_TYPES
109
106
  process_variable_declaration(node)
110
107
  when VARIABLE_ASSIGNMENT_TYPE
111
108
  process_variable_assignment(node)
@@ -8,7 +8,7 @@ module RuboCop
8
8
  # and some states of the variable.
9
9
  class Variable
10
10
  VARIABLE_DECLARATION_TYPES =
11
- (VARIABLE_ASSIGNMENT_TYPES + DECLARATION_TYPES).freeze
11
+ (VARIABLE_ASSIGNMENT_TYPES + ARGUMENT_DECLARATION_TYPES).freeze
12
12
 
13
13
  attr_reader :name, :declaration_node, :scope,
14
14
  :assignments, :references, :captured_by_block
@@ -76,6 +76,10 @@ module RuboCop
76
76
  @captured_by_block || referenced?
77
77
  end
78
78
 
79
+ def should_be_unused?
80
+ name.to_s.start_with?('_')
81
+ end
82
+
79
83
  def argument?
80
84
  ARGUMENT_DECLARATION_TYPES.include?(@declaration_node.type)
81
85
  end
@@ -88,8 +92,8 @@ module RuboCop
88
92
  argument? && @scope.node.type == :block
89
93
  end
90
94
 
91
- def block_local_variable?
92
- @declaration_node.type == BLOCK_LOCAL_VARIABLE_DECLARATION_TYPE
95
+ def explicit_block_local_variable?
96
+ @declaration_node.type == :shadowarg
93
97
  end
94
98
  end
95
99
  end
@@ -5,16 +5,21 @@ module RuboCop
5
5
  # and other information such as disabled lines for cops.
6
6
  # It also provides a convenient way to access source lines.
7
7
  class ProcessedSource
8
- attr_reader :buffer, :ast, :comments, :tokens, :diagnostics,
9
- :comment_config
8
+ attr_reader :path, :buffer, :ast, :comments, :tokens, :diagnostics,
9
+ :parser_error
10
10
 
11
- def initialize(buffer, ast, comments, tokens, diagnostics)
12
- @buffer = buffer
13
- @ast = ast
14
- @comments = comments
15
- @tokens = tokens
16
- @diagnostics = diagnostics
17
- @comment_config = CommentConfig.new(self)
11
+ def self.from_file(path)
12
+ new(File.read(path), path)
13
+ end
14
+
15
+ def initialize(source, path = nil)
16
+ @path = path
17
+ @diagnostics = []
18
+ parse(source, path)
19
+ end
20
+
21
+ def comment_config
22
+ @comment_config ||= CommentConfig.new(self)
18
23
  end
19
24
 
20
25
  def disabled_line_ranges
@@ -44,14 +49,49 @@ module RuboCop
44
49
  end
45
50
 
46
51
  def valid_syntax?
52
+ return false if @parser_error
47
53
  @diagnostics.none? { |d| [:error, :fatal].include?(d.level) }
48
54
  end
49
55
 
50
- def file_path
51
- @buffer.name
56
+ private
57
+
58
+ def parse(source, path)
59
+ buffer_name = path || '(string)'
60
+ @buffer = Parser::Source::Buffer.new(buffer_name, 1)
61
+
62
+ begin
63
+ @buffer.source = source
64
+ rescue Encoding::UndefinedConversionError, ArgumentError => error
65
+ # TODO: Rescue EncodingError here once the patch in Parser is released.
66
+ # https://github.com/whitequark/parser/pull/156
67
+ @parser_error = error
68
+ return
69
+ end
70
+
71
+ parser = create_parser
72
+
73
+ begin
74
+ @ast, @comments, tokens = parser.tokenize(@buffer)
75
+ rescue Parser::SyntaxError # rubocop:disable Lint/HandleExceptions
76
+ # All errors are in diagnostics. No need to handle exception.
77
+ end
78
+
79
+ @tokens = tokens.map { |t| Token.from_parser_token(t) } if tokens
52
80
  end
53
81
 
54
- private
82
+ def create_parser
83
+ Parser::CurrentRuby.new.tap do |parser|
84
+ # On JRuby and Rubinius, there's a risk that we hang in tokenize() if we
85
+ # don't set the all errors as fatal flag. The problem is caused by a bug
86
+ # in Racc that is discussed in issue #93 of the whitequark/parser
87
+ # project on GitHub.
88
+ parser.diagnostics.all_errors_are_fatal = (RUBY_ENGINE != 'ruby')
89
+ parser.diagnostics.ignore_warnings = false
90
+ parser.diagnostics.consumer = lambda do |diagnostic|
91
+ @diagnostics << diagnostic
92
+ end
93
+ end
94
+ end
55
95
 
56
96
  def init_lines
57
97
  @raw_lines = @buffer.source.lines
@@ -3,63 +3,59 @@
3
3
  module RuboCop
4
4
  # This class handles the processing of files, which includes dealing with
5
5
  # formatters and letting cops inspect the files.
6
- class FileInspector
7
- def initialize(options)
6
+ class Runner
7
+ attr_reader :errors, :aborting
8
+ alias_method :aborting?, :aborting
9
+
10
+ def initialize(options, config_store)
8
11
  @options = options
12
+ @config_store = config_store
9
13
  @errors = []
14
+ @aborting = false
10
15
  end
11
16
 
12
- # Takes a block which it calls once per inspected file. The block shall
13
- # return true if the caller wants to break the loop early.
14
- def process_files(target_files, config_store)
15
- target_files.each(&:freeze).freeze
17
+ def run(paths)
18
+ target_files = find_target_files(paths)
19
+
16
20
  inspected_files = []
17
- any_failed = false
21
+ all_passed = true
18
22
 
19
23
  formatter_set.started(target_files)
20
24
 
21
25
  target_files.each do |file|
22
- break if yield
23
- offenses = process_file(file, config_store)
24
-
25
- any_failed = true if offenses.any? do |o|
26
- o.severity >= fail_level
27
- end
26
+ break if aborting?
27
+ offenses = process_file(file)
28
+ all_passed = false if offenses.any? { |o| considered_failure?(o) }
28
29
  inspected_files << file
29
- break if @options[:fail_fast] && any_failed
30
+ break if @options[:fail_fast] && !all_passed
30
31
  end
31
32
 
32
33
  formatter_set.finished(inspected_files.freeze)
33
-
34
34
  formatter_set.close_output_files
35
- any_failed
35
+
36
+ all_passed
36
37
  end
37
38
 
38
- def display_error_summary
39
- return if @errors.empty?
40
- plural = @errors.count > 1 ? 's' : ''
41
- warn "\n#{@errors.count} error#{plural} occurred:".color(:red)
42
- @errors.each { |error| warn error }
43
- warn 'Errors are usually caused by RuboCop bugs.'
44
- warn 'Please, report your problems to RuboCop\'s issue tracker.'
45
- warn 'Mention the following information in the issue report:'
46
- warn RuboCop::Version.version(true)
39
+ def abort
40
+ @aborting = true
47
41
  end
48
42
 
49
43
  private
50
44
 
51
- def process_file(file, config_store)
45
+ def find_target_files(paths)
46
+ target_finder = TargetFinder.new(@config_store, @options)
47
+ target_files = target_finder.find(paths)
48
+ target_files.each(&:freeze).freeze
49
+ end
50
+
51
+ def process_file(file)
52
52
  puts "Scanning #{file}" if @options[:debug]
53
- processed_source, offenses = process_source(file)
54
53
 
55
- if offenses.any?
56
- formatter_set.file_started(file, offenses)
57
- formatter_set.file_finished(file, offenses.compact.sort.freeze)
58
- return offenses
59
- end
54
+ processed_source = ProcessedSource.from_file(file)
60
55
 
61
- formatter_set.file_started(
62
- file, cop_disabled_line_ranges: processed_source.disabled_line_ranges)
56
+ formatter_set.file_started(file, file_info(processed_source))
57
+
58
+ offenses = []
63
59
 
64
60
  # When running with --auto-correct, we need to inspect the file (which
65
61
  # includes writing a corrected version of it) until no more corrections
@@ -70,38 +66,23 @@ module RuboCop
70
66
  # only keep the corrected ones in order to avoid duplicate reporting.
71
67
  offenses.select!(&:corrected?)
72
68
 
73
- new_offenses, updated_source_file =
74
- inspect_file(processed_source, config_store)
75
- offenses += new_offenses.reject { |n| offenses.include?(n) }
69
+ new_offenses, updated_source_file = inspect_file(processed_source)
70
+ offenses.concat(new_offenses).uniq!
76
71
  break unless updated_source_file
77
72
 
78
73
  # We have to reprocess the source to pickup the changes. Since the
79
74
  # change could (theoretically) introduce parsing errors, we break the
80
75
  # loop if we find any.
81
- processed_source, parse_offenses = process_source(file)
82
- offenses += parse_offenses if parse_offenses.any?
76
+ processed_source = ProcessedSource.from_file(file)
83
77
  end
84
78
 
85
- formatter_set.file_finished(file, offenses.compact.sort.freeze)
86
- offenses
87
- end
88
-
89
- def process_source(file)
90
- begin
91
- processed_source = SourceParser.parse_file(file)
92
- rescue Encoding::UndefinedConversionError, ArgumentError => e
93
- range = Struct.new(:line, :column, :source_line).new(1, 0, '')
94
- return [
95
- nil,
96
- [Cop::Offense.new(:fatal, range, e.message.capitalize + '.',
97
- 'Parser')]]
98
- end
79
+ formatter_set.file_finished(file, offenses.sort.freeze)
99
80
 
100
- [processed_source, []]
81
+ offenses
101
82
  end
102
83
 
103
- def inspect_file(processed_source, config_store)
104
- config = config_store.for(processed_source.file_path)
84
+ def inspect_file(processed_source)
85
+ config = @config_store.for(processed_source.path)
105
86
  team = Cop::Team.new(mobilized_cop_classes(config), config, @options)
106
87
  offenses = team.inspect_file(processed_source)
107
88
  @errors.concat(team.errors)
@@ -148,9 +129,19 @@ module RuboCop
148
129
  end
149
130
  end
150
131
 
151
- def fail_level
152
- @fail_level ||= RuboCop::Cop::Severity.new(
153
- @options[:fail_level] || :refactor)
132
+ def considered_failure?(offense)
133
+ offense.severity >= minimum_severity_to_fail
134
+ end
135
+
136
+ def minimum_severity_to_fail
137
+ @minimum_severity_to_fail ||= begin
138
+ name = @options[:fail_level] || :refactor
139
+ RuboCop::Cop::Severity.new(name)
140
+ end
141
+ end
142
+
143
+ def file_info(processed_source)
144
+ { cop_disabled_line_ranges: processed_source.disabled_line_ranges }
154
145
  end
155
146
  end
156
147
  end
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  # This module holds the RuboCop version information.
5
5
  module Version
6
- STRING = '0.23.0'
6
+ STRING = '0.24.0'
7
7
 
8
8
  MSG = '%s (using Parser %s, running on %s %s %s)'
9
9
 
@@ -0,0 +1,77 @@
1
+ This release is mostly about fixing bugs, but it also features a few new cops.
2
+
3
+ Below is the list of all the gory details. Enjoy!
4
+
5
+ ### New features
6
+
7
+ * [#639](https://github.com/bbatsov/rubocop/issues/639): Support square bracket setters in `UselessSetterCall`. ([@yujinakayama][])
8
+ * [#835](https://github.com/bbatsov/rubocop/issues/835): `UnneededCapitalW` cop does auto-correction. ([@sfeldon][])
9
+ * [#1092](https://github.com/bbatsov/rubocop/issues/1092): New cop `DefEndAlignment` takes over responsibility for checkng alignment of method definition `end`s from `EndAlignment`, and is configurable. ([@jonas054][])
10
+ * [#1145](https://github.com/bbatsov/rubocop/issues/1145): New cop `ClassCheck` enforces consistent use of `is_a?` or `kind_of?`. ([@bbatsov][])
11
+ * [#1161](https://github.com/bbatsov/rubocop/pull/1161): New cop `SpaceBeforeComma` detects spaces before a comma. ([@agrimm][])
12
+ * [#1161](https://github.com/bbatsov/rubocop/pull/1161): New cop `SpaceBeforeSemicolon` detects spaces before a semicolon. ([@agrimm][])
13
+ * [#835](https://github.com/bbatsov/rubocop/issues/835): New cop `UnneededPercentQ` checks for usage of the `%q`/`%Q` syntax when `''` or `""` would do. ([@jonas054][])
14
+ * [#977](https://github.com/bbatsov/rubocop/issues/977): Add `AllowURI` option (enabled by default) to `LineLength` cop. ([@yujinakayama][])
15
+
16
+ ### Changes
17
+
18
+ * Unused block local variables (`obj.each { |arg; this| }`) are now handled by `UnusedBlockArgument` cop instead of `UselessAssignment` cop. ([@yujinakayama][])
19
+ * [#1141](https://github.com/bbatsov/rubocop/issues/1141): Clarify in the message from `TrailingComma` that a trailing comma is never allowed for lists where some items share a line. ([@jonas054][])
20
+
21
+ ### Bugs fixed
22
+
23
+ * [#1133](https://github.com/bbatsov/rubocop/issues/1133): Handle `reduce/inject` with no arguments in `EachWithObject`. ([@bbatsov][])
24
+ * [#1152](https://github.com/bbatsov/rubocop/issues/1152): Handle `while/until` with no body in `Next`. ([@tamird][])
25
+ * Fix a false positive in `UselessSetterCall` for setter call on a local variable that contains a non-local object. ([@yujinakayama][])
26
+ * [#1158](https://github.com/bbatsov/rubocop/issues/1158): Fix auto-correction of floating-point numbers. ([@bbatsov][])
27
+ * [#1159](https://github.com/bbatsov/rubocop/issues/1159): Fix checking of `begin`..`end` structures, blocks, and parenthesized expressions in `IndentationWidth`. ([@jonas054][])
28
+ * [#1159](https://github.com/bbatsov/rubocop/issues/1159): More rigid conditions for when `attr` is considered an offense. ([@jonas054][])
29
+ * [#1167](https://github.com/bbatsov/rubocop/issues/1167): Fix handling of parameters spanning multiple lines in `TrailingComma`. ([@jonas054][])
30
+ * [#1169](https://github.com/bbatsov/rubocop/issues/1169): Fix handling of ternary op conditions in `ParenthesesAroundCondition`. ([@bbatsov][])
31
+ * [#1147](https://github.com/bbatsov/rubocop/issues/1147): WordArray checks arrays with special characters. ([@camilleldn][])
32
+ * Fix a false positive against `return` in a loop in `Next` cop. ([@yujinakayama][])
33
+ * [#1165](https://github.com/bbatsov/rubocop/issues/1165): Support `rescue`/`else`/`ensure` bodies in `IndentationWidth`. ([@jonas054][])
34
+ * Fix false positive for aligned list of values after `when` in `IndentationWidth`. ([@jonas054][])
35
+
36
+ [@bbatsov]: https://github.com/bbatsov
37
+ [@jonas054]: https://github.com/jonas054
38
+ [@yujinakayama]: https://github.com/yujinakayama
39
+ [@dblock]: https://github.com/dblock
40
+ [@nevir]: https://github.com/nevir
41
+ [@daviddavis]: https://github.com/daviddavis
42
+ [@sds]: https://github.com/sds
43
+ [@fancyremarker]: https://github.com/fancyremarker
44
+ [@sinisterchipmunk]: https://github.com/sinisterchipmunk
45
+ [@vonTronje]: https://github.com/vonTronje
46
+ [@agrimm]: https://github.com/agrimm
47
+ [@pmenglund]: https://github.com/pmenglund
48
+ [@chulkilee]: https://github.com/chulkilee
49
+ [@codez]: https://github.com/codez
50
+ [@emou]: https://github.com/emou
51
+ [@skanev]: http://github.com/skanev
52
+ [@claco]: http://github.com/claco
53
+ [@rifraf]: http://github.com/rifraf
54
+ [@scottmatthewman]: https://github.com/scottmatthewman
55
+ [@ma2gedev]: http://github.com/ma2gedev
56
+ [@jeremyolliver]: https://github.com/jeremyolliver
57
+ [@hannestyden]: https://github.com/hannestyden
58
+ [@geniou]: https://github.com/geniou
59
+ [@jkogara]: https://github.com/jkogara
60
+ [@tmorris-fiksu]: https://github.com/tmorris-fiksu
61
+ [@mockdeep]: https://github.com/mockdeep
62
+ [@hiroponz]: https://github.com/hiroponz
63
+ [@tamird]: https://github.com/tamird
64
+ [@fshowalter]: https://github.com/fshowalter
65
+ [@cschramm]: https://github.com/cschramm
66
+ [@bquorning]: https://github.com/bquorning
67
+ [@bcobb]: https://github.com/bcobb
68
+ [@irrationalfab]: https://github.com/irrationalfab
69
+ [@tommeier]: https://github.com/tommeier
70
+ [@sfeldon]: https://github.com/sfeldon
71
+ [@biinari]: https://github.com/biinari
72
+ [@barunio]: https://github.com/barunio
73
+ [@molawson]: https://github.com/molawson
74
+ [@wndhydrnt]: https://github.com/wndhydrnt
75
+ [@ggilder]: https://github.com/ggilder
76
+ [@salbertson]: https://github.com/salbertson
77
+ [@camilleldn]: https://github.com/camilleldn
@@ -9,13 +9,13 @@ Gem::Specification.new do |s|
9
9
  s.version = RuboCop::Version::STRING
10
10
  s.platform = Gem::Platform::RUBY
11
11
  s.required_ruby_version = '>= 1.9.2'
12
- s.authors = ['Bozhidar Batsov']
12
+ s.authors = ['Bozhidar Batsov', 'Jonas Arvidsson', 'Yuji Nakayama']
13
13
  s.description = <<-EOF
14
14
  Automatic Ruby code style checking tool.
15
15
  Aims to enforce the community-driven Ruby Style Guide.
16
16
  EOF
17
17
 
18
- s.email = 'bozhidar@batsov.com'
18
+ s.email = 'rubocop@googlegroups.com'
19
19
  s.files = `git ls-files`.split($RS)
20
20
  s.test_files = s.files.grep(/^spec\//)
21
21
  s.executables = s.files.grep(/^bin\//) { |f| File.basename(f) }
@@ -27,12 +27,12 @@ Gem::Specification.new do |s|
27
27
  s.summary = 'Automatic Ruby code style checking tool.'
28
28
 
29
29
  s.add_runtime_dependency('rainbow', '>= 1.99.1', '< 3.0')
30
- s.add_runtime_dependency('parser', '~> 2.1.9')
30
+ s.add_runtime_dependency('parser', '>= 2.2.0.pre.2', '< 3.0')
31
31
  s.add_runtime_dependency('powerpack', '~> 0.0.6')
32
32
  s.add_runtime_dependency('json', '>= 1.7.7', '< 2')
33
33
  s.add_runtime_dependency('ruby-progressbar', '~> 1.4')
34
34
  s.add_development_dependency('rake', '~> 10.1')
35
- s.add_development_dependency('rspec', '~> 2.14')
35
+ s.add_development_dependency('rspec', '~> 3.0')
36
36
  s.add_development_dependency('yard', '~> 0.8')
37
37
  s.add_development_dependency('bundler', '~> 1.3')
38
38
  s.add_development_dependency('simplecov', '~> 0.7')