Rakefile
Block has too many lines. [40/25] Open
Open
namespace :assets do
def available_assets
Pathname.glob(
File.expand_path(
"../crowbar_framework/public/assets/**/*",
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.
Prefer $CHILD_STATUS
from the stdlib 'English' module (don't forget to require it) over $?
. (https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms) Open
Open
exit $?.exitstatus
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [104/100] (https://github.com/SUSE/style-guides/blob/master/Ruby.md#metricslinelength) Open
Open
system("for f in `find -name \*.rb`; do echo -n \"Syntaxcheck $f: \"; ruby -c $f || exit $? ; done")
- Create a ticketCreate a ticket
- Exclude checks
Do not suppress exceptions. (https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions) Open
Open
rescue
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for rescue blocks with no body.
Example:
# bad
def some_method
do_something
rescue
# do nothing
end
Example:
# bad
begin
do_something
rescue
# do nothing
end
Example:
# good
def some_method
do_something
rescue
handle_exception
end
Example:
# good
begin
do_something
rescue
handle_exception
end
Favor modifier if
usage when having a single-line body. Another good alternative is the usage of control flow &&
/||
. (https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier) Open
Open
if simple.exist?
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Checks for if and unless statements that would fit on one line
if written as a modifier if/unless. The maximum line length is
configured in the Metrics/LineLength
cop.
Example:
# bad
if condition
do_stuff(bar)
end
unless qux.empty?
Foo.do_something
end
# good
do_stuff(bar) if condition
Foo.do_something unless qux.empty?
Avoid rescuing without specifying an error class. Open
Open
rescue
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for rescuing StandardError
. There are two supported
styles implicit
and explicit
. This cop will not register an offense
if any error other than StandardError
is specified.
Example: EnforcedStyle: implicit
# `implicit` will enforce using `rescue` instead of
# `rescue StandardError`.
# bad
begin
foo
rescue StandardError
bar
end
# good
begin
foo
rescue
bar
end
# good
begin
foo
rescue OtherError
bar
end
# good
begin
foo
rescue StandardError, SecurityError
bar
end
Example: EnforcedStyle: explicit (default)
# `explicit` will enforce using `rescue StandardError`
# instead of `rescue`.
# bad
begin
foo
rescue
bar
end
# good
begin
foo
rescue StandardError
bar
end
# good
begin
foo
rescue OtherError
bar
end
# good
begin
foo
rescue StandardError, SecurityError
bar
end