Hello community,
here is the log from the commit of package rubygem-rubocop for openSUSE:Factory
checked in at 2019-10-16 09:18:03
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-rubocop (Old)
and /work/SRC/openSUSE:Factory/.rubygem-rubocop.new.2352 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-rubocop"
Wed Oct 16 09:18:03 2019 rev:2 rq:738562 version:0.75.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-rubocop/rubygem-rubocop.changes
2019-10-12 22:30:20.531676378 +0200
+++
/work/SRC/openSUSE:Factory/.rubygem-rubocop.new.2352/rubygem-rubocop.changes
2019-10-16 09:18:20.134995889 +0200
@@ -1,0 +2,39 @@
+Tue Oct 15 08:31:57 UTC 2019 - Dan Čermák <[email protected]>
+
+- Update to 0.75.1
+
+ ### Bug fixes
+
+ * [#7391](https://github.com/rubocop-hq/rubocop/issues/7391): Support pacman
+ formatter on Windows. ([@laurenball][])
+ * [#7407](https://github.com/rubocop-hq/rubocop/issues/7407): Make
+ `Style/FormatStringToken` work inside hashes. ([@buehmann][])
+ * [#7389](https://github.com/rubocop-hq/rubocop/issues/7389): Fix an issue
+ where passing a formatter might result in an error depending on what
+ character it started with. ([@jfhinchcliffe][])
+ * [#7397](https://github.com/rubocop-hq/rubocop/issues/7397): Fix extra
+ comments being added to the correction of
+ `Style/SafeNavigation`. ([@rrosenblum][])
+ * [#7378](https://github.com/rubocop-hq/rubocop/pull/7378): Fix heredoc edge
+ cases in `Layout/EmptyLineAfterGuardClause`. ([@gsamokovarov][])
+ * [#7404](https://github.com/rubocop-hq/rubocop/issues/7404): Fix a false
+ negative for `Layout/IndentAssignment` when multiple assignment with line
+ breaks on each line. ([@koic][])
+
+ ### Changes
+
+ * [#7410](https://github.com/rubocop-hq/rubocop/issues/7410):
+ `Style/FormatStringToken` now finds unannotated format sequences in
`printf`
+ arguments. ([@buehmann][])
+ * [#6964](https://github.com/rubocop-hq/rubocop/issues/6964): Set default
+ `IgnoreCopDirectives` to `true` for `Metrics/LineLength`. ([@jdkaplan][])
+
+ [@laurenball]: https://github.com/laurenball
+ [@buehmann]: https://github.com/buehmann
+ [@jfhinchcliffe]: https://github.com/jfhinchcliffe
+ [@rrosenblum]: https://github.com/rrosenblum
+ [@gsamokovarov]: https://github.com/gsamokovarov
+ [@koic]: https://github.com/koic
+ [@jdkaplan]: https://github.com/jdkaplan
+
+-------------------------------------------------------------------
Old:
----
rubocop-0.75.0.gem
New:
----
rubocop-0.75.1.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-rubocop.spec ++++++
--- /var/tmp/diff_new_pack.LV57Gm/_old 2019-10-16 09:18:21.018993610 +0200
+++ /var/tmp/diff_new_pack.LV57Gm/_new 2019-10-16 09:18:21.022993600 +0200
@@ -12,7 +12,7 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
@@ -24,14 +24,14 @@
#
Name: rubygem-rubocop
-Version: 0.75.0
+Version: 0.75.1
Release: 0
%define mod_name rubocop
%define mod_full_name %{mod_name}-%{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-BuildRequires: ruby-macros >= 5
BuildRequires: %{ruby >= 2.3.0}
BuildRequires: %{rubygem gem2rpm}
+BuildRequires: ruby-macros >= 5
BuildRequires: update-alternatives
Url: https://github.com/rubocop-hq/rubocop
Source: https://rubygems.org/gems/%{mod_full_name}.gem
++++++ rubocop-0.75.0.gem -> rubocop-0.75.1.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md 2019-09-30 19:05:10.000000000 +0200
+++ new/README.md 2019-10-14 18:57:49.000000000 +0200
@@ -53,7 +53,7 @@
might want to use a conservative version lock in your `Gemfile`:
```rb
-gem 'rubocop', '~> 0.75.0', require: false
+gem 'rubocop', '~> 0.75.1', require: false
```
## Quickstart
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/config/default.yml new/config/default.yml
--- old/config/default.yml 2019-09-30 19:05:10.000000000 +0200
+++ new/config/default.yml 2019-10-14 18:57:49.000000000 +0200
@@ -1815,7 +1815,7 @@
- https
# The IgnoreCopDirectives option causes the LineLength rule to ignore cop
# directives like '# rubocop: enable ...' when calculating a line's length.
- IgnoreCopDirectives: false
+ IgnoreCopDirectives: true
# The IgnoredPatterns option is a list of !ruby/regexp and/or string
# elements. Strings will be converted to Regexp objects. A line that matches
# any regular expression listed in this option will be ignored by LineLength.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/rubocop/cop/correctors/percent_literal_corrector.rb
new/lib/rubocop/cop/correctors/percent_literal_corrector.rb
--- old/lib/rubocop/cop/correctors/percent_literal_corrector.rb 2019-09-30
19:05:10.000000000 +0200
+++ new/lib/rubocop/cop/correctors/percent_literal_corrector.rb 2019-10-14
18:57:49.000000000 +0200
@@ -98,7 +98,7 @@
end
def fix_escaped_content(word_node, escape, delimiters)
- content = word_node.children.first.to_s
+ content = +word_node.children.first.to_s
content = escape_string(content) if escape
substitute_escaped_delimiters(content, delimiters)
content
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb
new/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb
--- old/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb 2019-09-30
19:05:10.000000000 +0200
+++ new/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb 2019-10-14
18:57:49.000000000 +0200
@@ -45,7 +45,7 @@
return if correct_style?(node)
if node.modifier_form? && last_argument_is_heredoc?(node)
- heredoc_node = last_argument(node)
+ heredoc_node = last_heredoc_argument(node)
return if next_line_empty?(heredoc_line(node, heredoc_node))
@@ -109,16 +109,27 @@
def last_argument_is_heredoc?(node)
last_children = node.if_branch
-
return false unless last_children&.send_type?
- last_argument = last_argument(node)
-
- last_argument.respond_to?(:heredoc?) && last_argument.heredoc?
+ heredoc?(last_heredoc_argument(node))
end
- def last_argument(node)
- node.if_branch.children.last
+ def last_heredoc_argument(node)
+ n = if node.respond_to?(:if_branch)
+ node.if_branch.children.last
+ else
+ node
+ end
+
+ return n if heredoc?(n)
+ return unless n.respond_to?(:arguments)
+
+ n.arguments.each do |argument|
+ node = last_heredoc_argument(argument)
+ return node if node
+ end
+
+ return last_heredoc_argument(n.receiver) if n.respond_to?(:receiver)
end
def heredoc_line(node, heredoc_node)
@@ -129,6 +140,10 @@
node.last_line + num_of_heredoc_lines + END_OF_HEREDOC_LINE
end
+ def heredoc?(node)
+ node.respond_to?(:heredoc?) && node.heredoc?
+ end
+
def offense_location(node)
if node.loc.respond_to?(:end) && node.loc.end
:end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/rubocop/cop/layout/empty_line_after_magic_comment.rb
new/lib/rubocop/cop/layout/empty_line_after_magic_comment.rb
--- old/lib/rubocop/cop/layout/empty_line_after_magic_comment.rb
2019-09-30 19:05:10.000000000 +0200
+++ new/lib/rubocop/cop/layout/empty_line_after_magic_comment.rb
2019-10-14 18:57:49.000000000 +0200
@@ -55,8 +55,8 @@
source
.comments
.take_while { |comment| comment.loc.line < source.ast.loc.line }
- .select { |comment| MagicComment.parse(comment.text).any? }
- .last
+ .reverse
+ .find { |comment| MagicComment.parse(comment.text).any? }
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/rubocop/cop/layout/empty_lines_around_class_body.rb
new/lib/rubocop/cop/layout/empty_lines_around_class_body.rb
--- old/lib/rubocop/cop/layout/empty_lines_around_class_body.rb 2019-09-30
19:05:10.000000000 +0200
+++ new/lib/rubocop/cop/layout/empty_lines_around_class_body.rb 2019-10-14
18:57:49.000000000 +0200
@@ -36,7 +36,7 @@
#
# end
#
- # @example Enforcedstyle: beginning_only
+ # @example EnforcedStyle: beginning_only
# # good
#
# class Foo
@@ -46,7 +46,7 @@
# end
# end
#
- # @example Enforcedstyle: ending_only
+ # @example EnforcedStyle: ending_only
# # good
#
# class Foo
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rubocop/cop/layout/indent_assignment.rb
new/lib/rubocop/cop/layout/indent_assignment.rb
--- old/lib/rubocop/cop/layout/indent_assignment.rb 2019-09-30
19:05:10.000000000 +0200
+++ new/lib/rubocop/cop/layout/indent_assignment.rb 2019-10-14
18:57:49.000000000 +0200
@@ -42,7 +42,8 @@
end
def leftmost_multiple_assignment(node)
- return node unless node.parent&.assignment?
+ return node unless same_line?(node, node.parent) &&
+ node.parent.assignment?
leftmost_multiple_assignment(node.parent)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rubocop/cop/lint/unused_block_argument.rb
new/lib/rubocop/cop/lint/unused_block_argument.rb
--- old/lib/rubocop/cop/lint/unused_block_argument.rb 2019-09-30
19:05:10.000000000 +0200
+++ new/lib/rubocop/cop/lint/unused_block_argument.rb 2019-10-14
18:57:49.000000000 +0200
@@ -6,9 +6,7 @@
# This cop checks for unused block arguments.
#
# @example
- #
# # bad
- #
# do_something do |used, unused|
# puts used
# end
@@ -21,10 +19,7 @@
# puts :baz
# end
#
- # @example
- #
- # #good
- #
+ # # good
# do_something do |used, _unused|
# puts used
# end
@@ -36,6 +31,27 @@
# define_method(:foo) do |_bar|
# puts :baz
# end
+ #
+ # @example IgnoreEmptyBlocks: true (default)
+ # # good
+ # do_something { |unused| }
+ #
+ # @example IgnoreEmptyBlocks: false
+ # # bad
+ # do_something { |unused| }
+ #
+ # @example AllowUnusedKeywordArguments: false (default)
+ # # bad
+ # do_something do |unused: 42|
+ # foo
+ # end
+ #
+ # @example AllowUnusedKeywordArguments: true
+ # # good
+ # do_something do |unused: 42|
+ # foo
+ # end
+ #
class UnusedBlockArgument < Cop
include UnusedArgument
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rubocop/cop/lint/unused_method_argument.rb
new/lib/rubocop/cop/lint/unused_method_argument.rb
--- old/lib/rubocop/cop/lint/unused_method_argument.rb 2019-09-30
19:05:10.000000000 +0200
+++ new/lib/rubocop/cop/lint/unused_method_argument.rb 2019-10-14
18:57:49.000000000 +0200
@@ -6,20 +6,38 @@
# This cop checks for unused method arguments.
#
# @example
- #
# # bad
- #
# def some_method(used, unused, _unused_but_allowed)
# puts used
# end
#
- # @example
- #
# # good
- #
# def some_method(used, _unused, _unused_but_allowed)
# puts used
# end
+ #
+ # @example AllowUnusedKeywordArguments: false (default)
+ # # bad
+ # def do_something(used, unused: 42)
+ # used
+ # end
+ #
+ # @example AllowUnusedKeywordArguments: true
+ # # good
+ # def do_something(used, unused: 42)
+ # used
+ # end
+ #
+ # @example IgnoreEmptyMethods: true (default)
+ # # good
+ # def do_something(unused)
+ # end
+ #
+ # @example IgnoreEmptyMethods: false
+ # # bad
+ # def do_something(unused)
+ # end
+ #
class UnusedMethodArgument < Cop
include UnusedArgument
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rubocop/cop/lint/void.rb
new/lib/rubocop/cop/lint/void.rb
--- old/lib/rubocop/cop/lint/void.rb 2019-09-30 19:05:10.000000000 +0200
+++ new/lib/rubocop/cop/lint/void.rb 2019-10-14 18:57:49.000000000 +0200
@@ -6,55 +6,36 @@
# This cop checks for operators, variables, literals, and nonmutating
# methods used in void context.
#
- # @example
- #
+ # @example CheckForMethodsWithNoSideEffects: false (default)
# # bad
- #
# def some_method
# some_num * 10
# do_something
# end
#
- # @example
- #
- # # bad
- #
# def some_method(some_var)
# some_var
# do_something
# end
#
- # @example
- #
- # # bad, when CheckForMethodsWithNoSideEffects is set true
- #
+ # @example CheckForMethodsWithNoSideEffects: true
+ # # bad
# def some_method(some_array)
# some_array.sort
# do_something(some_array)
# end
#
- # @example
- #
# # good
- #
# def some_method
# do_something
# some_num * 10
# end
#
- # @example
- #
- # # good
- #
# def some_method(some_var)
# do_something
# some_var
# end
#
- # @example
- #
- # # good, when CheckForMethodsWithNoSideEffects is set true
- #
# def some_method(some_array)
# some_array.sort!
# do_something(some_array)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rubocop/cop/style/documentation_method.rb
new/lib/rubocop/cop/style/documentation_method.rb
--- old/lib/rubocop/cop/style/documentation_method.rb 2019-09-30
19:05:10.000000000 +0200
+++ new/lib/rubocop/cop/style/documentation_method.rb 2019-10-14
18:57:49.000000000 +0200
@@ -47,6 +47,50 @@
# def foo.bar
# puts baz
# end
+ #
+ # @example RequireForNonPublicMethods: false (default)
+ # # good
+ # class Foo
+ # protected
+ # def do_something
+ # end
+ # end
+ #
+ # class Foo
+ # private
+ # def do_something
+ # end
+ # end
+ #
+ # @example RequireForNonPublicMethods: true
+ # # bad
+ # class Foo
+ # protected
+ # def do_something
+ # end
+ # end
+ #
+ # class Foo
+ # private
+ # def do_something
+ # end
+ # end
+ #
+ # # good
+ # class Foo
+ # protected
+ # # Documentation
+ # def do_something
+ # end
+ # end
+ #
+ # class Foo
+ # private
+ # # Documentation
+ # def do_something
+ # end
+ # end
+ #
class DocumentationMethod < Cop
include DocumentationComment
include DefNode
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rubocop/cop/style/expand_path_arguments.rb
new/lib/rubocop/cop/style/expand_path_arguments.rb
--- old/lib/rubocop/cop/style/expand_path_arguments.rb 2019-09-30
19:05:10.000000000 +0200
+++ new/lib/rubocop/cop/style/expand_path_arguments.rb 2019-10-14
18:57:49.000000000 +0200
@@ -160,7 +160,7 @@
def depth(current_path)
paths = current_path.split(File::SEPARATOR)
- paths.reject { |path| path == '.' }.count
+ paths.count { |path| path != '.' }
end
def parent_path(current_path)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rubocop/cop/style/format_string_token.rb
new/lib/rubocop/cop/style/format_string_token.rb
--- old/lib/rubocop/cop/style/format_string_token.rb 2019-09-30
19:05:10.000000000 +0200
+++ new/lib/rubocop/cop/style/format_string_token.rb 2019-10-14
18:57:49.000000000 +0200
@@ -8,7 +8,7 @@
# **Note:**
# `unannotated` style cop only works for strings
# which are passed as arguments to those methods:
- # `sprintf`, `format`, `%`.
+ # `printf`, `sprintf`, `format`, `%`.
# The reason is that *unannotated* format is very similar
# to encoded URLs or Date/Time formatting strings.
#
@@ -41,10 +41,7 @@
class FormatStringToken < Cop
include ConfigurableEnforcedStyle
- FORMAT_STRING_METHODS = %i[sprintf format %].freeze
-
def on_str(node)
- return if placeholder_argument?(node)
return if node.each_ancestor(:xstr, :regexp).any?
tokens(node) do |detected_style, token_range|
@@ -61,14 +58,16 @@
private
- def includes_format_methods?(node)
- node.each_ancestor(:send).any? do |ancestor|
- FORMAT_STRING_METHODS.include?(ancestor.method_name)
- end
- end
+ def_node_matcher :format_string_in_typical_context?, <<~PATTERN
+ {
+ ^(send _ {:format :sprintf :printf} %0 ...)
+ ^(send %0 :% _)
+ }
+ PATTERN
def unannotated_format?(node, detected_style)
- detected_style == :unannotated && !includes_format_methods?(node)
+ detected_style == :unannotated &&
+ !format_string_in_typical_context?(node)
end
def message(detected_style)
@@ -95,11 +94,7 @@
if source_map.is_a?(Parser::Source::Map::Heredoc)
source_map.heredoc_body
elsif source_map.begin
- slice_source(
- source_map.expression,
- source_map.expression.begin_pos + 1,
- source_map.expression.end_pos - 1
- )
+ source_map.expression.adjust(begin_pos: +1, end_pos: -1)
else
source_map.expression
end
@@ -110,30 +105,14 @@
format_string.format_sequences.each do |seq|
detected_style = seq.style
- token = slice_source(
- contents,
- contents.begin_pos + seq.begin_pos,
- contents.begin_pos + seq.end_pos
+ token = contents.begin.adjust(
+ begin_pos: seq.begin_pos,
+ end_pos: seq.end_pos
)
yield(detected_style, token)
end
end
-
- def slice_source(source_range, new_begin, new_end)
- Parser::Source::Range.new(
- source_range.source_buffer,
- new_begin,
- new_end
- )
- end
-
- def placeholder_argument?(node)
- return false unless node.parent
- return true if node.parent.pair_type?
-
- placeholder_argument?(node.parent)
- end
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/rubocop/cop/style/method_call_with_args_parentheses.rb
new/lib/rubocop/cop/style/method_call_with_args_parentheses.rb
--- old/lib/rubocop/cop/style/method_call_with_args_parentheses.rb
2019-09-30 19:05:10.000000000 +0200
+++ new/lib/rubocop/cop/style/method_call_with_args_parentheses.rb
2019-10-14 18:57:49.000000000 +0200
@@ -64,20 +64,6 @@
# # okay with `^assert` listed in `IgnoredPatterns`
# assert_equal 'test', x
#
- # # IgnoreMacros: true (default)
- #
- # # good
- # class Foo
- # bar :baz
- # end
- #
- # # IgnoreMacros: false
- #
- # # bad
- # class Foo
- # bar :baz
- # end
- #
# @example EnforcedStyle: omit_parentheses
#
# # bad
@@ -92,7 +78,21 @@
# # good
# foo.enforce strict: true
#
- # # AllowParenthesesInMultilineCall: false (default)
+ # @example IgnoreMacros: true (default)
+ #
+ # # good
+ # class Foo
+ # bar :baz
+ # end
+ #
+ # @example IgnoreMacros: false
+ #
+ # # bad
+ # class Foo
+ # bar :baz
+ # end
+ #
+ # @example AllowParenthesesInMultilineCall: false (default)
#
# # bad
# foo.enforce(
@@ -103,7 +103,7 @@
# foo.enforce \
# strict: true
#
- # # AllowParenthesesInMultilineCall: true
+ # @example AllowParenthesesInMultilineCall: true
#
# # good
# foo.enforce(
@@ -114,7 +114,7 @@
# foo.enforce \
# strict: true
#
- # # AllowParenthesesInChaining: false (default)
+ # @example AllowParenthesesInChaining: false (default)
#
# # bad
# foo().bar(1)
@@ -122,7 +122,7 @@
# # good
# foo().bar 1
#
- # # AllowParenthesesInChaining: true
+ # @example AllowParenthesesInChaining: true
#
# # good
# foo().bar(1)
@@ -130,7 +130,7 @@
# # good
# foo().bar 1
#
- # # AllowParenthesesInCamelCaseMethod: false (default)
+ # @example AllowParenthesesInCamelCaseMethod: false (default)
#
# # bad
# Array(1)
@@ -138,7 +138,7 @@
# # good
# Array 1
#
- # # AllowParenthesesInCamelCaseMethod: true
+ # @example AllowParenthesesInCamelCaseMethod: true
#
# # good
# Array(1)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rubocop/cop/style/redundant_return.rb
new/lib/rubocop/cop/style/redundant_return.rb
--- old/lib/rubocop/cop/style/redundant_return.rb 2019-09-30
19:05:10.000000000 +0200
+++ new/lib/rubocop/cop/style/redundant_return.rb 2019-10-14
18:57:49.000000000 +0200
@@ -35,6 +35,18 @@
# end
# end
#
+ # @example AllowMultipleReturnValues: false (default)
+ # # bad
+ # def test
+ # return x, y
+ # end
+ #
+ # @example AllowMultipleReturnValues: true
+ # # good
+ # def test
+ # return x, y
+ # end
+ #
class RedundantReturn < Cop
include RangeHelp
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rubocop/cop/style/safe_navigation.rb
new/lib/rubocop/cop/style/safe_navigation.rb
--- old/lib/rubocop/cop/style/safe_navigation.rb 2019-09-30
19:05:10.000000000 +0200
+++ new/lib/rubocop/cop/style/safe_navigation.rb 2019-10-14
18:57:49.000000000 +0200
@@ -120,7 +120,7 @@
corrector.remove(begin_range(node, body))
corrector.remove(end_range(node, body))
corrector.insert_before(method_call.loc.dot, '&')
- handle_comments(corrector, method_call)
+ handle_comments(corrector, node, method_call)
add_safe_nav_to_all_methods_in_chain(corrector, method_call, body)
end
@@ -128,12 +128,20 @@
private
- def handle_comments(corrector, method_call)
+ def handle_comments(corrector, node, method_call)
return if processed_source.comments.empty?
- comments = processed_source.comments.map(&:text).join("\n")
corrector.insert_before(method_call.loc.expression,
- comments + "\n")
+ "#{comments(node).join("\n")}\n")
+ end
+
+ def comments(node)
+ comments = processed_source.comments.select do |comment|
+ comment.loc.first_line >= node.loc.first_line &&
+ comment.loc.last_line <= node.loc.last_line
+ end
+
+ comments.map(&:text)
end
def allowed_if_condition?(node)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rubocop/cop/style/semicolon.rb
new/lib/rubocop/cop/style/semicolon.rb
--- old/lib/rubocop/cop/style/semicolon.rb 2019-09-30 19:05:10.000000000
+0200
+++ new/lib/rubocop/cop/style/semicolon.rb 2019-10-14 18:57:49.000000000
+0200
@@ -6,6 +6,9 @@
# This cop checks for multiple expressions placed on the same line.
# It also checks for lines terminated with a semicolon.
#
+ # This cop has `AllowAsExpressionSeparator` configuration option.
+ # It allows `;` to separate several expressions on the same line.
+ #
# @example
# # bad
# foo = 1; bar = 2;
@@ -15,6 +18,14 @@
# foo = 1
# bar = 2
# baz = 3
+ #
+ # @example AllowAsExpressionSeparator: false (default)
+ # # bad
+ # foo = 1; bar = 2
+ #
+ # @example AllowAsExpressionSeparator: true
+ # # good
+ # foo = 1; bar = 2
class Semicolon < Cop
include RangeHelp
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rubocop/formatter/clang_style_formatter.rb
new/lib/rubocop/formatter/clang_style_formatter.rb
--- old/lib/rubocop/formatter/clang_style_formatter.rb 2019-09-30
19:05:10.000000000 +0200
+++ new/lib/rubocop/formatter/clang_style_formatter.rb 2019-10-14
18:57:49.000000000 +0200
@@ -15,9 +15,14 @@
private
def report_offense(file, offense)
- output.printf("%s:%d:%d: %s: %s\n",
- cyan(smart_path(file)), offense.line,
offense.real_column,
- colored_severity_code(offense), message(offense))
+ output.printf(
+ "%<path>s:%<line>d:%<column>d: %<severity>s: %<message>s\n",
+ path: cyan(smart_path(file)),
+ line: offense.line,
+ column: offense.real_column,
+ severity: colored_severity_code(offense),
+ message: message(offense)
+ )
# rubocop:disable Lint/HandleExceptions
begin
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rubocop/formatter/emacs_style_formatter.rb
new/lib/rubocop/formatter/emacs_style_formatter.rb
--- old/lib/rubocop/formatter/emacs_style_formatter.rb 2019-09-30
19:05:10.000000000 +0200
+++ new/lib/rubocop/formatter/emacs_style_formatter.rb 2019-10-14
18:57:49.000000000 +0200
@@ -8,20 +8,30 @@
class EmacsStyleFormatter < BaseFormatter
def file_finished(file, offenses)
offenses.each do |o|
- message =
- if o.corrected_with_todo?
- "[Todo] #{o.message}"
- elsif o.corrected?
- "[Corrected] #{o.message}"
- else
- o.message
- end
-
- output.printf("%s:%d:%d: %s: %s\n",
- file, o.line, o.real_column, o.severity.code,
- message.tr("\n", ' '))
+ output.printf(
+ "%<path>s:%<line>d:%<column>d: %<severity>s: %<message>s\n",
+ path: file,
+ line: o.line,
+ column: o.real_column,
+ severity: o.severity.code,
+ message: message(o)
+ )
end
end
+
+ private
+
+ def message(offense)
+ message =
+ if offense.corrected_with_todo?
+ "[Todo] #{offense.message}"
+ elsif offense.corrected?
+ "[Corrected] #{offense.message}"
+ else
+ offense.message
+ end
+ message.tr("\n", ' ')
+ end
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rubocop/formatter/file_list_formatter.rb
new/lib/rubocop/formatter/file_list_formatter.rb
--- old/lib/rubocop/formatter/file_list_formatter.rb 2019-09-30
19:05:10.000000000 +0200
+++ new/lib/rubocop/formatter/file_list_formatter.rb 2019-10-14
18:57:49.000000000 +0200
@@ -13,7 +13,7 @@
def file_finished(file, offenses)
return if offenses.empty?
- output.printf("%s\n", file)
+ output.printf("%<path>s\n", path: file)
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rubocop/formatter/formatter_set.rb
new/lib/rubocop/formatter/formatter_set.rb
--- old/lib/rubocop/formatter/formatter_set.rb 2019-09-30 19:05:10.000000000
+0200
+++ new/lib/rubocop/formatter/formatter_set.rb 2019-10-14 18:57:49.000000000
+0200
@@ -9,21 +9,21 @@
# which invoke same method of each formatters.
class FormatterSet < Array
BUILTIN_FORMATTERS_FOR_KEYS = {
- 'progress' => ProgressFormatter,
- 'simple' => SimpleTextFormatter,
- 'clang' => ClangStyleFormatter,
- 'fuubar' => FuubarStyleFormatter,
- 'emacs' => EmacsStyleFormatter,
- 'json' => JSONFormatter,
- 'html' => HTMLFormatter,
- 'files' => FileListFormatter,
- 'offenses' => OffenseCountFormatter,
- 'disabled' => DisabledLinesFormatter,
- 'worst' => WorstOffendersFormatter,
- 'tap' => TapFormatter,
- 'quiet' => QuietFormatter,
- 'autogenconf' => AutoGenConfigFormatter,
- 'pacman' => PacmanFormatter
+ '[a]utogenconf' => AutoGenConfigFormatter,
+ '[c]lang' => ClangStyleFormatter,
+ '[d]isabled' => DisabledLinesFormatter,
+ '[e]macs' => EmacsStyleFormatter,
+ '[fi]les' => FileListFormatter,
+ '[fu]ubar' => FuubarStyleFormatter,
+ '[h]tml' => HTMLFormatter,
+ '[j]son' => JSONFormatter,
+ '[o]ffenses' => OffenseCountFormatter,
+ '[pa]cman' => PacmanFormatter,
+ '[p]rogress' => ProgressFormatter,
+ '[q]uiet' => QuietFormatter,
+ '[s]imple' => SimpleTextFormatter,
+ '[t]ap' => TapFormatter,
+ '[w]orst' => WorstOffendersFormatter
}.freeze
FORMATTER_APIS = %i[started finished].freeze
@@ -82,7 +82,7 @@
def builtin_formatter_class(specified_key)
matching_keys = BUILTIN_FORMATTERS_FOR_KEYS.keys.select do |key|
- key.start_with?(specified_key)
+ key =~ /^\[#{specified_key}\]/ || specified_key == key.delete('[]')
end
raise %(No formatter for "#{specified_key}") if matching_keys.empty?
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rubocop/formatter/pacman_formatter.rb
new/lib/rubocop/formatter/pacman_formatter.rb
--- old/lib/rubocop/formatter/pacman_formatter.rb 2019-09-30
19:05:10.000000000 +0200
+++ new/lib/rubocop/formatter/pacman_formatter.rb 2019-10-14
18:57:49.000000000 +0200
@@ -2,7 +2,7 @@
module RuboCop
module Formatter
- # This formatter prints a PACDOT per every file to be analized.
+ # This formatter prints a PACDOT per every file to be analyzed.
# Pacman will "eat" one PACDOT per file when no offense is detected.
# Otherwise it will print a Ghost.
# This is inspired by the Pacman formatter for RSpec by Carlos Rojas.
@@ -49,7 +49,7 @@
def cols
@cols ||= begin
- width = `tput cols`.chomp.to_i
+ _height, width = $stdout.winsize
width.nil? || width.zero? ? FALLBACK_TERMINAL_WIDTH : width
end
end
@@ -68,7 +68,7 @@
def step(character)
regex = /#{Regexp.quote(PACMAN)}|#{Regexp.quote(PACDOT)}/
@progress_line = @progress_line.sub(regex, character)
- output.printf("%s\r", @progress_line)
+ output.printf("%<line>s\r", line: @progress_line)
return unless @progress_line[-1] =~ /ᗣ|\./
@repetitions += 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rubocop/formatter/simple_text_formatter.rb
new/lib/rubocop/formatter/simple_text_formatter.rb
--- old/lib/rubocop/formatter/simple_text_formatter.rb 2019-09-30
19:05:10.000000000 +0200
+++ new/lib/rubocop/formatter/simple_text_formatter.rb 2019-10-14
18:57:49.000000000 +0200
@@ -42,9 +42,13 @@
output.puts yellow("== #{smart_path(file)} ==")
offenses.each do |o|
- output.printf("%s:%3d:%3d: %s\n",
- colored_severity_code(o),
- o.line, o.real_column, message(o))
+ output.printf(
+ "%<severity>s:%3<line>d:%3<column>d: %<message>s\n",
+ severity: colored_severity_code(o),
+ line: o.line,
+ column: o.real_column,
+ message: message(o)
+ )
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rubocop/formatter/tap_formatter.rb
new/lib/rubocop/formatter/tap_formatter.rb
--- old/lib/rubocop/formatter/tap_formatter.rb 2019-09-30 19:05:10.000000000
+0200
+++ new/lib/rubocop/formatter/tap_formatter.rb 2019-10-14 18:57:49.000000000
+0200
@@ -42,9 +42,14 @@
end
def report_offense(file, offense)
- output.printf("# %s:%d:%d: %s: %s\n",
- cyan(smart_path(file)), offense.line,
offense.real_column,
- colored_severity_code(offense), message(offense))
+ output.printf(
+ "# %<path>s:%<line>d:%<column>d: %<severity>s: %<message>s\n",
+ path: cyan(smart_path(file)),
+ line: offense.line,
+ column: offense.real_column,
+ severity: colored_severity_code(offense),
+ message: message(offense)
+ )
# rubocop:disable Lint/HandleExceptions
begin
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rubocop/options.rb new/lib/rubocop/options.rb
--- old/lib/rubocop/options.rb 2019-09-30 19:05:10.000000000 +0200
+++ new/lib/rubocop/options.rb 2019-10-14 18:57:49.000000000 +0200
@@ -367,8 +367,9 @@
# This module contains help texts for command line options.
module OptionsHelp
MAX_EXCL = RuboCop::Options::DEFAULT_MAXIMUM_EXCLUSION_ITEMS.to_s
-
# rubocop:disable Metrics/LineLength
+ FORMATTER_OPTION_LIST =
RuboCop::Formatter::FormatterSet::BUILTIN_FORMATTERS_FOR_KEYS.keys
+
TEXT = {
only: 'Run only the given cop(s).',
only_guide_cops: ['Run only cops for rules that link to
a',
@@ -407,21 +408,8 @@
format: ['Choose an output formatter. This
option',
'can be specified multiple times to
enable',
'multiple formatters at the same
time.',
- ' [p]rogress (default)',
- ' [s]imple',
- ' [c]lang',
- ' [d]isabled cops via inline
comments',
- ' [fu]ubar',
- ' [pa]cman',
- ' [e]macs',
- ' [j]son',
- ' [h]tml',
- ' [fi]les',
- ' [o]ffenses',
- ' [w]orst',
- ' [t]ap',
- ' [q]uiet',
- ' [a]utogenconf',
+ '[p]rogress is used by default',
+ *FORMATTER_OPTION_LIST.map { |item| "
#{item}" },
' custom formatter class name'],
out: ['Write output to a file instead of
STDOUT.',
'This option applies to the
previously',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rubocop/version.rb new/lib/rubocop/version.rb
--- old/lib/rubocop/version.rb 2019-09-30 19:05:10.000000000 +0200
+++ new/lib/rubocop/version.rb 2019-10-14 18:57:49.000000000 +0200
@@ -3,7 +3,7 @@
module RuboCop
# This module holds the RuboCop version information.
module Version
- STRING = '0.75.0'
+ STRING = '0.75.1'
MSG = '%<version>s (using Parser %<parser_version>s, running on ' \
'%<ruby_engine>s %<ruby_version>s %<ruby_platform>s)'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2019-09-30 19:05:10.000000000 +0200
+++ new/metadata 2019-10-14 18:57:49.000000000 +0200
@@ -1,7 +1,7 @@
--- !ruby/object:Gem::Specification
name: rubocop
version: !ruby/object:Gem::Version
- version: 0.75.0
+ version: 0.75.1
platform: ruby
authors:
- Bozhidar Batsov
@@ -10,7 +10,7 @@
autorequire:
bindir: exe
cert_chain: []
-date: 2019-09-30 00:00:00.000000000 Z
+date: 2019-10-14 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: jaro_winkler