Showing 1,637 of 1,651 total issues
Add parentheses to nested method call MiGA::Project.KNOWN_TYPES.is_a? Hash
. Open
assert(MiGA::Project.KNOWN_TYPES.is_a? Hash)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for unparenthesized method calls in the argument list of a parenthesized method call.
Example:
# good
method1(method2(arg), method3(arg))
# bad
method1(method2 arg, method3, arg)
Add parentheses to nested method call md[:tax].is_a? MiGA::Taxonomy
. Open
assert(md[:tax].is_a? MiGA::Taxonomy)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for unparenthesized method calls in the argument list of a parenthesized method call.
Example:
# good
method1(method2(arg), method3(arg))
# bad
method1(method2 arg, method3, arg)
Add parentheses to nested method call md[:tax].alternative(:gtdb).is_a? MiGA::Taxonomy
. Open
assert(md[:tax].alternative(:gtdb).is_a? MiGA::Taxonomy)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for unparenthesized method calls in the argument list of a parenthesized method call.
Example:
# good
method1(method2(arg), method3(arg))
# bad
method1(method2 arg, method3, arg)
Add parentheses to nested method call h.is_a? Hash
. Open
assert(h.is_a? Hash)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for unparenthesized method calls in the argument list of a parenthesized method call.
Example:
# good
method1(method2(arg), method3(arg))
# bad
method1(method2 arg, method3, arg)
Add parentheses to nested method call h.is_a? Hash
. Open
assert(h.is_a? Hash)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for unparenthesized method calls in the argument list of a parenthesized method call.
Example:
# good
method1(method2(arg), method3(arg))
# bad
method1(method2 arg, method3, arg)
Dependencies should be sorted in an alphabetical order within their section of the gemspec. Dependency net-http
should appear before sqlite3
. Open
s.add_runtime_dependency 'net-http'
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Dependencies in the gemspec should be alphabetically sorted.
Example:
# bad
spec.add_dependency 'rubocop'
spec.add_dependency 'rspec'
# good
spec.add_dependency 'rspec'
spec.add_dependency 'rubocop'
# good
spec.add_dependency 'rubocop'
spec.add_dependency 'rspec'
# bad
spec.add_development_dependency 'rubocop'
spec.add_development_dependency 'rspec'
# good
spec.add_development_dependency 'rspec'
spec.add_development_dependency 'rubocop'
# good
spec.add_development_dependency 'rubocop'
spec.add_development_dependency 'rspec'
# bad
spec.add_runtime_dependency 'rubocop'
spec.add_runtime_dependency 'rspec'
# good
spec.add_runtime_dependency 'rspec'
spec.add_runtime_dependency 'rubocop'
# good
spec.add_runtime_dependency 'rubocop'
spec.add_runtime_dependency 'rspec'
# good only if TreatCommentsAsGroupSeparators is true
# For code quality
spec.add_dependency 'rubocop'
# For tests
spec.add_dependency 'rspec'
Add parentheses to nested method call md[:tax].is_a? MiGA::Taxonomy
. Open
assert(md[:tax].is_a? MiGA::Taxonomy)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for unparenthesized method calls in the argument list of a parenthesized method call.
Example:
# good
method1(method2(arg), method3(arg))
# bad
method1(method2 arg, method3, arg)
Dependencies should be sorted in an alphabetical order within their section of the gemspec. Dependency assertions
should appear before test-unit
. Open
s.add_development_dependency 'assertions', '~> 1'
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Dependencies in the gemspec should be alphabetically sorted.
Example:
# bad
spec.add_dependency 'rubocop'
spec.add_dependency 'rspec'
# good
spec.add_dependency 'rspec'
spec.add_dependency 'rubocop'
# good
spec.add_dependency 'rubocop'
spec.add_dependency 'rspec'
# bad
spec.add_development_dependency 'rubocop'
spec.add_development_dependency 'rspec'
# good
spec.add_development_dependency 'rspec'
spec.add_development_dependency 'rubocop'
# good
spec.add_development_dependency 'rubocop'
spec.add_development_dependency 'rspec'
# bad
spec.add_runtime_dependency 'rubocop'
spec.add_runtime_dependency 'rspec'
# good
spec.add_runtime_dependency 'rspec'
spec.add_runtime_dependency 'rubocop'
# good
spec.add_runtime_dependency 'rubocop'
spec.add_runtime_dependency 'rspec'
# good only if TreatCommentsAsGroupSeparators is true
# For code quality
spec.add_dependency 'rubocop'
# For tests
spec.add_dependency 'rspec'
Add parentheses to nested method call MiGA::Project.INCLADE_TASKS.is_a? Array
. Open
assert(MiGA::Project.INCLADE_TASKS.is_a? Array)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for unparenthesized method calls in the argument list of a parenthesized method call.
Example:
# good
method1(method2(arg), method3(arg))
# bad
method1(method2 arg, method3, arg)
Missing magic comment # frozen_string_literal: true
. Open
require 'test_helper'
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop is designed to help upgrade to Ruby 3.0. It will add the
comment # frozen_string_literal: true
to the top of files to
enable frozen string literals. Frozen string literals may be default
in Ruby 3.0. The comment will be added below a shebang and encoding
comment. The frozen string literal comment is only valid in Ruby 2.3+.
Example: EnforcedStyle: when_needed (default)
# The `when_needed` style will add the frozen string literal comment
# to files only when the `TargetRubyVersion` is set to 2.3+.
# bad
module Foo
# ...
end
# good
# frozen_string_literal: true
module Foo
# ...
end
Example: EnforcedStyle: always
# The `always` style will always add the frozen string literal comment
# to a file, regardless of the Ruby version or if `freeze` or `<<` are
# called on a string literal.
# bad
module Bar
# ...
end
# good
# frozen_string_literal: true
module Bar
# ...
end
Example: EnforcedStyle: never
# The `never` will enforce that the frozen string literal comment does
# not exist in a file.
# bad
# frozen_string_literal: true
module Baz
# ...
end
# good
module Baz
# ...
end
required_ruby_version
(2.7, declared in miga-base.gemspec) and TargetRubyVersion
(2.3, declared in .rubocop.yml) should be equal. Open
s.required_ruby_version = '>= 2.7'
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Checks that required_ruby_version
of gemspec and TargetRubyVersion
of .rubocop.yml are equal.
Thereby, RuboCop to perform static analysis working on the version
required by gemspec.
Example:
# When `TargetRubyVersion` of .rubocop.yml is `2.3`.
# bad
Gem::Specification.new do |spec|
spec.required_ruby_version = '>= 2.2.0'
end
# bad
Gem::Specification.new do |spec|
spec.required_ruby_version = '>= 2.4.0'
end
# good
Gem::Specification.new do |spec|
spec.required_ruby_version = '>= 2.3.0'
end
# good
Gem::Specification.new do |spec|
spec.required_ruby_version = '>= 2.3'
end
# good
Gem::Specification.new do |spec|
spec.required_ruby_version = ['>= 2.3.0', '< 2.5.0']
end
Missing space after #
. Open
#o = m.http_request(:get, 'http://uibk.microbial-genomes.org/robots.txt')
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks whether comments have a leading space after the
#
denoting the start of the comment. The leading space is not
required for some RDoc special syntax, like #++
, #--
,
#:nodoc
, =begin
- and =end
comments, "shebang" directives,
or rackup options.
Example:
# bad
#Some comment
# good
# Some comment
Missing magic comment # frozen_string_literal: true
. Open
require 'test_helper'
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop is designed to help upgrade to Ruby 3.0. It will add the
comment # frozen_string_literal: true
to the top of files to
enable frozen string literals. Frozen string literals may be default
in Ruby 3.0. The comment will be added below a shebang and encoding
comment. The frozen string literal comment is only valid in Ruby 2.3+.
Example: EnforcedStyle: when_needed (default)
# The `when_needed` style will add the frozen string literal comment
# to files only when the `TargetRubyVersion` is set to 2.3+.
# bad
module Foo
# ...
end
# good
# frozen_string_literal: true
module Foo
# ...
end
Example: EnforcedStyle: always
# The `always` style will always add the frozen string literal comment
# to a file, regardless of the Ruby version or if `freeze` or `<<` are
# called on a string literal.
# bad
module Bar
# ...
end
# good
# frozen_string_literal: true
module Bar
# ...
end
Example: EnforcedStyle: never
# The `never` will enforce that the frozen string literal comment does
# not exist in a file.
# bad
# frozen_string_literal: true
module Baz
# ...
end
# good
module Baz
# ...
end
end
at 179, 17 is not aligned with %w[pdf wintax mytaxa reg done]
at 176, 19 or .map do |x|
at 177, 12. Open
end,
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks whether the end keywords are aligned properly for do end blocks.
Three modes are supported through the EnforcedStyleAlignWith
configuration parameter:
start_of_block
: the end
shall be aligned with the
start of the line where the do
appeared.
start_of_line
: the end
shall be aligned with the
start of the line where the expression started.
either
(which is the default) : the end
is allowed to be in either
location. The autofixer will default to start_of_line
.
Example: EnforcedStyleAlignWith: either (default)
# bad
foo.bar
.each do
baz
end
# good
variable = lambda do |i|
i
end
Example: EnforcedStyleAlignWith: startofblock
# bad
foo.bar
.each do
baz
end
# good
foo.bar
.each do
baz
end
Example: EnforcedStyleAlignWith: startofline
# bad
foo.bar
.each do
baz
end
# good
foo.bar
.each do
baz
end
Add parentheses to nested method call MiGA::Project.DISTANCE_TASKS.is_a? Array
. Open
assert(MiGA::Project.DISTANCE_TASKS.is_a? Array)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for unparenthesized method calls in the argument list of a parenthesized method call.
Example:
# good
method1(method2(arg), method3(arg))
# bad
method1(method2 arg, method3, arg)
Do not introduce global variables. Open
$counter = 1
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cops looks for uses of global variables. It does not report offenses for built-in global variables. Built-in global variables are allowed by default. Additionally users can allow additional variables via the AllowedVariables option.
Note that backreferences like $1, $2, etc are not global variables.
Example:
# bad
$foo = 2
bar = $foo + 5
# good
FOO = 2
foo = 2
$stdin.read
Use proc
instead of Proc.new
. Open
dataset.add_hook(:on_result_ready, :run_lambda, Proc.new { |r| $res = r })
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cops checks for uses of Proc.new where Kernel#proc would be more appropriate.
Example:
# bad
p = Proc.new { |n| puts n }
# good
p = proc { |n| puts n }
Redundant curly braces around a hash parameter. Open
tx_js = JSON.parse(js, { symbolize_names: false, create_additions: true })
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for braces around the last parameter in a method call
if the last parameter is a hash.
It supports braces
, no_braces
and context_dependent
styles.
Example: EnforcedStyle: braces
# The `braces` style enforces braces around all method
# parameters that are hashes.
# bad
some_method(x, y, a: 1, b: 2)
# good
some_method(x, y, {a: 1, b: 2})
Example: EnforcedStyle: no_braces (default)
# The `no_braces` style checks that the last parameter doesn't
# have braces around it.
# bad
some_method(x, y, {a: 1, b: 2})
# good
some_method(x, y, a: 1, b: 2)
Example: EnforcedStyle: context_dependent
# The `context_dependent` style checks that the last parameter
# doesn't have braces around it, but requires braces if the
# second to last parameter is also a hash literal.
# bad
some_method(x, y, {a: 1, b: 2})
some_method(x, y, {a: 1, b: 2}, a: 1, b: 2)
# good
some_method(x, y, a: 1, b: 2)
some_method(x, y, {a: 1, b: 2}, {a: 1, b: 2})
Missing magic comment # frozen_string_literal: true
. Open
# @package MiGA
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop is designed to help upgrade to Ruby 3.0. It will add the
comment # frozen_string_literal: true
to the top of files to
enable frozen string literals. Frozen string literals may be default
in Ruby 3.0. The comment will be added below a shebang and encoding
comment. The frozen string literal comment is only valid in Ruby 2.3+.
Example: EnforcedStyle: when_needed (default)
# The `when_needed` style will add the frozen string literal comment
# to files only when the `TargetRubyVersion` is set to 2.3+.
# bad
module Foo
# ...
end
# good
# frozen_string_literal: true
module Foo
# ...
end
Example: EnforcedStyle: always
# The `always` style will always add the frozen string literal comment
# to a file, regardless of the Ruby version or if `freeze` or `<<` are
# called on a string literal.
# bad
module Bar
# ...
end
# good
# frozen_string_literal: true
module Bar
# ...
end
Example: EnforcedStyle: never
# The `never` will enforce that the frozen string literal comment does
# not exist in a file.
# bad
# frozen_string_literal: true
module Baz
# ...
end
# good
module Baz
# ...
end
Use //
around regular expression. Open
assert_match(%r{\] x *\r}, o)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop enforces using // or %r around regular expressions.
Example: EnforcedStyle: slashes (default)
# bad
snake_case = %r{^[\dA-Z_]+$}
# bad
regex = %r{
foo
(bar)
(baz)
}x
# good
snake_case = /^[\dA-Z_]+$/
# good
regex = /
foo
(bar)
(baz)
/x
Example: EnforcedStyle: percent_r
# bad
snake_case = /^[\dA-Z_]+$/
# bad
regex = /
foo
(bar)
(baz)
/x
# good
snake_case = %r{^[\dA-Z_]+$}
# good
regex = %r{
foo
(bar)
(baz)
}x
Example: EnforcedStyle: mixed
# bad
snake_case = %r{^[\dA-Z_]+$}
# bad
regex = /
foo
(bar)
(baz)
/x
# good
snake_case = /^[\dA-Z_]+$/
# good
regex = %r{
foo
(bar)
(baz)
}x
Example: AllowInnerSlashes: false (default)
# If `false`, the cop will always recommend using `%r` if one or more
# slashes are found in the regexp string.
# bad
x =~ /home\//
# good
x =~ %r{home/}
Example: AllowInnerSlashes: true
# good
x =~ /home\//