Block has too many lines. [108/25] Open
namespace :deploy do
task :default do
puts "This task shouldn't be run. Use deploy:first_time or deploy:update"
end
- Read upRead up
- 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.
Block has too many lines. [74/25] Open
namespace :kete do
desc 'Upgrade Kete Installation'
task :upgrade, role: :app do
set_app_environment
run "cd #{current_path} && RAILS_ENV=#{app_environment} rake kete:upgrade"
- Read upRead up
- 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.
Assignment Branch Condition size for symlink_system_directory is too high. [16.03/15] Open
def symlink_system_directory(dir, prefix = '')
run "mkdir -p #{shared_path}/system/#{dir}"
# The keteaccess password file is rewritten later.
# Let's just move it to make sure we can fall back to something if it goes wrong
run "if [ -f #{shared_path}/system/zebradb/keteaccess ]; then mv #{shared_path}/system/zebradb/keteaccess #{shared_path}/system/zebradb/keteaccess.old; fi" if dir == 'zebradb'
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Block has too many lines. [35/25] Open
namespace :symlink do
public_dirs = %w{audio documents image_files video themes}
root_dirs = %w{zebradb imports private}
config_dirs = %w{locales}
all_dirs = public_dirs + root_dirs + config_dirs
- Read upRead up
- 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.
%w
-literals should be delimited by [
and ]
. Open
root_dirs = %w{zebradb imports private}
- Read upRead up
- Exclude checks
This cop enforces the consistent usage of %
-literal delimiters.
Specify the 'default' key to set all preferred delimiters at once. You can continue to specify individual preferred delimiters to override the default.
Example:
# Style/PercentLiteralDelimiters:
# PreferredDelimiters:
# default: '[]'
# '%i': '()'
# good
%w[alpha beta] + %i(gamma delta)
# bad
%W(alpha #{beta})
# bad
%I(alpha beta)
Literal false
appeared as a condition. Open
deploy.gems.update if ENV['UPDATE_GEMS'] || false
- Read upRead up
- Exclude checks
This cop checks for literals used as the conditions or as operands in and/or expressions serving as the conditions of if/while/until.
Example:
# bad
if 20
do_something
end
Example:
# bad
if some_var && true
do_something
end
Example:
# good
if some_var && some_condition
do_something
end
Pass __FILE__
and __LINE__
to eval
method, as they are used by backtraces. Open
eval("deploy.kete.symlink.#{dir}")
- Read upRead up
- Exclude checks
This cop checks eval
method usage. eval
can receive source location
metadata, that are filename and line number. The metadata is used by
backtraces. This cop recommends to pass the metadata to eval
method.
Example:
# bad
eval <<-RUBY
def do_something
end
RUBY
# bad
C.class_eval <<-RUBY
def do_something
end
RUBY
# good
eval <<-RUBY, binding, __FILE__, __LINE__ + 1
def do_something
end
RUBY
# good
C.class_eval <<-RUBY, __FILE__, __LINE__ + 1
def do_something
end
RUBY
Do not use semicolons to terminate expressions. Open
; app_environment; rescue; set(:app_environment, 'production');
- Read upRead up
- Exclude checks
This cop checks for multiple expressions placed on the same line. It also checks for lines terminated with a semicolon.
Example:
# bad
foo = 1; bar = 2;
baz = 3;
# good
foo = 1
bar = 2
baz = 3
%w
-literals should be delimited by [
and ]
. Open
public_dirs = %w{audio documents image_files video themes}
- Read upRead up
- Exclude checks
This cop enforces the consistent usage of %
-literal delimiters.
Specify the 'default' key to set all preferred delimiters at once. You can continue to specify individual preferred delimiters to override the default.
Example:
# Style/PercentLiteralDelimiters:
# PreferredDelimiters:
# default: '[]'
# '%i': '()'
# good
%w[alpha beta] + %i(gamma delta)
# bad
%W(alpha #{beta})
# bad
%I(alpha beta)
rescue
at 123, 25 is not aligned with end
at 124, 4. Open
; app_environment; rescue; set(:app_environment, 'production');
- Read upRead up
- Exclude checks
This cop checks whether the rescue and ensure keywords are aligned properly.
Example:
# bad
begin
something
rescue
puts 'error'
end
# good
begin
something
rescue
puts 'error'
end
Avoid rescuing without specifying an error class. Open
; app_environment; rescue; set(:app_environment, 'production');
- Read upRead up
- 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
Do not use semicolons to terminate expressions. Open
; app_environment; rescue; set(:app_environment, 'production');
- Read upRead up
- Exclude checks
This cop checks for multiple expressions placed on the same line. It also checks for lines terminated with a semicolon.
Example:
# bad
foo = 1; bar = 2;
baz = 3;
# good
foo = 1
bar = 2
baz = 3
%w
-literals should be delimited by [
and ]
. Open
config_dirs = %w{locales}
- Read upRead up
- Exclude checks
This cop enforces the consistent usage of %
-literal delimiters.
Specify the 'default' key to set all preferred delimiters at once. You can continue to specify individual preferred delimiters to override the default.
Example:
# Style/PercentLiteralDelimiters:
# PreferredDelimiters:
# default: '[]'
# '%i': '()'
# good
%w[alpha beta] + %i(gamma delta)
# bad
%W(alpha #{beta})
# bad
%I(alpha beta)
The use of eval
is a serious security risk. Open
eval("deploy.kete.symlink.#{dir}")
- Read upRead up
- Exclude checks
This cop checks for the use of Kernel#eval
and Binding#eval
.
Example:
# bad
eval(something)
binding.eval(something)